summaryrefslogtreecommitdiffstats
path: root/sys/teken/teken_subr.h
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2015-08-24 07:49:27 +0000
committered <ed@FreeBSD.org>2015-08-24 07:49:27 +0000
commit0d7a21a4bde2787f60fb7d4f48749e0e531b51e9 (patch)
tree63147abc891b3d03d09979f1cf1f38d11163e356 /sys/teken/teken_subr.h
parentad4e7c153300b174ead9141fc1d5ff8ae9f7a198 (diff)
downloadFreeBSD-src-0d7a21a4bde2787f60fb7d4f48749e0e531b51e9.zip
FreeBSD-src-0d7a21a4bde2787f60fb7d4f48749e0e531b51e9.tar.gz
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
Diffstat (limited to 'sys/teken/teken_subr.h')
-rw-r--r--sys/teken/teken_subr.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/teken/teken_subr.h b/sys/teken/teken_subr.h
index c686b91..d458f2a 100644
--- a/sys/teken/teken_subr.h
+++ b/sys/teken/teken_subr.h
@@ -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);
OpenPOWER on IntegriCloud