diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-09-21 06:47:29 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-21 06:47:29 +0800 |
commit | ad1f353fe1aeb54144a34d1a0de8e318bd5113aa (patch) | |
tree | e8e99077e564c2ef87198b6ac9d0615567f35240 /src/nvim | |
parent | 585ab2564ada61c03443ed8f5709d2e5c8e0812a (diff) | |
download | rneovim-ad1f353fe1aeb54144a34d1a0de8e318bd5113aa.tar.gz rneovim-ad1f353fe1aeb54144a34d1a0de8e318bd5113aa.tar.bz2 rneovim-ad1f353fe1aeb54144a34d1a0de8e318bd5113aa.zip |
vim-patch:9.0.0517: when at the command line :redrawstatus does not work well (#20266)
Problem: When at the command line :redrawstatus does not work well.
Solution: Only update the statuslines instead of the screen. (closes vim/vim#11180)
https://github.com/vim/vim/commit/320d910064320f894a09ffdd1cd800ff5371e97f
Diffstat (limited to 'src/nvim')
-rw-r--r-- | src/nvim/ex_docmd.c | 8 | ||||
-rw-r--r-- | src/nvim/testdir/test_cmdline.vim | 13 |
2 files changed, 17 insertions, 4 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 534cc6dcfb..b01a262f84 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -6094,13 +6094,17 @@ static void ex_redrawstatus(exarg_T *eap) } else { status_redraw_curbuf(); } - if (msg_scrolled) { + if (msg_scrolled && (State & MODE_CMDLINE)) { return; // redraw later } RedrawingDisabled = 0; p_lz = false; - update_screen(VIsual_active ? UPD_INVERTED : 0); + if (State & MODE_CMDLINE) { + redraw_statuslines(); + } else { + update_screen(VIsual_active ? UPD_INVERTED : 0); + } RedrawingDisabled = r; p_lz = p; ui_flush(); diff --git a/src/nvim/testdir/test_cmdline.vim b/src/nvim/testdir/test_cmdline.vim index 9fc92b8f25..60f6930c35 100644 --- a/src/nvim/testdir/test_cmdline.vim +++ b/src/nvim/testdir/test_cmdline.vim @@ -154,7 +154,7 @@ func Test_redrawstatus_in_autocmd() let lines =<< trim END set laststatus=2 set statusline=%=:%{getcmdline()} - autocmd CmdlineChanged * if getcmdline() == 'foobar' | redrawstatus | endif + autocmd CmdlineChanged * redrawstatus END call writefile(lines, 'XTest_redrawstatus', 'D') @@ -164,8 +164,17 @@ func Test_redrawstatus_in_autocmd() call term_sendkeys(buf, ":foobar") call VerifyScreenDump(buf, 'Test_redrawstatus_in_autocmd_1', {}) " it is not postponed if messages have not scrolled - call term_sendkeys(buf, "\<Esc>:foobar") + call term_sendkeys(buf, "\<Esc>:for in in range(3)") call VerifyScreenDump(buf, 'Test_redrawstatus_in_autocmd_2', {}) + " with cmdheight=1 messages have scrolled when typing :endfor + call term_sendkeys(buf, "\<CR>:endfor") + call VerifyScreenDump(buf, 'Test_redrawstatus_in_autocmd_3', {}) + call term_sendkeys(buf, "\<CR>:set cmdheight=2\<CR>") + " with cmdheight=2 messages haven't scrolled when typing :for or :endfor + call term_sendkeys(buf, ":for in in range(3)") + call VerifyScreenDump(buf, 'Test_redrawstatus_in_autocmd_4', {}) + call term_sendkeys(buf, "\<CR>:endfor") + call VerifyScreenDump(buf, 'Test_redrawstatus_in_autocmd_5', {}) " clean up call term_sendkeys(buf, "\<CR>") |