From a525d95b7de721c8d09d5eb07952ae3edc8bac49 Mon Sep 17 00:00:00 2001 From: Timo Korvola Date: Sat, 10 Feb 2018 19:12:47 +0200 Subject: [PATCH] Clip cursor position to window sizes. This introduces an inconvenient dependency between resize_screen and unix_resize_screen. #42: Handle terminal resizing --- src/common/screen.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/common/screen.c b/src/common/screen.c index c147f6b..c4bda9c 100644 --- a/src/common/screen.c +++ b/src/common/screen.c @@ -684,12 +684,20 @@ void resize_screen (void) { if (h_version != V6) { - wp[0].x_size = h_screen_width; + if (wp[0].x_cursor > h_screen_width) + wp[0].x_cursor = h_screen_width; wp[1].x_size = h_screen_width; + if (wp[1].x_cursor > h_screen_width) + wp[1].x_cursor = h_screen_width; wp[7].x_size = h_screen_width; + if (wp[7].x_cursor > h_screen_width) + wp[7].x_cursor = h_screen_width; + /*XXX This needs to be in sync with unix_resize_display. */ wp[0].y_size = h_screen_height - wp[1].y_size - wp[7].y_size; + if (wp[0].y_cursor > wp[0].y_size) + wp[0].y_cursor = wp[0].y_size; } }/* resize_screen */ -- 2.34.1