diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/buffer.c | 23 | ||||
-rw-r--r-- | src/change.c | 5 | ||||
-rw-r--r-- | src/digraph.c | 2 | ||||
-rw-r--r-- | src/drawscreen.c | 14 | ||||
-rw-r--r-- | src/ex_docmd.c | 2 | ||||
-rw-r--r-- | src/globals.h | 6 | ||||
-rw-r--r-- | src/highlight.c | 18 | ||||
-rw-r--r-- | src/main.c | 2 | ||||
-rw-r--r-- | src/message.c | 5 | ||||
-rw-r--r-- | src/misc1.c | 9 | ||||
-rw-r--r-- | src/proto/drawscreen.pro | 1 | ||||
-rw-r--r-- | src/screen.c | 2 | ||||
-rw-r--r-- | src/version.c | 2 |
13 files changed, 51 insertions, 40 deletions
diff --git a/src/buffer.c b/src/buffer.c index 203238ff78..fba6c218fd 100644 --- 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; diff --git a/src/change.c b/src/change.c index 9e1c1c9188..51ffe28524 100644 --- a/src/change.c +++ b/src/change.c @@ -559,7 +559,7 @@ changed_common( linenr_T last = lnume + xtra - 1; // last line after the change #endif // Mark this window to be redrawn later. - if (wp->w_redr_type < UPD_VALID) + if (!redraw_not_allowed && wp->w_redr_type < UPD_VALID) wp->w_redr_type = UPD_VALID; // Check if a change in the buffer has invalidated the cached @@ -671,8 +671,7 @@ changed_common( // Call update_screen() later, which checks out what needs to be redrawn, // since it notices b_mod_set and then uses b_mod_*. - if (must_redraw < UPD_VALID) - must_redraw = UPD_VALID; + set_must_redraw(UPD_VALID); // when the cursor line is changed always trigger CursorMoved if (lnum <= curwin->w_cursor.lnum diff --git a/src/digraph.c b/src/digraph.c index de4ff83efb..a1ae43a3c7 100644 --- a/src/digraph.c +++ b/src/digraph.c @@ -2028,7 +2028,7 @@ listdigraphs(int use_headers) // clear screen, because some digraphs may be wrong, in which case we // messed up ScreenLines - must_redraw = UPD_CLEAR; + set_must_redraw(UPD_CLEAR); } static void diff --git a/src/drawscreen.c b/src/drawscreen.c index 9e8d9eede1..a9b3643ed8 100644 --- a/src/drawscreen.c +++ b/src/drawscreen.c @@ -3154,7 +3154,7 @@ redraw_win_later( win_T *wp, int type) { - if (!exiting && wp->w_redr_type < type) + if (!exiting && !redraw_not_allowed && wp->w_redr_type < type) { wp->w_redr_type = type; if (type >= UPD_NOT_VALID) @@ -3186,7 +3186,17 @@ redraw_all_later(int type) FOR_ALL_WINDOWS(wp) redraw_win_later(wp, type); // This may be needed when switching tabs. - if (must_redraw < type) + set_must_redraw(type); +} + +/* + * Set "must_redraw" to "type" unless it already has a higher value + * or it is currently not allowed. + */ + void +set_must_redraw(int type) +{ + if (!redraw_not_allowed && must_redraw < type) must_redraw = type; } diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 902fc2c1a2..382029a65a 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -7116,7 +7116,7 @@ do_exedit( #ifdef FEAT_GUI hold_gui_events = 0; #endif - must_redraw = UPD_CLEAR; + set_must_redraw(UPD_CLEAR); pending_exmode_active = TRUE; main_loop(FALSE, TRUE); diff --git a/src/globals.h b/src/globals.h index 99ecefbdde..3c2d904666 100644 --- a/src/globals.h +++ b/src/globals.h @@ -600,9 +600,13 @@ EXTERN int diff_need_scrollbind INIT(= FALSE); #endif // While redrawing the screen this flag is set. It means the screen size -// ('lines' and 'rows') must not be changed. +// ('lines' and 'rows') must not be changed and prevents recursive updating. EXTERN int updating_screen INIT(= FALSE); +// While computing a statusline and the like we do not want any w_redr_type or +// must_redraw to be set. +EXTERN int redraw_not_allowed INIT(= FALSE); + #ifdef MESSAGE_QUEUE // While closing windows or buffers messages should not be handled to avoid // using invalid windows or buffers. diff --git a/src/highlight.c b/src/highlight.c index af85c385da..9fc2ed9b36 100644 --- a/src/highlight.c +++ b/src/highlight.c @@ -939,7 +939,7 @@ highlight_set_ctermfg(int idx, int color, int is_normal_group) if (!gui.in_use && !gui.starting) #endif { - must_redraw = UPD_CLEAR; + set_must_redraw(UPD_CLEAR); if (termcap_active && color >= 0) term_fg_color(color); } @@ -962,7 +962,7 @@ highlight_set_ctermbg(int idx, int color, int is_normal_group) if (!gui.in_use && !gui.starting) #endif { - must_redraw = UPD_CLEAR; + set_must_redraw(UPD_CLEAR); if (color >= 0) { int dark = -1; @@ -1005,7 +1005,7 @@ highlight_set_ctermul(int idx, int color, int is_normal_group) if (!gui.in_use && !gui.starting) #endif { - must_redraw = UPD_CLEAR; + set_must_redraw(UPD_CLEAR); if (termcap_active && color >= 0) term_ul_color(color); } @@ -1919,7 +1919,7 @@ set_normal_colors(void) FALSE, TRUE, FALSE)) { gui_mch_new_colors(); - must_redraw = UPD_CLEAR; + set_must_redraw(UPD_CLEAR); } # ifdef FEAT_GUI_X11 if (set_group_colors((char_u *)"Menu", @@ -1929,7 +1929,7 @@ set_normal_colors(void) # ifdef FEAT_MENU gui_mch_new_menu_colors(); # endif - must_redraw = UPD_CLEAR; + set_must_redraw(UPD_CLEAR); } # ifdef FEAT_BEVAL_GUI if (set_group_colors((char_u *)"Tooltip", @@ -1939,7 +1939,7 @@ set_normal_colors(void) # ifdef FEAT_TOOLBAR gui_mch_new_tooltip_colors(); # endif - must_redraw = UPD_CLEAR; + set_must_redraw(UPD_CLEAR); } # endif if (set_group_colors((char_u *)"Scrollbar", @@ -1947,7 +1947,7 @@ set_normal_colors(void) FALSE, FALSE, FALSE)) { gui_new_scrollbar_colors(); - must_redraw = UPD_CLEAR; + set_must_redraw(UPD_CLEAR); } # endif } @@ -1973,7 +1973,7 @@ set_normal_colors(void) // color cterm_normal_fg_gui_color = HL_TABLE()[idx].sg_gui_fg; cterm_normal_bg_gui_color = HL_TABLE()[idx].sg_gui_bg; - must_redraw = UPD_CLEAR; + set_must_redraw(UPD_CLEAR); } } } @@ -2545,7 +2545,7 @@ get_attr_entry(garray_T *table, attrentry_T *aep) clear_hl_tables(); - must_redraw = UPD_CLEAR; + set_must_redraw(UPD_CLEAR); for (i = 0; i < highlight_ga.ga_len; ++i) set_hl_attr(i); diff --git a/src/main.c b/src/main.c index c6430aaac5..f4db631a31 100644 --- a/src/main.c +++ b/src/main.c @@ -686,7 +686,7 @@ vim_main2(void) && !gui.in_use #endif ) - must_redraw = UPD_CLEAR; + set_must_redraw(UPD_CLEAR); else { screenclear(); // clear screen diff --git a/src/message.c b/src/message.c index 11662ba6a5..46cf1e0272 100644 --- a/src/message.c +++ b/src/message.c @@ -1143,7 +1143,7 @@ wait_return(int redraw) FILE *save_scriptout; if (redraw == TRUE) - must_redraw = UPD_CLEAR; + set_must_redraw(UPD_CLEAR); // If using ":silent cmd", don't wait for a return. Also don't set // need_wait_return to do it later. @@ -2490,8 +2490,7 @@ inc_msg_scrolled(void) } #endif ++msg_scrolled; - if (must_redraw < UPD_VALID) - must_redraw = UPD_VALID; + set_must_redraw(UPD_VALID); } /* diff --git a/src/misc1.c b/src/misc1.c index 6b01ef2bba..6383922521 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -413,10 +413,8 @@ plines_win_nofold(win_T *wp, linenr_T lnum) clear_chartabsize_arg(&cts); col = (int)cts.cts_vcol; - /* - * If list mode is on, then the '$' at the end of the line may take up one - * extra column. - */ + // If list mode is on, then the '$' at the end of the line may take up one + // extra column. if (wp->w_p_list && wp->w_lcs_chars.eol != NUL) col += 1; @@ -585,8 +583,7 @@ check_status(buf_T *buf) if (wp->w_buffer == buf && wp->w_status_height) { wp->w_redr_status = TRUE; - if (must_redraw < UPD_VALID) - must_redraw = UPD_VALID; + set_must_redraw(UPD_VALID); } } diff --git a/src/proto/drawscreen.pro b/src/proto/drawscreen.pro index c83501986b..0f5ff02d27 100644 --- a/src/proto/drawscreen.pro +++ b/src/proto/drawscreen.pro @@ -13,6 +13,7 @@ void redraw_later(int type); void redraw_win_later(win_T *wp, int type); void redraw_later_clear(void); void redraw_all_later(int type); +void set_must_redraw(int type); void redraw_curbuf_later(int type); void redraw_buf_later(buf_T *buf, int type); void redraw_buf_line_later(buf_T *buf, linenr_T lnum); diff --git a/src/screen.c b/src/screen.c index 01a690209c..abbfc2fe58 100644 --- a/src/screen.c +++ b/src/screen.c @@ -2906,7 +2906,7 @@ give_up: screen_Rows = Rows; screen_Columns = Columns; - must_redraw = UPD_CLEAR; // need to clear the screen later + set_must_redraw(UPD_CLEAR); // need to clear the screen later if (doclear) screenclear2(); #ifdef FEAT_GUI diff --git a/src/version.c b/src/version.c index e2882b67a3..ec381fef2d 100644 --- a/src/version.c +++ b/src/version.c @@ -732,6 +732,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 245, +/**/ 244, /**/ 243, |