Minor improvement of weston-terminal resizing
authorJosé Bollo <jb@nonadev.net>
Fri, 13 Sep 2013 09:28:51 +0000 (11:28 +0200)
committerKristian Høgsberg <krh@bitplanet.net>
Fri, 13 Sep 2013 22:42:28 +0000 (15:42 -0700)
clients/terminal.c

index 1c60eba..ee2baf0 100644 (file)
@@ -762,6 +762,11 @@ terminal_resize_cells(struct terminal *terminal, int width, int height)
 
                if (terminal->height > height) {
                        total_rows = height;
+                       i = 1 + terminal->row - height;
+                       if (i > 0) {
+                           terminal->start = (terminal->start + i) % terminal->height;
+                           terminal->row = terminal->row - i;
+                       }
                } else {
                        total_rows = terminal->height;
                }
@@ -789,6 +794,7 @@ terminal_resize_cells(struct terminal *terminal, int width, int height)
        terminal->data = data;
        terminal->data_attr = data_attr;
        terminal->tab_ruler = tab_ruler;
+       terminal->start = 0;
        terminal_init_tabs(terminal);
 
        /* Update the window size */