diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2020-10-01 18:08:29 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2020-10-01 18:08:29 +0000 |
| commit | 02e3e4ac9b2703a0a867211c2482eab257cbc311 (patch) | |
| tree | e4a581b3308b38a4c50efec2c94fb493bc1bafda | |
| parent | changelog: trackpad scrolling: ‘multiplier’ is in the ‘scrollback’ section (diff) | |
term: cursor-left: reduce move count by one when lcf=true
When lcf is true, cursor is actually beyond the right margin, but the
stored coordinate is at the margin.
This means we need to reduce the number of cells to move the cursor by
one.
This fixes an issue where e.g. backspacing when the cursor is at the
right margin erased the next-to-last character instead of the last
character.
| -rw-r--r-- | CHANGELOG.md | 2 | ||||
| -rw-r--r-- | terminal.c | 5 |
2 files changed, 7 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 67d38093..8bef0278 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,8 @@ that it is (much) slower compared to previous foot versions. Use the **scrollback.multiplier** option in `foot.ini` if you find the new speed too slow (https://codeberg.org/dnkl/foot/issues/144). +* Cursor left movements moving cursor to wrong location when cursor is + “beyond” the right margin. ### Security @@ -1728,6 +1728,11 @@ term_cursor_home(struct terminal *term) void term_cursor_left(struct terminal *term, int count) { + if (unlikely(term->grid->cursor.lcf)) + count--; + + assert(count >= 0); + int move_amount = min(term->grid->cursor.point.col, count); term->grid->cursor.point.col -= move_amount; assert(term->grid->cursor.point.col >= 0); |
