vi: allow manual screen update if SIGWINCH isn't supported
authorRon Yorston <rmy@pobox.com>
Wed, 20 Mar 2019 11:00:28 +0000 (11:00 +0000)
committerDenys Vlasenko <vda.linux@googlemail.com>
Sat, 30 Mar 2019 17:03:37 +0000 (18:03 +0100)
On platforms that don't support SIGWINCH vi can be configured
with FEATURE_VI_USE_SIGNALS disabled and FEATURE_VI_WIN_RESIZE
enabled.  This allows the user to force an update with ^L when
the screen is resized.

However, because the SIGWINCH handler hasn't run the virtual
screen buffer won't have been updated and the display becomes
corrupted.  Fix this by calling new_screen() if necessary.

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
editors/vi.c

index 5e5e13111557bfb5c5168e8fd96a1bf454d57fb4..425d14c9c8f849349a46df3714537ed1a3319252 100644 (file)
@@ -3349,7 +3349,15 @@ static void refresh(int full_screen)
        if (ENABLE_FEATURE_VI_WIN_RESIZE IF_FEATURE_VI_ASK_TERMINAL(&& !G.get_rowcol_error) ) {
                unsigned c = columns, r = rows;
                query_screen_dimensions();
+#if ENABLE_FEATURE_VI_USE_SIGNALS
                full_screen |= (c - columns) | (r - rows);
+#else
+               if (c != columns || r != rows) {
+                       full_screen = TRUE;
+                       /* update screen memory since SIGWINCH won't have done it */
+                       new_screen(rows, columns);
+               }
+#endif
        }
        sync_cursor(dot, &crow, &ccol); // where cursor will be (on "dot")
        tp = screenbegin;       // index into text[] of top line