From 82ac44d01f0e92546f43c804595c14a139af77bd Mon Sep 17 00:00:00 2001 From: bphilly96 <65504429+bphilly96@users.noreply.github.com> Date: Fri, 9 Apr 2021 04:14:08 +0100 Subject: vim-patch:8.2.2737: status line not updated when local 'statusline' option set (#14325) Problem: Status line not updated when local 'statusline' option set. Solution: Check the 'statusline' option of each window. https://github.com/vim/vim/commit/d8db8383926cb8729417d9515cbfaf455dbbd8d1 --- src/nvim/ex_getln.c | 15 ++++++++++++--- src/nvim/testdir/test_statusline.vim | 9 +++++---- 2 files changed, 17 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index e6b2b231f9..7159b27665 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -784,9 +784,18 @@ static uint8_t *command_line_enter(int firstc, long count, int indent) // Redraw the statusline in case it uses the current mode using the mode() // function. - if (!cmd_silent && msg_scrolled == 0 && *p_stl != NUL) { - curwin->w_redr_status = true; - redraw_statuslines(); + if (!cmd_silent && msg_scrolled == 0) { + bool found_one = false; + + FOR_ALL_WINDOWS_IN_TAB(wp, curtab) { + if (*p_stl != NUL || *wp->w_p_stl != NUL) { + wp->w_redr_status = true; + found_one = true; + } + } + if (found_one) { + redraw_statuslines(); + } } did_emsg = false; diff --git a/src/nvim/testdir/test_statusline.vim b/src/nvim/testdir/test_statusline.vim index 48b7b4f2f1..f5b6446108 100644 --- a/src/nvim/testdir/test_statusline.vim +++ b/src/nvim/testdir/test_statusline.vim @@ -444,19 +444,20 @@ func Test_statusline_using_mode() CheckScreendump let lines =<< trim END - set laststatus=2 - let &statusline = '-%{mode()}-' + setlocal statusline=-%{mode()}- + split + setlocal statusline=+%{mode()}+ END call writefile(lines, 'XTest_statusline') - let buf = RunVimInTerminal('-S XTest_statusline', {'rows': 5, 'cols': 50}) + let buf = RunVimInTerminal('-S XTest_statusline', {'rows': 7, 'cols': 50}) call VerifyScreenDump(buf, 'Test_statusline_mode_1', {}) call term_sendkeys(buf, ":") call VerifyScreenDump(buf, 'Test_statusline_mode_2', {}) " clean up - call term_sendkeys(buf, "\") + call term_sendkeys(buf, "close\") call StopVimInTerminal(buf) call delete('XTest_statusline') endfunc -- cgit