From 303d20a758a2779f76854b6df10f8764e44fc407 Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 12 Mar 2019 13:14:14 +0000 Subject: Fix wrapping after origin mode change. --- screen-write.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/screen-write.c b/screen-write.c index e8aa0973..a6e78f42 100644 --- a/screen-write.c +++ b/screen-write.c @@ -75,7 +75,7 @@ screen_write_set_cursor(struct screen_write_ctx *ctx, int cx, int cy) return; if (cx != -1) { - if ((u_int)cx > screen_size_x(s) - 1) + if ((u_int)cx > screen_size_x(s)) /* allow last column */ cx = screen_size_x(s) - 1; s->cx = cx; } @@ -1045,6 +1045,11 @@ screen_write_cursormove(struct screen_write_ctx *ctx, u_int px, u_int py) py += s->rupper; } + if (px > screen_size_x(s) - 1) + px = screen_size_x(s) - 1; + if (py > screen_size_y(s) - 1) + py = screen_size_y(s) - 1; + screen_write_set_cursor(ctx, px, py); } -- cgit