1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

Further reorganisations of seen_disp_event().

Shortly after the previous commit I spotted another definitely missing
display update: if you send the byte 0x7F, aka 'destructive
backspace', then the display didn't update immediately.

That was two in a row, so I did an eyeball review of the whole
terminal state machine to the best of my ability. Found a couple more
borderline ones, but also, found that the entire VT52 sub-state-
machine had a blanket seen_disp_event which really _shouldn't_ have
been there, because half the VT52 sequences aren't actually display-
modifying updates.

To make this _slightly_ less error-prone, I've sunk a number of
seen_disp_update calls into subroutines that aren't the top-level
term_out(). For example, erase_lots(), scroll(), move() and
swap_screen() now all call seen_disp_update within themselves, so
their call sites don't all have to remember to.

There are probably further bugs after this upheaval, but I think it's
moving in generally the right direction.

(cherry picked from commit 6a6efd36aa)
This commit is contained in:
Simon Tatham 2023-09-25 20:43:55 +01:00
parent 4503314376
commit bb453dd27c

View File

@ -2556,6 +2556,8 @@ static void swap_screen(Terminal *term, int which,
*/
erase_lots(term, false, true, true);
}
seen_disp_event(term);
}
/*
@ -2737,6 +2739,8 @@ static void scroll(Terminal *term, int topline, int botline,
}
}
}
seen_disp_event(term);
}
/*
@ -2766,6 +2770,7 @@ static void move(Terminal *term, int x, int y, int marg_clip)
term->curs.x = x;
term->curs.y = y;
term->wrapnext = false;
seen_disp_event(term);
}
/*
@ -2804,6 +2809,7 @@ static void save_cursor(Terminal *term, bool save)
term->cset_attr[term->cset] = term->save_csattr;
term->sco_acs = term->save_sco_acs;
set_erase_char(term);
seen_disp_event(term);
}
}
@ -2962,6 +2968,8 @@ static void erase_lots(Terminal *term,
* application has explicitly thrown them away). */
if (erasing_lines_from_top && !(term->alt_which))
term->tempsblines = 0;
seen_disp_event(term);
}
/*
@ -3872,6 +3880,7 @@ static void term_out(Terminal *term, bool called_from_term_data)
copy_termchar(scrlineptr(term->curs.y),
term->curs.x, &term->erase_char);
}
seen_disp_event(term);
} else
/* Or normal C0 controls. */
if ((c & ~0x1F) == 0 && term->termstate < DO_CTRLS) {
@ -4136,7 +4145,6 @@ static void term_out(Terminal *term, bool called_from_term_data)
case '8': /* DECRC: restore cursor */
compatibility(VT100);
save_cursor(term, false);
seen_disp_event(term);
break;
case '=': /* DECKPAM: Keypad application mode */
compatibility(VT100);
@ -4810,7 +4818,6 @@ static void term_out(Terminal *term, bool called_from_term_data)
break;
case 'u': /* restore cursor */
save_cursor(term, false);
seen_disp_event(term);
break;
case 't': /* DECSLPP: set page size - ie window height */
/*
@ -4983,7 +4990,6 @@ static void term_out(Terminal *term, bool called_from_term_data)
scroll(term, term->marg_t, term->marg_b,
def(term->esc_args[0], 1), true);
term->wrapnext = false;
seen_disp_event(term);
break;
case 'T': /* SD: Scroll down */
CLAMP(term->esc_args[0], term->rows);
@ -4991,7 +4997,6 @@ static void term_out(Terminal *term, bool called_from_term_data)
scroll(term, term->marg_t, term->marg_b,
-def(term->esc_args[0], 1), true);
term->wrapnext = false;
seen_disp_event(term);
break;
case ANSI('|', '*'): /* DECSNLS */
/*
@ -5467,7 +5472,6 @@ static void term_out(Terminal *term, bool called_from_term_data)
break;
case VT52_ESC:
term->termstate = TOPLEVEL;
seen_disp_event(term);
switch (c) {
case 'A':
move(term, term->curs.x, term->curs.y - 1, 1);
@ -5531,10 +5535,12 @@ static void term_out(Terminal *term, bool called_from_term_data)
move(term, 0, 0, 0);
break;
case 'I':
if (term->curs.y == 0)
if (term->curs.y == 0) {
scroll(term, 0, term->rows - 1, -1, true);
else if (term->curs.y > 0)
} else if (term->curs.y > 0) {
term->curs.y--;
seen_disp_event(term);
}
term->wrapnext = false;
break;
case 'J':
@ -5625,10 +5631,12 @@ static void term_out(Terminal *term, bool called_from_term_data)
case 'e':
/* compatibility(ATARI) */
term->cursor_on = true;
seen_disp_event(term);
break;
case 'f':
/* compatibility(ATARI) */
term->cursor_on = false;
seen_disp_event(term);
break;
/* case 'j': Save cursor position - broken on ST */
/* case 'k': Restore cursor position */