diff options
-rw-r--r-- | linenoise/linenoise.c | 5 | ||||
-rw-r--r-- | txr.1 | 11 |
2 files changed, 13 insertions, 3 deletions
diff --git a/linenoise/linenoise.c b/linenoise/linenoise.c index 01e48ed9..de12bdb4 100644 --- a/linenoise/linenoise.c +++ b/linenoise/linenoise.c @@ -1339,6 +1339,8 @@ static void edit_move_sol(lino_t *l) { if (l->dpos != dpos) { l->dpos = dpos; l->need_refresh = 1; + } else { + edit_move_home(l); } } } @@ -1357,12 +1359,13 @@ static void edit_move_eol(lino_t *l) { } else { size_t dpos = l->dpos; - dpos += strspn(l->data + dpos, "\r"); dpos += strcspn(l->data + dpos, "\r"); if (l->dpos != dpos) { l->dpos = dpos; l->need_refresh = 1; + } else { + edit_move_end(l); } } } @@ -33997,10 +33997,17 @@ such that the last character of the line is to the left of the cursor position. On terminals which have the Home and End keys, these may also be used instead of Ctrl-A and Ctrl-E. -In multi-line mode, these commands jump to the beginning or end of the -current physical line. In line mode, they move to the beginning or end of the +In line mode, these commands move the cursor to the beginning or end of the edit buffer. +In multi-line mode, if the cursor is not already at the beginning of a physical +line, then Ctrl-A moves it to the first character of the physical line. +Otherwise, Ctrl-A moves the cursor to the beginning of the edit buffer. + +Similarly, in multi-line mode, if the cursor not already at the end of a +physical line, Ctrl-E moves it there. Otherwise, the cursor moves to the +end of the edit buffer. + .NP* Jump to Matching Parenthesis If the cursor is on an opening or closing parenthesis, brace or bracket, |