Author Topic: Control behaviour of delete-line operation  (Read 3021 times)

rjflory

  • Community Member
  • Posts: 12
  • Hero Points: 0
Control behaviour of delete-line operation
« on: January 22, 2018, 09:17:56 PM »
Am using BRIEF emulation, but assume this is the same for other mappings.

 By default, each time I press delete-line (gray-minus), the current line is deleted.  When I reach End-Of-File, the cursor is moved up to the previous line, and that line is deleted.  This can continue until the entire file is deleted (empty).

 I would much prefer the normal Brief/Crisp operation, where delete-line will delete only the current line, and lines BELOW the current line.  If one deletes into EOF, the cursor will remain at EOF, and NOT moved up to the previous line.

 I have searched the forum and SE config items, but have not come across a control for this behaviour (yet).  Hopefully this is really simple.

ron

Graeme

  • Senior Community Member
  • Posts: 2796
  • Hero Points: 347
Re: Control behaviour of delete-line operation
« Reply #1 on: January 22, 2018, 10:43:58 PM »
You can use a simple macro.  Copy it into e.g. mymacros.e and load it using the load command in the macro menu.

Code: [Select]
#include "slick.sh"
_command my_delete_line() name_info(','VSARG2_MARK|VSARG2_REQUIRES_EDITORCTL)
{
   _macro('R',1);
   deselect();
   if ( down() ) {
      // we're on the last line
      replace_line('');
      return 0;
   }
   up();
   delete_line();
}


rjflory

  • Community Member
  • Posts: 12
  • Hero Points: 0
Re: Control behaviour of delete-line operation
« Reply #2 on: January 23, 2018, 02:18:52 PM »
hmmm, something is missing.  Do I need to assign a key-binding (PadMinus) to the new macro?  I tried this, but the key-binding screen does not appear to offer such functionality.  At least I was able to clean up from my attempts with "Restore to default key bindings"...  ;)   I'm sure there is a way to reassign a key to a user macro, assuming this is what you intended.

ron

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6877
  • Hero Points: 530
Re: Control behaviour of delete-line operation
« Reply #3 on: January 23, 2018, 04:43:40 PM »
Here's a video on how to bind a key:

https://www.youtube.com/watch?v=22xlHPMc46w

If you've loaded this macro, you should see "my-delete-line" in the command list.