Backspace with selected blocks

Get help with the installation and running of the Zeus IDE. Please do not post bug reports or feature requests here. When in doubt post your question here.
Post Reply
robertc

Backspace with selected blocks

Post 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!
Guest

Post 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
Guest

Post 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
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

Hi Robert,

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

Cheers Jussi
Guest

Post by Guest »

Perfect!
Guest

Post by Guest »

Use the Options, Editor Options menu and uncheck the Help debug tools, macros and executables option.

Cheers Jussi
Post Reply