Make resizing of teken terminals a bit more safe.

Just perform a full reset when resizing the terminal. This means the
cursor, scrolling region, etc. are never positioned outside the
terminal.
This commit is contained in:
ed 2009-09-12 08:19:24 +00:00
parent b3185d9a00
commit a0b9f3abc0
2 changed files with 4 additions and 4 deletions

View File

@ -341,10 +341,7 @@ teken_set_winsize(teken_t *t, const teken_pos_t *p)
{
t->t_winsize = *p;
/* XXX: bounds checking with cursor/etc! */
t->t_scrollreg.ts_begin = 0;
t->t_scrollreg.ts_end = t->t_winsize.tp_row;
t->t_originreg = t->t_scrollreg;
teken_subr_do_reset(t);
}
/*

View File

@ -927,6 +927,9 @@ teken_subr_do_reset(teken_t *t)
t->t_curattr = t->t_defattr;
t->t_cursor.tp_row = t->t_cursor.tp_col = 0;
t->t_scrollreg.ts_begin = 0;
t->t_scrollreg.ts_end = t->t_winsize.tp_row;
t->t_originreg = t->t_scrollreg;
t->t_stateflags = TS_AUTOWRAP;
teken_scs_set(t, 0, teken_scs_us_ascii);