aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-04-25 21:47:15 -0400
committerJesse Luehrs <doy@tozt.net>2014-04-25 21:47:15 -0400
commit9491ce7f692555517af50eab2debf5d7418272e9 (patch)
tree8a800935e63a18e1349ae2ab2d01a92dd3e01881
parent39ff5573f152b98755bbafcdc3e015ff015ca61d (diff)
downloadrunes-9491ce7f692555517af50eab2debf5d7418272e9.tar.gz
runes-9491ce7f692555517af50eab2debf5d7418272e9.zip
don't let move_to move outside of the screen
-rw-r--r--src/screen.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/screen.c b/src/screen.c
index 0c8ced5..94e70f9 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -121,6 +121,14 @@ void runes_screen_move_to(RunesTerm *t, int row, int col)
row++;
}
+ if (col < 0) {
+ col = 0;
+ }
+
+ if (col > t->scr.max.col) {
+ col = t->scr.max.col;
+ }
+
scr->cur.row = row;
scr->cur.col = col;
}