Fix crash on load of bigger font. It reduce width and height of terminal, but
current cursor position stay bigger that terminal window size, so next input triggers assert. Reported by: emaste Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
c79a4afc20
commit
f821d023ac
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=261547
@ -338,10 +338,26 @@ teken_get_winsize(teken_t *t)
|
|||||||
return (&t->t_winsize);
|
return (&t->t_winsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
taken_trim_cursor_pos(teken_t *t, const teken_pos_t *new)
|
||||||
|
{
|
||||||
|
const teken_pos_t *cur;
|
||||||
|
|
||||||
|
cur = &t->t_winsize;
|
||||||
|
|
||||||
|
if (cur->tp_row < new->tp_row || cur->tp_col < new->tp_col)
|
||||||
|
return;
|
||||||
|
if (t->t_cursor.tp_row >= new->tp_row)
|
||||||
|
t->t_cursor.tp_row = new->tp_row - 1;
|
||||||
|
if (t->t_cursor.tp_col >= new->tp_col)
|
||||||
|
t->t_cursor.tp_col = new->tp_col - 1;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
teken_set_winsize(teken_t *t, const teken_pos_t *p)
|
teken_set_winsize(teken_t *t, const teken_pos_t *p)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
taken_trim_cursor_pos(t, p);
|
||||||
t->t_winsize = *p;
|
t->t_winsize = *p;
|
||||||
teken_subr_do_reset(t);
|
teken_subr_do_reset(t);
|
||||||
}
|
}
|
||||||
@ -350,6 +366,7 @@ void
|
|||||||
teken_set_winsize_noreset(teken_t *t, const teken_pos_t *p)
|
teken_set_winsize_noreset(teken_t *t, const teken_pos_t *p)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
taken_trim_cursor_pos(t, p);
|
||||||
t->t_winsize = *p;
|
t->t_winsize = *p;
|
||||||
teken_subr_do_resize(t);
|
teken_subr_do_resize(t);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user