Cursor hug end of line

Post any comments, suggestions, annoyances or ideas for future releases here. Please do not post bug reports or questions here.
Post Reply
rl
Posts: 7
Joined: Fri Apr 17, 2009 2:07 am

Cursor hug end of line

Post by rl »

Hi
Would it be feasible to have an option, perhaps under Tools / Options / General / General Settings, that makes the cursor "hug end of line" when you navigate from a line to another shorter line (similar to Ed)?

When the "hug end of line" option was unchecked, Zeus' behaviour would remain unchanged.
When the "hug end of line" option was checked, Zeus would move the cursor to the end of any line that you navigate to, if that line was shorter than the line that you navigated from, ie. it would not allow the cursor to remain in "whitespace" beyond the end of line, unless you explicitly placed it there with the mouse or the keyboard (eg. right-arrow).

For example, in the following text, if the cursor was resting at the beginning of line 0001 and you pressed the End key to move it to end of line, it would be resting in column 26.
If you then navigated down one line, the cursor would move to column 1 on line 0002. Navigate down one line again and the cursor would move to column 15 (end of line) on line 0003. Navigate down twice more and the cursor would move to column 26 on line 0005. The reason the cursor would move to column 26 (the first "." in ".F.") on line 0005 and not column 29 (end of line) is that the cursor is only moved to EOL if not doing so would cause it to rest in the whitespace beyond EOL.


0001: function Session ( xSet )
0002:
0003: local xRet
0004:
0005: default sxSession to .F.
0006:
0007: xRet := sxSession
0008:
0009: if ! IsNil(xSet)
0010: sxSession := xSet
0011:
0012: endif
0013:
0014: return ( xRet )

Regards
Richard
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

Hi Richard,
Would it be feasible to have an option, perhaps under Tools / Options / General / General Settings, that makes the cursor "hug end of line" when you navigate from a line to another shorter line (similar to Ed)?

I think this is already possible ;)

You need to use the Options, Editor Options menu and turn on the Mouse down puts cursor at EOL option found in the General Panel.

Next, use the Options Editor Options menu and in the Keyboard Mapping panel remap the line up and line down keyboard events to and replace the current functions:

Code: Select all

MoveLineUp
MoveLineDown
to use these functions instead:

Code: Select all

MoveLineUpEx
MoveLineDownEx
Finally, remap the left and right arrow keyboard events to use these functions:

Code: Select all

MoveLineLeftEx
MoveLineRightEx
Cheers Jussi
Last edited by jussij on Thu Jan 28, 2010 10:53 pm, edited 1 time in total.
rl
Posts: 7
Joined: Fri Apr 17, 2009 2:07 am

Post by rl »

Hi Jussi

I tried that and it works near enough, although it seems to put the cursor at the end of every line, not just on occasions when not doing so would leave the cursor sitting out beyond of eol.

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

Post by jussij »

Hi Richard,

I quoted you the wrong functions earlier so I updated my earlier post with the correct function details :oops:

These new functions (see previous post) should work better ;)

Cheers Jussi
rl
Posts: 7
Joined: Fri Apr 17, 2009 2:07 am

Post by rl »

Hi Jussi
Totally excellent.
Thank you.
Richard
Post Reply