Checking in a macro if a line or 1 column is selected

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
dmaon
Posts: 14
Joined: Wed Nov 29, 2006 2:17 pm

Checking in a macro if a line or 1 column is selected

Post by dmaon »

In a macro if I use "get_marked_left()" and the whole line is selected I do not get 1 as an answer - but the column where the user was when he marked the line with "MarkLineToggle". Is there any way to check if the whole line is marked?
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

In a macro if I use "get_marked_left()" and the whole line is selected I do not get 1 as an answer
I don't seem to get the same result :?

If I run this macro:

Code: Select all

function key_macro()
    screen_update_disable()
    MarkLineToggle()
    top    = get_marked_top()
    bottom = get_marked_bottom()
    left   = get_marked_left()
    right  = get_marked_right()
    message(" Top:" .. top .. " Bottom:" .. bottom .. " Left: " .. left .. " Right:" ..  right);
    screen_update_enable()
    screen_update()
end

key_macro() -- run the macro
I get a value of left = 1 as expected.
Is there any way to check if the whole line is marked?
As the macro above shows the right marked point is equal to the line length. But you could also use the is_marked, get_marked_mode functions and use the top and bottom marked values to determine the number of lines marked.

Jussi
dmaon
Posts: 14
Joined: Wed Nov 29, 2006 2:17 pm

Post by dmaon »

Thanks - the get_marked_mode() does the trick - but note that I could not find it anywhere in the help.
The problem with get_marked_right() exists.
What you need to do is to assign a key to "MarkLineToggle()" and in the editor put the cursor in the middle of a line and then press the key.
If you then run the macro (after deleting the line MarkLineToggle()) you
will get left=right= the column where you where when pressing the key.
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

The problem with get_marked_right() exists.

Unfortunately I still can not see this bug with the current Zeus 3.95z version :?

What I did was:

(1) Create this marking.lua script file:

Code: Select all

function key_macro()
    screen_update_disable()
    top    = get_marked_top()
    bottom = get_marked_bottom()
    left   = get_marked_left()
    right  = get_marked_right()
    message(" Top:" .. top .. " Bottom:" .. bottom .. " Left: " .. left .. " Right:" ..  right);
    screen_update_enable()
    screen_update()
end

key_macro() -- run the macro
(2) Load the marking.lua script file using the Macros, Load menu.

(3) Opened a scrap text file and use Alt+L to line mark some text (ie Brief keyboard mapping)

(4) Hit the delete key

(5) Hitting F8 (ie Brief execute macro) results in a 0, 0, 0, 0 display in the status bar, no matter where the cursor is located.

Jussi
dmaon
Posts: 14
Joined: Wed Nov 29, 2006 2:17 pm

Post by dmaon »

You are right - I missed one necessary step: after pressing alt+L to mark the line press the down arrow to mark an additional line - then you will see the problem
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

The latest Zeus for Windows 3.96a patch fixes this problem :)

Refer to this link for more details: http://www.zeusedit.com/forum/viewtopic.php?t=1035

Cheers Jussi
Post Reply