From 1ec52b893a3934acbb88a2498824f2629b318046 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 4 Feb 2017 17:36:39 +0100 Subject: vim-patch:8.0.0274 Problem: When update_single_line() is called recursively, or another screen update happens while it is busy, errors may occur. Solution: Check and update updating_screen. (Christian Brabandt) https://github.com/vim/vim/commit/070b33da93ad3a191664bb61f5ccc50781460c03 --- src/nvim/screen.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/screen.c b/src/nvim/screen.c index c0db076eff..10a184ad5b 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -487,9 +487,10 @@ void update_single_line(win_T *wp, linenr_T lnum) int j; // Don't do anything if the screen structures are (not yet) valid. - if (!screen_valid(true)) { + if (!screen_valid(true) || updating_screen) { return; } + updating_screen = true; if (lnum >= wp->w_topline && lnum < wp->w_botline && foldedCount(wp, lnum, &win_foldinfo) == 0) { @@ -507,6 +508,7 @@ void update_single_line(win_T *wp, linenr_T lnum) } } need_cursor_line_redraw = FALSE; + updating_screen = false; } -- cgit From b77cad183ddcb7d0f312a3cf022238c43932a07b Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 4 Feb 2017 18:54:55 +0100 Subject: vim-patch:8.0.0275 Problem: When checking for CTRL-C typed the GUI may detect a screen resize and redraw the screen, causing trouble. Solution: Set updating_screen in ui_breakcheck(). https://github.com/vim/vim/commit/e3caa1109072b9655f8d5103c92efd73177f8577 --- src/nvim/os/input.c | 6 ++++++ src/nvim/screen.c | 11 +++++------ 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/nvim/os/input.c b/src/nvim/os/input.c index f264a26939..5f0f2ec677 100644 --- a/src/nvim/os/input.c +++ b/src/nvim/os/input.c @@ -144,9 +144,15 @@ bool os_char_avail(void) // Check for CTRL-C typed by reading all available characters. void os_breakcheck(void) { + int save_us = updating_screen; + // We do not want screen_resize() to redraw here. + updating_screen++; + if (!got_int) { loop_poll_events(&main_loop, 0); } + + updating_screen = save_us; } void input_enable_events(void) diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 10a184ad5b..3823fb2a23 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -507,7 +507,7 @@ void update_single_line(win_T *wp, linenr_T lnum) row += wp->w_lines[j].wl_size; } } - need_cursor_line_redraw = FALSE; + need_cursor_line_redraw = false; updating_screen = false; } @@ -7328,12 +7328,11 @@ void screen_resize(int width, int height) { static int busy = FALSE; - /* - * Avoid recursiveness, can happen when setting the window size causes - * another window-changed signal. - */ - if (busy) + // Avoid recursiveness, can happen when setting the window size causes + // another window-changed signal. + if (updating_screen || busy) { return; + } if (width < 0 || height < 0) /* just checking... */ return; -- cgit