mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge pull request #20262 from zeertzjq/vim-9.0.0507
vim-patch:9.0.{0507,0512}: cmdline cleared when using :redrawstatus
This commit is contained in:
commit
86c5d761c4
@ -6089,13 +6089,17 @@ static void ex_redrawstatus(exarg_T *eap)
|
|||||||
int r = RedrawingDisabled;
|
int r = RedrawingDisabled;
|
||||||
int p = p_lz;
|
int p = p_lz;
|
||||||
|
|
||||||
RedrawingDisabled = 0;
|
|
||||||
p_lz = false;
|
|
||||||
if (eap->forceit) {
|
if (eap->forceit) {
|
||||||
status_redraw_all();
|
status_redraw_all();
|
||||||
} else {
|
} else {
|
||||||
status_redraw_curbuf();
|
status_redraw_curbuf();
|
||||||
}
|
}
|
||||||
|
if (msg_scrolled) {
|
||||||
|
return; // redraw later
|
||||||
|
}
|
||||||
|
|
||||||
|
RedrawingDisabled = 0;
|
||||||
|
p_lz = false;
|
||||||
update_screen(VIsual_active ? UPD_INVERTED : 0);
|
update_screen(VIsual_active ? UPD_INVERTED : 0);
|
||||||
RedrawingDisabled = r;
|
RedrawingDisabled = r;
|
||||||
p_lz = p;
|
p_lz = p;
|
||||||
|
@ -127,6 +127,51 @@ func Test_wildmenu_screendump()
|
|||||||
call delete('XTest_wildmenu')
|
call delete('XTest_wildmenu')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_redraw_in_autocmd()
|
||||||
|
CheckScreendump
|
||||||
|
|
||||||
|
let lines =<< trim END
|
||||||
|
set cmdheight=2
|
||||||
|
autocmd CmdlineChanged * redraw
|
||||||
|
END
|
||||||
|
call writefile(lines, 'XTest_redraw', 'D')
|
||||||
|
|
||||||
|
let buf = RunVimInTerminal('-S XTest_redraw', {'rows': 8})
|
||||||
|
call term_sendkeys(buf, ":for i in range(3)\<CR>")
|
||||||
|
call VerifyScreenDump(buf, 'Test_redraw_in_autocmd_1', {})
|
||||||
|
|
||||||
|
call term_sendkeys(buf, "let i =")
|
||||||
|
call VerifyScreenDump(buf, 'Test_redraw_in_autocmd_2', {})
|
||||||
|
|
||||||
|
" clean up
|
||||||
|
call term_sendkeys(buf, "\<CR>")
|
||||||
|
call StopVimInTerminal(buf)
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func Test_redrawstatus_in_autocmd()
|
||||||
|
CheckScreendump
|
||||||
|
|
||||||
|
let lines =<< trim END
|
||||||
|
set laststatus=2
|
||||||
|
set statusline=%=:%{getcmdline()}
|
||||||
|
autocmd CmdlineChanged * if getcmdline() == 'foobar' | redrawstatus | endif
|
||||||
|
END
|
||||||
|
call writefile(lines, 'XTest_redrawstatus', 'D')
|
||||||
|
|
||||||
|
let buf = RunVimInTerminal('-S XTest_redrawstatus', {'rows': 8})
|
||||||
|
" :redrawstatus is postponed if messages have scrolled
|
||||||
|
call term_sendkeys(buf, ":echo \"one\\ntwo\\nthree\\nfour\"\<CR>")
|
||||||
|
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 VerifyScreenDump(buf, 'Test_redrawstatus_in_autocmd_2', {})
|
||||||
|
|
||||||
|
" clean up
|
||||||
|
call term_sendkeys(buf, "\<CR>")
|
||||||
|
call StopVimInTerminal(buf)
|
||||||
|
endfunc
|
||||||
|
|
||||||
func Test_changing_cmdheight()
|
func Test_changing_cmdheight()
|
||||||
CheckScreendump
|
CheckScreendump
|
||||||
|
|
||||||
|
@ -140,6 +140,74 @@ describe('cmdline', function()
|
|||||||
:^ |
|
:^ |
|
||||||
]])
|
]])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
-- oldtest: Test_redraw_in_autocmd()
|
||||||
|
it('cmdline cursor position is correct after :redraw with cmdheight=2', function()
|
||||||
|
local screen = Screen.new(30, 6)
|
||||||
|
screen:set_default_attr_ids({
|
||||||
|
[0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
|
||||||
|
})
|
||||||
|
screen:attach()
|
||||||
|
exec([[
|
||||||
|
set cmdheight=2
|
||||||
|
autocmd CmdlineChanged * redraw
|
||||||
|
]])
|
||||||
|
feed(':for i in range(3)<CR>')
|
||||||
|
screen:expect([[
|
||||||
|
|
|
||||||
|
{0:~ }|
|
||||||
|
{0:~ }|
|
||||||
|
{0:~ }|
|
||||||
|
:for i in range(3) |
|
||||||
|
: ^ |
|
||||||
|
]])
|
||||||
|
feed(':let i =')
|
||||||
|
-- Note: this may still be considered broken, ref #18140
|
||||||
|
screen:expect([[
|
||||||
|
|
|
||||||
|
{0:~ }|
|
||||||
|
{0:~ }|
|
||||||
|
{0:~ }|
|
||||||
|
: :let i =^ |
|
||||||
|
|
|
||||||
|
]])
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- oldtest: Test_redrawstatus_in_autocmd()
|
||||||
|
it(':redrawstatus in cmdline mode', function()
|
||||||
|
local screen = Screen.new(60, 6)
|
||||||
|
screen:set_default_attr_ids({
|
||||||
|
[0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
|
||||||
|
[1] = {bold = true, reverse = true}, -- MsgSeparator, StatusLine
|
||||||
|
})
|
||||||
|
screen:attach()
|
||||||
|
exec([[
|
||||||
|
set laststatus=2
|
||||||
|
set statusline=%=:%{getcmdline()}
|
||||||
|
autocmd CmdlineChanged * if getcmdline() == 'foobar' | redrawstatus | endif
|
||||||
|
]])
|
||||||
|
-- :redrawstatus is postponed if messages have scrolled
|
||||||
|
feed([[:echo "one\ntwo\nthree\nfour"<CR>]])
|
||||||
|
feed(':foobar')
|
||||||
|
screen:expect([[
|
||||||
|
{1: }|
|
||||||
|
one |
|
||||||
|
two |
|
||||||
|
three |
|
||||||
|
four |
|
||||||
|
:foobar^ |
|
||||||
|
]])
|
||||||
|
-- it is not postponed if messages have not scrolled
|
||||||
|
feed('<Esc>:foobar')
|
||||||
|
screen:expect([[
|
||||||
|
|
|
||||||
|
{0:~ }|
|
||||||
|
{0:~ }|
|
||||||
|
{0:~ }|
|
||||||
|
{1: :foobar}|
|
||||||
|
:foobar^ |
|
||||||
|
]])
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe('cmdwin', function()
|
describe('cmdwin', function()
|
||||||
|
Loading…
Reference in New Issue
Block a user