svn commit: r287098 - head/sys/teken
Ed Schouten
ed at FreeBSD.org
Mon Aug 24 07:49:28 UTC 2015
Author: ed
Date: Mon Aug 24 07:49:27 2015
New Revision: 287098
URL: https://svnweb.freebsd.org/changeset/base/287098
Log:
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
Modified:
head/sys/teken/teken_subr.h
Modified: head/sys/teken/teken_subr.h
==============================================================================
--- head/sys/teken/teken_subr.h Mon Aug 24 05:38:05 2015 (r287097)
+++ head/sys/teken/teken_subr.h Mon Aug 24 07:49:27 2015 (r287098)
@@ -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);
More information about the svn-src-all
mailing list