diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-02-03 21:36:32 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-03 21:36:32 +0100 |
commit | 08155e2b53cdb0e2af72f347d9bb464ea0edab5e (patch) | |
tree | ce210f0330dd00f0f4ff19bcc7e2d7950a006b0f /src/nvim/buffer.c | |
parent | 01b4efe9d939d9eed93c55829d8c35ec22113328 (diff) | |
parent | 5a40abe2d599b67af3afa319cf89932824438a6f (diff) | |
download | rneovim-08155e2b53cdb0e2af72f347d9bb464ea0edab5e.tar.gz rneovim-08155e2b53cdb0e2af72f347d9bb464ea0edab5e.tar.bz2 rneovim-08155e2b53cdb0e2af72f347d9bb464ea0edab5e.zip |
Merge #9578 'vim-patch:8.0.{1045,1073,1077,1114}'
Diffstat (limited to 'src/nvim/buffer.c')
-rw-r--r-- | src/nvim/buffer.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index 7b90cbe4f4..802eba06a5 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -3224,6 +3224,9 @@ int build_stl_str_hl( #define TMPLEN 70 char_u tmp[TMPLEN]; char_u *usefmt = fmt; + const int save_must_redraw = must_redraw; + const int save_redr_type = curwin->w_redr_type; + const int save_highlight_shcnaged = need_highlight_changed; // When the format starts with "%!" then evaluate it as an expression and // use the result as the actual format string. @@ -3632,16 +3635,16 @@ int build_stl_str_hl( vim_snprintf((char *)tmp, sizeof(tmp), "%d", curbuf->b_fnum); set_internal_string_var((char_u *)"g:actual_curbuf", tmp); - buf_T *o_curbuf = curbuf; - win_T *o_curwin = curwin; + buf_T *const save_curbuf = curbuf; + win_T *const save_curwin = curwin; curwin = wp; curbuf = wp->w_buffer; // Note: The result stored in `t` is unused. str = eval_to_string_safe(out_p, &t, use_sandbox); - curwin = o_curwin; - curbuf = o_curbuf; + curwin = save_curwin; + curbuf = save_curbuf; // Remove the variable we just stored do_unlet(S_LEN("g:actual_curbuf"), true); @@ -4262,6 +4265,13 @@ int build_stl_str_hl( cur_tab_rec->def.func = NULL; } + // We do not want redrawing a stausline, ruler, title, etc. to trigger + // another redraw, it may cause an endless loop. This happens when a + // statusline changes a highlight group. + must_redraw = save_must_redraw; + curwin->w_redr_type = save_redr_type; + need_highlight_changed = save_highlight_shcnaged; + return width; } |