Page 1 of 1

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

Posted: Wed Dec 06, 2006 5:23 pm
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?

Posted: Wed Dec 06, 2006 10:24 pm
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

Posted: Thu Dec 07, 2006 6:24 am
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.

Posted: Thu Dec 07, 2006 10:44 pm
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

Posted: Fri Dec 08, 2006 8:20 am
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

Posted: Mon Jan 22, 2007 10:17 pm
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