From 79cdf026f1b8a16298ee73be497c4bd5f3458cde Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 20 May 2023 14:07:00 +0100 Subject: patch 9.0.1571: RedrawingDisabled not used consistently Problem: RedrawingDisabled not used consistently. Solution: Avoid RedrawingDisabled going negative. Set RedrawingDisabled in win_split_ins(). (closes #11961) --- src/ex_docmd.c | 48 ++++++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 22 deletions(-) (limited to 'src/ex_docmd.c') diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 430ca2ccb4..69af1ca1d0 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -550,7 +550,8 @@ do_exmode( #ifdef FEAT_GUI --hold_gui_events; #endif - --RedrawingDisabled; + if (RedrawingDisabled > 0) + --RedrawingDisabled; --no_wait_return; update_screen(UPD_CLEAR); need_wait_return = FALSE; @@ -631,7 +632,7 @@ do_cmdline( static int recursive = 0; // recursive depth int msg_didout_before_start = 0; int count = 0; // line number count - int did_inc = FALSE; // incremented RedrawingDisabled + int did_inc_RedrawingDisabled = FALSE; int retval = OK; #ifdef FEAT_EVAL cstack_T cstack; // conditional stack @@ -977,7 +978,7 @@ do_cmdline( msg_scroll = TRUE; // put messages below each other ++no_wait_return; // don't wait for return until finished ++RedrawingDisabled; - did_inc = TRUE; + did_inc_RedrawingDisabled = TRUE; } } @@ -1336,9 +1337,10 @@ do_cmdline( * hit return before redrawing the screen. With the ":global" command we do * this only once after the command is finished. */ - if (did_inc) + if (did_inc_RedrawingDisabled) { - --RedrawingDisabled; + if (RedrawingDisabled > 0) + --RedrawingDisabled; --no_wait_return; msg_scroll = FALSE; @@ -7170,7 +7172,7 @@ do_exedit( if (exmode_was != EXMODE_VIM) settmode(TMODE_RAW); - int save_rd = RedrawingDisabled; + int save_RedrawingDisabled = RedrawingDisabled; RedrawingDisabled = 0; int save_nwr = no_wait_return; no_wait_return = 0; @@ -7187,7 +7189,7 @@ do_exedit( main_loop(FALSE, TRUE); pending_exmode_active = FALSE; - RedrawingDisabled = save_rd; + RedrawingDisabled = save_RedrawingDisabled; no_wait_return = save_nwr; msg_scroll = save_ms; #ifdef FEAT_GUI @@ -8438,11 +8440,12 @@ ex_redraw(exarg_T *eap) void redraw_cmd(int clear) { - int r = RedrawingDisabled; - int p = p_lz; - + int save_RedrawingDisabled = RedrawingDisabled; RedrawingDisabled = 0; + + int save_p_lz = p_lz; p_lz = FALSE; + validate_cursor(); update_topline(); update_screen(clear ? UPD_CLEAR : VIsual_active ? UPD_INVERTED : 0); @@ -8454,8 +8457,8 @@ redraw_cmd(int clear) # endif resize_console_buf(); #endif - RedrawingDisabled = r; - p_lz = p; + RedrawingDisabled = save_RedrawingDisabled; + p_lz = save_p_lz; // After drawing the statusline screen_attr may still be set. screen_stop_highlight(); @@ -8480,9 +8483,6 @@ redraw_cmd(int clear) static void ex_redrawstatus(exarg_T *eap UNUSED) { - int r = RedrawingDisabled; - int p = p_lz; - if (eap->forceit) status_redraw_all(); else @@ -8490,14 +8490,18 @@ ex_redrawstatus(exarg_T *eap UNUSED) if (msg_scrolled && (State & MODE_CMDLINE)) return; // redraw later + int save_RedrawingDisabled = RedrawingDisabled; RedrawingDisabled = 0; + + int save_p_lz = p_lz; p_lz = FALSE; + if (State & MODE_CMDLINE) redraw_statuslines(); else update_screen(VIsual_active ? UPD_INVERTED : 0); - RedrawingDisabled = r; - p_lz = p; + RedrawingDisabled = save_RedrawingDisabled; + p_lz = save_p_lz; out_flush(); } @@ -8507,16 +8511,16 @@ ex_redrawstatus(exarg_T *eap UNUSED) static void ex_redrawtabline(exarg_T *eap UNUSED) { - int r = RedrawingDisabled; - int p = p_lz; - + int save_RedrawingDisabled = RedrawingDisabled; RedrawingDisabled = 0; + + int save_p_lz = p_lz; p_lz = FALSE; draw_tabline(); - RedrawingDisabled = r; - p_lz = p; + RedrawingDisabled = save_RedrawingDisabled; + p_lz = save_p_lz; out_flush(); } -- cgit v1.2.3