Page 1 of 1

Backspace with selected blocks

Posted: Tue Mar 08, 2005 1:12 pm
by robertc
Hi

How do I change the behaviour of backspace to only delete the selected block if there is a selection?

At the moment, it deletes the block and the previous char which is different to all the other editors I use (and thus annoying!).

Also, ctrl+backspace when the cursor is in the middle of a word deletes the whole word whereas I only want it to delete to the start of the word.

Thanks
Robert
p.s. Otherwise I find it nice and am considering switching!

Posted: Tue Mar 08, 2005 10:29 pm
by Guest
Hi Robert,
How do I change the behaviour of backspace to only delete the selected block if there is a selection?
Save the macro below to the c:\program files\zeus\zScript\backspace.lua file:

Code: Select all

function key_macro()
  screen_update_disable()

  -- this macro will only work for document windows
  local document = is_document()

  if (document == 0) then
    message ("This macro only works for document files!")
    beep ()
    return 1
  end

  -- this macro will only work for read/write documents
  local locked = is_read_only()

  if (locked == 1) then
    message ("The current document is marked as read only!")
    beep ()
    return 1
  end

  -- look for a marked area
  local marked = is_marked()

  if marked == 1 then
    -- the marked area is gone
    MarkDelete()
  else
    -- do a normal backspace
    Backspace()
  end

  screen_update()
end

key_macro() -- run the macro
and then bind the macro file to the backspace key.
Jussi

Posted: Tue Mar 08, 2005 11:28 pm
by Guest
Thanks - that works for that, but now the backspace doesn't go past the start of the line.

Will have a go to try and figure that one out tomorrow (unless brilliant suggestions forthcoming!).

Robert

Posted: Wed Mar 09, 2005 11:20 am
by jussij
Hi Robert,

Just change the call to Backspace() to read BackspaceEx() .

Cheers Jussi

Posted: Wed Mar 09, 2005 12:10 pm
by Guest
Perfect!

Posted: Mon Jun 06, 2005 5:34 am
by Guest
Use the Options, Editor Options menu and uncheck the Help debug tools, macros and executables option.

Cheers Jussi