

Code: Select all
function key_macro()
screen_update_disable()
MarkBlockSet()
MoveDocumentEndEx()
MoveDocumentEndEx()
screen_update_enable()
screen_update()
end
key_macro() -- run the macro
Code: Select all
function key_macro()
-- macro only works for documents
local document = is_document()
if (document == 0) then
message("This macro only works for documents.");
beep();
return;
end
screen_update_disable()
MarkBlockSet()
MoveDocumentEndEx()
MoveDocumentEndEx()
screen_update_enable()
screen_update()
end
key_macro() -- run the macro
Code: Select all
function SelectCursorToDocEnd()
local document = is_document()
if (document == 0) then
return
end
screen_update_disable()
MarkBlockSet()
MoveDocumentEnd()
screen_update_enable()
screen_update()
MarkBlockToggleEx()
end
SelectCursorToDocEnd() -- run the macro
The MoveDocumentEndEx function was in the macro I recorded because this is a Brief specific function and I run the Brief keyboard mapping.I modified your second example slightly, using only one MoveDocumentEnd
This is because the marked mode is still active.Although I have the "Keypress removes mark" mapping option selected, up, down, right or left arrow (only) keypresses adjust the marked block rather than dispensing/removing the selection as I would have hoped.
Code: Select all
function SelectCursorToDocEnd()
local document = is_document()
if (document == 0) then
return
end
screen_update_disable()
-- differnet marking modes
local MARK_COLUMN = 0
local MARK_LINE = 1
local MARK_BLOCK = 2
local MARK_RAGGED = 3
local MARK_CUA = 4
-- define the marked region
local top = get_line_pos()
local left = get_cursor_pos()
local bottom = get_line_count() + 1
local right = 0 -- no marked area for the last line
local mode = MARK_BLOCK
-- remove any active marked area
MarkHide()
-- move cursor to end of file
set_line_pos(bottom, right + 1)
-- apply the new marked region
set_marked_area(mode, top, left, bottom, right)
screen_update_enable()
screen_update()
end
SelectCursorToDocEnd() -- run the macro
That is because, Zeus by design makes sure the cursor is always on the screen.I guess another thing that fails in this example is that, after I make a selection using a macro such as this, the moment I use my mouse to scroll the window, my selection disappears.
I can replicate this behaviour at this end and will look into why they are not consistent.For example, if I make a selection using my mouse by clicking (and holding) and dragging my mouse, release the button and then scroll, my selection remains highlighted.