diff src/buffer.c @ 29812:68ef14b21d01 v9.0.0245

patch 9.0.0245: mechanism to prevent recursive screen updating is incomplete Commit: https://github.com/vim/vim/commit/471c0fa3eed4f6207d1cb7636970547bfd2eee26 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Aug 22 15:19:16 2022 +0100 patch 9.0.0245: mechanism to prevent recursive screen updating is incomplete Problem: Mechanism to prevent recursive screen updating is incomplete. Solution: Add "redraw_not_allowed" and set it in build_stl_str_hl(). (issue #10952)
author Bram Moolenaar <Bram@vim.org>
date Mon, 22 Aug 2022 16:30:03 +0200
parents bc6cf208b1b4
children 349517ab7398
line wrap: on
line diff
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -4228,10 +4228,15 @@ build_stl_str_hl(
     char_u	win_tmp[TMPLEN];
     char_u	*usefmt = fmt;
     stl_hlrec_T *sp;
-    int		save_must_redraw = must_redraw;
-    int		save_redr_type = curwin->w_redr_type;
+    int		save_redraw_not_allowed = redraw_not_allowed;
     int		save_KeyTyped = KeyTyped;
 
+    // When inside update_screen() we do not want redrawing a statusline,
+    // ruler, title, etc. to trigger another redraw, it may cause an endless
+    // loop.
+    if (updating_screen)
+	redraw_not_allowed = TRUE;
+
     if (stl_items == NULL)
     {
 	stl_items = ALLOC_MULT(stl_item_T, stl_items_len);
@@ -4968,11 +4973,11 @@ build_stl_str_hl(
 	else
 	    stl_items[curitem].stl_type = Empty;
 
+	if (num >= 0 || (!itemisflag && str != NULL && *str != NUL))
+	    prevchar_isflag = FALSE;	    // Item not NULL, but not a flag
+					    //
 	if (opt == STL_VIM_EXPR)
 	    vim_free(str);
-
-	if (num >= 0 || (!itemisflag && str && *str))
-	    prevchar_isflag = FALSE;	    // Item not NULL, but not a flag
 	curitem++;
     }
     *p = NUL;
@@ -5125,13 +5130,7 @@ build_stl_str_hl(
 	sp->userhl = 0;
     }
 
-    // When inside update_screen we do not want redrawing a statusline, ruler,
-    // title, etc. to trigger another redraw, it may cause an endless loop.
-    if (updating_screen)
-    {
-	must_redraw = save_must_redraw;
-	curwin->w_redr_type = save_redr_type;
-    }
+    redraw_not_allowed = save_redraw_not_allowed;
 
     // A user function may reset KeyTyped, restore it.
     KeyTyped = save_KeyTyped;