comparison 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
comparison
equal deleted inserted replaced
29811:4a20a89bf324 29812:68ef14b21d01
4226 #define TMPLEN 70 4226 #define TMPLEN 70
4227 char_u buf_tmp[TMPLEN]; 4227 char_u buf_tmp[TMPLEN];
4228 char_u win_tmp[TMPLEN]; 4228 char_u win_tmp[TMPLEN];
4229 char_u *usefmt = fmt; 4229 char_u *usefmt = fmt;
4230 stl_hlrec_T *sp; 4230 stl_hlrec_T *sp;
4231 int save_must_redraw = must_redraw; 4231 int save_redraw_not_allowed = redraw_not_allowed;
4232 int save_redr_type = curwin->w_redr_type;
4233 int save_KeyTyped = KeyTyped; 4232 int save_KeyTyped = KeyTyped;
4233
4234 // When inside update_screen() we do not want redrawing a statusline,
4235 // ruler, title, etc. to trigger another redraw, it may cause an endless
4236 // loop.
4237 if (updating_screen)
4238 redraw_not_allowed = TRUE;
4234 4239
4235 if (stl_items == NULL) 4240 if (stl_items == NULL)
4236 { 4241 {
4237 stl_items = ALLOC_MULT(stl_item_T, stl_items_len); 4242 stl_items = ALLOC_MULT(stl_item_T, stl_items_len);
4238 stl_groupitem = ALLOC_MULT(int, stl_items_len); 4243 stl_groupitem = ALLOC_MULT(int, stl_items_len);
4966 p += STRLEN(p); 4971 p += STRLEN(p);
4967 } 4972 }
4968 else 4973 else
4969 stl_items[curitem].stl_type = Empty; 4974 stl_items[curitem].stl_type = Empty;
4970 4975
4976 if (num >= 0 || (!itemisflag && str != NULL && *str != NUL))
4977 prevchar_isflag = FALSE; // Item not NULL, but not a flag
4978 //
4971 if (opt == STL_VIM_EXPR) 4979 if (opt == STL_VIM_EXPR)
4972 vim_free(str); 4980 vim_free(str);
4973
4974 if (num >= 0 || (!itemisflag && str && *str))
4975 prevchar_isflag = FALSE; // Item not NULL, but not a flag
4976 curitem++; 4981 curitem++;
4977 } 4982 }
4978 *p = NUL; 4983 *p = NUL;
4979 itemcnt = curitem; 4984 itemcnt = curitem;
4980 4985
5123 } 5128 }
5124 sp->start = NULL; 5129 sp->start = NULL;
5125 sp->userhl = 0; 5130 sp->userhl = 0;
5126 } 5131 }
5127 5132
5128 // When inside update_screen we do not want redrawing a statusline, ruler, 5133 redraw_not_allowed = save_redraw_not_allowed;
5129 // title, etc. to trigger another redraw, it may cause an endless loop.
5130 if (updating_screen)
5131 {
5132 must_redraw = save_must_redraw;
5133 curwin->w_redr_type = save_redr_type;
5134 }
5135 5134
5136 // A user function may reset KeyTyped, restore it. 5135 // A user function may reset KeyTyped, restore it.
5137 KeyTyped = save_KeyTyped; 5136 KeyTyped = save_KeyTyped;
5138 5137
5139 return width; 5138 return width;