Page 1 of 1

home, home, home

Posted: Fri Apr 01, 2005 3:56 pm
by Jack
Hello

Just a simple request, I hope. The sequential hitting of home should work like Visual C++. The first home moves to the 1st character in the line, 2nd home to column 1, etc. I find myself consistly pressing home, then ctl-right_arrow.

On the subject of home sequences, there is a bug in the current feature. Press home and the cursor moves to column 1. Re-position the cursor on a different line with the mouse, then press home again. I would expect the cursor to move to the beginning of the new current line, but it moves to the beginning of the page.

Jack

Posted: Sat Apr 02, 2005 1:41 am
by jussij
Hi Jack,
The first home moves to the 1st character in the line, 2nd home to column 1
Interestingly enough only just a few days ago in this thread I raised the point that many editors add their on special behaviour to many of the standard editing keys. To cut a long story short the end result is Zeus will not try to emulate every such editor using built-in keyboard functions, because the desired functionality can be achieved using as simple macro script.

In this case save the code below to the zScript/home.lua file and rebind the current home key to use this script.

Code: Select all

function key_macro()
   screen_update_disable()
   local cursor = get_cursor_pos()

   if (cursor == 1) then
     MoveLineRight()
   else
     MoveLineHome()
   end
   screen_update_enable()
   screen_update()
end

key_macro() -- run the macro
On the subject of home sequences, there is a bug in the current feature.
Jack, this is blasphemy. What you are in fact seeing is keystroke made famous by the Brief editor :!:

But in a way you are right :roll: Rather than being bound to the MoveDocumentStartEx function, for the MSVC keymap the Home key should in fact be bound to the MoveLineHome function. I will fix up the mapping.

Cheers Jussi

Posted: Mon Apr 04, 2005 2:38 pm
by Guest
Thanks Jussi,

Thanks for the macro. I changed it to the behavour which seems intuitive to me.

Jack

function key_macro()
screen_update_disable()
local cursor_after_move = 1
local start_cursor = get_cursor_pos()

if ( start_cursor ~= 1) then
MoveLineHome()
MoveLineRight()
cursor_after_move = get_cursor_pos()
end

if (start_cursor == cursor_after_move or start_cursor == 1) then
MoveDocumentStartEx()
end
screen_update_enable()
screen_update()
end

key_macro() -- run the macro