Add teken_subr_do_resize new method, to update taken sizes w/o reset positions

and use it in case we update terminal size not touching existing data.

Sponsored by:	The FreeBSD Foundation
This commit is contained in:
ray 2013-10-31 09:44:48 +00:00
parent 630a3895d3
commit a2f43a3339
4 changed files with 19 additions and 5 deletions

View File

@ -201,11 +201,7 @@ terminal_set_winsize_blank(struct terminal *tm, const struct winsize *size,
TERMINAL_LOCK(tm);
if (blank == 0)
/*
* Assigned directly, to avoid terminal reset in the
* teken_set_winsize.
*/
tm->tm_emulator.t_winsize = r.tr_end;
teken_set_winsize_noreset(&tm->tm_emulator, &r.tr_end);
else
teken_set_winsize(&tm->tm_emulator, &r.tr_end);
TERMINAL_UNLOCK(tm);

View File

@ -346,6 +346,14 @@ teken_set_winsize(teken_t *t, const teken_pos_t *p)
teken_subr_do_reset(t);
}
void
teken_set_winsize_noreset(teken_t *t, const teken_pos_t *p)
{
t->t_winsize = *p;
teken_subr_do_resize(t);
}
void
teken_set_8bit(teken_t *t)
{

View File

@ -168,6 +168,7 @@ void teken_set_cursor(teken_t *, const teken_pos_t *);
void teken_set_curattr(teken_t *, const teken_attr_t *);
void teken_set_defattr(teken_t *, const teken_attr_t *);
void teken_set_winsize(teken_t *, const teken_pos_t *);
void teken_set_winsize_noreset(teken_t *, const teken_pos_t *);
/* Key input escape sequences. */
#define TKEY_UP 0x00

View File

@ -955,6 +955,15 @@ teken_subr_reset_mode(teken_t *t, unsigned int cmd)
}
}
static void
teken_subr_do_resize(teken_t *t)
{
t->t_scrollreg.ts_begin = 0;
t->t_scrollreg.ts_end = t->t_winsize.tp_row;
t->t_originreg = t->t_scrollreg;
}
static void
teken_subr_do_reset(teken_t *t)
{