Problem when assigning shift+Tab to a macro

If reporting a bug with the Zeus editor please post the details here. Please do not post questions here.
dmaon
Posts: 14
Joined: Wed Nov 29, 2006 2:17 pm

Problem when assigning shift+Tab to a macro

Postby dmaon » Wed Dec 20, 2006 2:21 pm

Hi Jussi,

I wanted to change the behaviour of the shift+tab so that if several lines are marked, the lines will move one tab backwards, even if the cursor is in the middle of the line ( and not before the first non blank character).
The macro below should do it and works perfectly as long as I assign it to any other key except shift+tab. If I assign it to shift+tab and then go to the middle of a line, press ctrl+L to mark it, go down 2-3 lines and press shift+tab the macro does not work and the mark disappears. If afterwards I go 2 lines up and press ctrl+L the previous line is marked instead of the current one.
The macro is:

Code: Select all

function key_macro()
    screen_update_disable()
    local selected = is_marked()
    if ( selected ~= 0 ) then
       local mode = get_marked_mode()
       if ( mode~=0 ) then
          MoveLineHome()
          TabBack()
       else
          TabBack()
       end
    else
       TabBack()
    end
    screen_update_enable()
    screen_update()
end

key_macro() -- run the macro

jussij
Site Admin
Posts: 2216
Joined: Fri Aug 13, 2004 5:10 pm

Postby jussij » Wed Dec 20, 2006 11:07 pm

The macro below should do it and works perfectly as long as I assign it to any other key except shift+tab.

What is happening is the macro functionality is being messed up by the Zeus CUA marking. For example using Shift+Tab to run the macro also triggers a Shift+MoveLineHome CUA marking action, removing any prior marked area.

Fortunately there is a fix :)

All you need do is replace the call to MoveLineHome with a call to set_cursor_pos(1) instead ;)

Cheers Jussi


Return to “Reporting a Bug”

Who is online

Users browsing this forum: No registered users and 0 guests