Clip cursor position to window sizes.
authorTimo Korvola <tkorvola@iki.fi>
Sat, 10 Feb 2018 17:12:47 +0000 (19:12 +0200)
committerTimo Korvola <tkorvola@iki.fi>
Sat, 10 Feb 2018 17:12:47 +0000 (19:12 +0200)
This introduces an inconvenient dependency between resize_screen
and unix_resize_screen.

#42: Handle terminal resizing

src/common/screen.c

index c147f6bfd32d6b46199686aceb2e1254da034a4d..c4bda9c77e54c217401f18a80cf1e77d12245984 100644 (file)
@@ -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 */