aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/termptyesc.c
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2017-05-16 22:48:18 +0200
committerBoris Faure <billiob@gmail.com>2017-05-16 22:48:18 +0200
commit63d65ed4bb06094e6a8b6cafdc7c4cbfc62dd677 (patch)
tree307ad11018cf608df0a8375a3ab3356e8a4cfd61 /src/bin/termptyesc.c
parenttermpyesc: only compute logging content if it's going to be printed (diff)
downloadterminology-63d65ed4bb06094e6a8b6cafdc7c4cbfc62dd677.tar.gz
termptyesc: restrict values on scrolling regions
Diffstat (limited to 'src/bin/termptyesc.c')
-rw-r--r--src/bin/termptyesc.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/bin/termptyesc.c b/src/bin/termptyesc.c
index 59e062a..7bb131a 100644
--- a/src/bin/termptyesc.c
+++ b/src/bin/termptyesc.c
@@ -1072,9 +1072,8 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce)
else
{
DBG("2 regions args: %i %i", arg, arg2);
- if (arg >= ty->h) arg = ty->h - 1;
- if (arg == 0) arg = 1;
- if (arg2 > ty->h) arg2 = ty->h;
+ TERMPTY_RESTRICT_FIELD(arg, 1, ty->h);
+ TERMPTY_RESTRICT_FIELD(arg2, 1, ty->h);
ty->termstate.scroll_y1 = arg - 1;
ty->termstate.scroll_y2 = arg2;
if ((arg == 1) && (arg2 == ty->h))