Skip to content

Commit 82ac44d

Browse files
authored
vim-patch:8.2.2737: status line not updated when local 'statusline' option set (neovim#14325)
Problem: Status line not updated when local 'statusline' option set. Solution: Check the 'statusline' option of each window. vim/vim@d8db838
1 parent ed3c0a2 commit 82ac44d

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

src/nvim/ex_getln.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -784,9 +784,18 @@ static uint8_t *command_line_enter(int firstc, long count, int indent)
784784

785785
// Redraw the statusline in case it uses the current mode using the mode()
786786
// function.
787-
if (!cmd_silent && msg_scrolled == 0 && *p_stl != NUL) {
788-
curwin->w_redr_status = true;
789-
redraw_statuslines();
787+
if (!cmd_silent && msg_scrolled == 0) {
788+
bool found_one = false;
789+
790+
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
791+
if (*p_stl != NUL || *wp->w_p_stl != NUL) {
792+
wp->w_redr_status = true;
793+
found_one = true;
794+
}
795+
}
796+
if (found_one) {
797+
redraw_statuslines();
798+
}
790799
}
791800

792801
did_emsg = false;

src/nvim/testdir/test_statusline.vim

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -444,19 +444,20 @@ func Test_statusline_using_mode()
444444
CheckScreendump
445445

446446
let lines =<< trim END
447-
set laststatus=2
448-
let &statusline = '-%{mode()}-'
447+
setlocal statusline=-%{mode()}-
448+
split
449+
setlocal statusline=+%{mode()}+
449450
END
450451
call writefile(lines, 'XTest_statusline')
451452

452-
let buf = RunVimInTerminal('-S XTest_statusline', {'rows': 5, 'cols': 50})
453+
let buf = RunVimInTerminal('-S XTest_statusline', {'rows': 7, 'cols': 50})
453454
call VerifyScreenDump(buf, 'Test_statusline_mode_1', {})
454455

455456
call term_sendkeys(buf, ":")
456457
call VerifyScreenDump(buf, 'Test_statusline_mode_2', {})
457458

458459
" clean up
459-
call term_sendkeys(buf, "\<CR>")
460+
call term_sendkeys(buf, "close\<CR>")
460461
call StopVimInTerminal(buf)
461462
call delete('XTest_statusline')
462463
endfunc

0 commit comments

Comments
 (0)