Sync HPA and VPA implementations with CUP.

After fixing the 16-bits integer arithmetic overflow in 286981, we
should also make sure to fix the VPA sequence. Bring HPA and VPA in sync
with how we now implement CUP.

PR:		202612
Reported by:	kcwu csie org
MFC after:	1 month
This commit is contained in:
Ed Schouten 2015-08-24 07:49:27 +00:00
parent f2203c2740
commit b8d356b3e6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=287098

View File

@ -583,9 +583,9 @@ static void
teken_subr_horizontal_position_absolute(teken_t *t, unsigned int col)
{
t->t_cursor.tp_col = col - 1;
if (t->t_cursor.tp_col >= t->t_winsize.tp_col)
t->t_cursor.tp_col = t->t_winsize.tp_col - 1;
col--;
t->t_cursor.tp_col = col < t->t_winsize.tp_col ?
col : t->t_winsize.tp_col - 1;
t->t_stateflags &= ~TS_WRAPPED;
teken_funcs_cursor(t);
@ -1297,9 +1297,9 @@ static void
teken_subr_vertical_position_absolute(teken_t *t, unsigned int row)
{
t->t_cursor.tp_row = t->t_originreg.ts_begin + row - 1;
if (t->t_cursor.tp_row >= t->t_originreg.ts_end)
t->t_cursor.tp_row = t->t_originreg.ts_end - 1;
row = row - 1 + t->t_originreg.ts_begin;
t->t_cursor.tp_row = row < t->t_originreg.ts_end ?
row : t->t_originreg.ts_end - 1;
t->t_stateflags &= ~TS_WRAPPED;
teken_funcs_cursor(t);