mirror of
https://github.com/neovim/neovim.git
synced 2026-04-22 15:25:30 +00:00
fix(ui2): multiline/color replaced message, expanded cmdline, error messages #38044
Problem: - Unintentionally inserting lines for a replaced multiline
message that also has multiple highlights.
- Scheduled check to see if the expanded cmdline window was
entered makes it difficult to keep track of what happens when
the key pressed to dismiss it results in a message.
- Reading the first line of an error message should be enough
notice for something going wrong.
- "search_cmd" messages should not be shown with 0 'cmdheight'.
- Unable to configure dynamically changed pager height.
- Enabling UI2 doesn't make sense with no UIs attached.
Solution: - Only insert a line for the first chunk after a newline.
- Use getmousepos() to check if the expanded cmdline was
clicked to enter the pager.
entering the pager to serve as a configuration interface.
- Don't expand the cmdline for error messages; user can press g<.
- Don't show "search_cmd" messages with 'cmdheight' set to 0.
- Change 'eventignorewin' to ensure WinEnter is fired when
- Have enable() return early when no UIs are attached.
This commit is contained in:
@@ -244,9 +244,9 @@ describe('cmdline2', function()
|
||||
feed('call confirm("Ok?")<CR>')
|
||||
screen:try_resize(screen._width + 1, screen._height)
|
||||
screen:expect([[
|
||||
|
|
||||
{1:~ }|*10
|
||||
|*10
|
||||
{3: }|
|
||||
|
|
||||
{6:Ok?} |
|
||||
{6:[O]k: }^ |
|
||||
]])
|
||||
@@ -254,9 +254,9 @@ describe('cmdline2', function()
|
||||
feed('k')
|
||||
screen:try_resize(screen._width, screen._height + 1)
|
||||
screen:expect([[
|
||||
|
|
||||
{1:~ }|*11
|
||||
|*11
|
||||
{3: }|
|
||||
|
|
||||
{6:Ok?} |
|
||||
{6:[O]k: }^ |
|
||||
]])
|
||||
|
||||
@@ -142,6 +142,31 @@ describe('messages2', function()
|
||||
{1:~ }|*11
|
||||
foo [+1] 1,1 All|
|
||||
]])
|
||||
-- Changing 'laststatus' reveals the global statusline with a pager height
|
||||
-- exceeding the available lines: #38008.
|
||||
command('tabonly | call nvim_echo([["foo\n"]]->repeat(&lines), 1, {})')
|
||||
screen:expect([[
|
||||
^x |
|
||||
{1:~ }|*5
|
||||
{3: }|
|
||||
foo |*6
|
||||
foo [+8] |
|
||||
]])
|
||||
feed('<CR>')
|
||||
screen:expect([[
|
||||
{3: }|
|
||||
^foo |
|
||||
foo |*11
|
||||
1,1 Top|
|
||||
]])
|
||||
command('set laststatus=3')
|
||||
screen:expect([[
|
||||
{3: }|
|
||||
^foo |
|
||||
foo |*10
|
||||
{3:[Pager] 1,1 Top}|
|
||||
|
|
||||
]])
|
||||
end)
|
||||
|
||||
it('new buffer, window and options after closing a buffer', function()
|
||||
@@ -290,7 +315,7 @@ describe('messages2', function()
|
||||
screen:expect([[
|
||||
^ |
|
||||
{1:~ }|*12
|
||||
foo [+1] |
|
||||
|
|
||||
]])
|
||||
end)
|
||||
|
||||
@@ -442,7 +467,7 @@ describe('messages2', function()
|
||||
^foofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofo|
|
||||
|
|
||||
]])
|
||||
t.eq({ filetype = 5 }, n.eval('g:set')) -- still fires for 'filetype'
|
||||
t.eq(5, n.eval('g:set').filetype) -- still fires for 'filetype'
|
||||
end)
|
||||
|
||||
it('Search highlights only apply to pager', function()
|
||||
@@ -598,6 +623,9 @@ describe('messages2', function()
|
||||
vim.api.nvim_echo({ { 'foo' } }, true, { id = 1 })
|
||||
vim.api.nvim_echo({ { 'bar\nbaz' } }, true, { id = 2 })
|
||||
vim.api.nvim_echo({ { 'foo' } }, true, { id = 3 })
|
||||
vim.keymap.set('n', 'Q', function()
|
||||
vim.api.nvim_echo({ { 'Syntax', 23 }, { '\n - ', 0 }, { 'cCommentL', 439 } }, false, {})
|
||||
end)
|
||||
end)
|
||||
screen:expect([[
|
||||
^ |
|
||||
@@ -628,6 +656,19 @@ describe('messages2', function()
|
||||
baz |
|
||||
foo |*2
|
||||
]])
|
||||
-- Pressing a key immediately dismisses an expanded cmdline, and
|
||||
-- replacing a multiline, multicolored message doesn't error due
|
||||
-- to unneccesarily inserted lines #37994.
|
||||
feed('Q')
|
||||
screen:expect([[
|
||||
^ |
|
||||
{1:~ }|*10
|
||||
{3: }|
|
||||
{100:Syntax} |
|
||||
- cCommentL |
|
||||
]])
|
||||
feed('Q')
|
||||
screen:expect_unchanged()
|
||||
set_msg_target_zero_ch()
|
||||
exec_lua(function()
|
||||
vim.api.nvim_echo({ { 'foo' } }, true, { id = 1 })
|
||||
@@ -718,4 +759,13 @@ describe('messages2', function()
|
||||
{6:[O]k: }^ |
|
||||
]])
|
||||
end)
|
||||
|
||||
it('no search_cmd with cmdheight=0', function()
|
||||
set_msg_target_zero_ch()
|
||||
feed('ifoo<Esc>?foo<CR>')
|
||||
screen:expect([[
|
||||
{10:^foo} |
|
||||
{1:~ }|*13
|
||||
]])
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user