From: Bram Moolenaar Date: Mon, 29 Aug 2022 12:44:28 +0000 (+0100) Subject: patch 9.0.0317: when updating the whole screen a popup may not be redrawn X-Git-Tag: v9.0.0317 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b13d3405fffae1115acc1433479b616f30e292e5;p=vim patch 9.0.0317: when updating the whole screen a popup may not be redrawn Problem: When updating the whole screen a popup may not be redrawn. Solution: Mark the screen and windows for redraw also when not clearing. Also mark popup windows for redraw. --- diff --git a/src/drawscreen.c b/src/drawscreen.c index 529792f06..a0801e586 100644 --- a/src/drawscreen.c +++ b/src/drawscreen.c @@ -173,13 +173,19 @@ update_screen(int type_arg) if (type != UPD_CLEAR) { if (msg_scrolled > Rows - 5) // redrawing is faster + { type = UPD_NOT_VALID; + redraw_as_cleared(); + } else { check_for_delay(FALSE); if (screen_ins_lines(0, 0, msg_scrolled, (int)Rows, 0, NULL) == FAIL) + { type = UPD_NOT_VALID; + redraw_as_cleared(); + } FOR_ALL_WINDOWS(wp) { if (wp->w_winrow < msg_scrolled) diff --git a/src/popupwin.c b/src/popupwin.c index 8e74e4201..0240994be 100644 --- a/src/popupwin.c +++ b/src/popupwin.c @@ -1937,6 +1937,20 @@ popup_terminal_exists(void) } #endif +/* + * Mark all popup windows in the current tab and global for redrawing. + */ + void +popup_redraw_all(void) +{ + win_T *wp; + + FOR_ALL_POPUPWINS(wp) + wp->w_redr_type = UPD_NOT_VALID; + FOR_ALL_POPUPWINS_IN_TAB(curtab, wp) + wp->w_redr_type = UPD_NOT_VALID; +} + /* * Set the color for a notification window. */ diff --git a/src/proto/popupwin.pro b/src/proto/popupwin.pro index a12cb3eb2..4d669ef86 100644 --- a/src/proto/popupwin.pro +++ b/src/proto/popupwin.pro @@ -15,6 +15,7 @@ int parse_previewpopup(win_T *wp); int parse_completepopup(win_T *wp); void popup_set_wantpos_cursor(win_T *wp, int width, dict_T *d); void popup_set_wantpos_rowcol(win_T *wp, int row, int col); +void popup_redraw_all(void); void f_popup_clear(typval_T *argvars, typval_T *rettv); void f_popup_create(typval_T *argvars, typval_T *rettv); void f_popup_atcursor(typval_T *argvars, typval_T *rettv); diff --git a/src/proto/screen.pro b/src/proto/screen.pro index 81e5e101c..2b775372b 100644 --- a/src/proto/screen.pro +++ b/src/proto/screen.pro @@ -31,6 +31,7 @@ int screen_valid(int doclear); void screenalloc(int doclear); void free_screenlines(void); void screenclear(void); +void redraw_as_cleared(void); void line_was_clobbered(int screen_lnum); int can_clear(char_u *p); void screen_start(void); diff --git a/src/screen.c b/src/screen.c index a1741ca5f..eb01fdbd3 100644 --- a/src/screen.c +++ b/src/screen.c @@ -49,7 +49,7 @@ static int screen_attr = 0; static void screen_char_2(unsigned off, int row, int col); -static void screenclear2(void); +static void screenclear2(int doclear); static void lineclear(unsigned off, int width, int attr); static void lineinvalid(unsigned off, int width); static int win_do_lines(win_T *wp, int row, int line_count, int mayclear, int del, int clear_attr); @@ -2906,7 +2906,7 @@ give_up: set_must_redraw(UPD_CLEAR); // need to clear the screen later if (doclear) - screenclear2(); + screenclear2(TRUE); #ifdef FEAT_GUI else if (gui.in_use && !gui.starting @@ -2969,16 +2969,30 @@ free_screenlines(void) #endif } +/* + * Clear the screen. + * May delay if there is something the user should read. + * Allocated the screen for resizing if needed. + */ void screenclear(void) { check_for_delay(FALSE); screenalloc(FALSE); // allocate screen buffers if size changed - screenclear2(); // clear the screen + screenclear2(TRUE); // clear the screen +} + +/* + * Do not clear the screen but mark everything for redraw. + */ + void +redraw_as_cleared(void) +{ + screenclear2(FALSE); } static void -screenclear2(void) +screenclear2(int doclear) { int i; @@ -3007,7 +3021,7 @@ screenclear2(void) LineWraps[i] = FALSE; } - if (can_clear(T_CL)) + if (doclear && can_clear(T_CL)) { out_str(T_CL); // clear the display clear_cmdline = FALSE; @@ -3023,7 +3037,10 @@ screenclear2(void) screen_cleared = TRUE; // can use contents of ScreenLines now - win_rest_invalid(firstwin); + win_rest_invalid(firstwin); // redraw all regular windows +#ifdef FEAT_PROP_POPUP + popup_redraw_all(); // redraw all popup windows +#endif redraw_cmdline = TRUE; redraw_tabline = TRUE; if (must_redraw == UPD_CLEAR) // no need to clear again diff --git a/src/testdir/dumps/Test_popupwin_win_execute.dump b/src/testdir/dumps/Test_popupwin_win_execute.dump index f5548591c..b890a28a6 100644 --- a/src/testdir/dumps/Test_popupwin_win_execute.dump +++ b/src/testdir/dumps/Test_popupwin_win_execute.dump @@ -2,7 +2,7 @@ |~+0#4040ff13&| @73 |~| @73 |~| @73 -|~| @31| +0#0000000&@8| +0#4040ff13&@32 +|~| @31|s+0#0000001#ffd7ff255|o|m|e| |t|e|x|t| +0#4040ff13#ffffff0@32 |~| @73 |~| @73 |~| @73 diff --git a/src/version.c b/src/version.c index 4dbe10080..6cd7bd28b 100644 --- a/src/version.c +++ b/src/version.c @@ -707,6 +707,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 317, /**/ 316, /**/