diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/ex_getln.c | 6 | ||||
-rw-r--r-- | src/nvim/testdir/test_statusline.vim | 21 |
2 files changed, 24 insertions, 3 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 9977be56ca..76df01c205 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -775,9 +775,9 @@ static uint8_t *command_line_enter(int firstc, long count, int indent) redrawcmd(); } - // redraw the statusline for statuslines that display the current mode - // using the mode() function. - if (!cmd_silent && msg_scrolled == 0) { + // 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(); } diff --git a/src/nvim/testdir/test_statusline.vim b/src/nvim/testdir/test_statusline.vim index ce2ef4dcd8..48b7b4f2f1 100644 --- a/src/nvim/testdir/test_statusline.vim +++ b/src/nvim/testdir/test_statusline.vim @@ -440,6 +440,27 @@ func Test_statusline_removed_group() call delete('XTest_statusline') endfunc +func Test_statusline_using_mode() + CheckScreendump + + let lines =<< trim END + set laststatus=2 + let &statusline = '-%{mode()}-' + END + call writefile(lines, 'XTest_statusline') + + let buf = RunVimInTerminal('-S XTest_statusline', {'rows': 5, '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, "\<CR>") + call StopVimInTerminal(buf) + call delete('XTest_statusline') +endfunc + func Test_statusline_after_split_vsplit() only |