mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-03-22 14:39:24 -05:00
Fix behaviour of backspace in a 1-column terminal.
This is the first bug found as a direct result of writing that terminal test program - I added some tests for things I expected to work already, and some of them didn't, proving immediately that it was a good idea! If the terminal is one column wide, and you've printed a character (hence, set the wrapnext flag), what should backspace do? Surely it should behave like any other backspace with wrapnext set, i.e. clear the wrapnext flag, returning the cursor's _logical_ position to the location of the most recently printed character. But in fact it was anti-wrapping to the previous line, because I'd got the cases in the wrong order in the if-else chain that forms the backspace handler. So the handler for 'we're in column 0, wrapping time' was coming before 'wrapnext is set, just clear it'. Now wrapnext is checked _first_, before checking anything at all. Any time we can just clear that, we should. (cherry picked from commit 069f7c8b21df80a80445ffc986f1e243c72bc1cb)
This commit is contained in:
parent
05276bda5c
commit
8b8b774fc0
@ -3965,7 +3965,10 @@ static void term_out(Terminal *term, bool called_from_term_data)
|
||||
break;
|
||||
}
|
||||
case '\b': /* BS: Back space */
|
||||
if (term->curs.x == 0 && (term->curs.y == 0 || !term->wrap)) {
|
||||
if (term->wrapnext) {
|
||||
term->wrapnext = false;
|
||||
} else if (term->curs.x == 0 &&
|
||||
(term->curs.y == 0 || !term->wrap)) {
|
||||
/* do nothing */
|
||||
} else if (term->curs.x == 0 && term->curs.y > 0) {
|
||||
term->curs.x = term->cols - 1, term->curs.y--;
|
||||
@ -3989,8 +3992,6 @@ static void term_out(Terminal *term, bool called_from_term_data)
|
||||
termline *ldata = scrlineptr(term->curs.y);
|
||||
if (term->curs.x > 0 && (ldata->lattr & LATTR_WRAPPED2))
|
||||
term->curs.x--;
|
||||
} else if (term->wrapnext) {
|
||||
term->wrapnext = false;
|
||||
} else {
|
||||
term->curs.x--;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user