mirror of
https://github.com/neovim/neovim.git
synced 2026-07-22 00:51:33 +00:00
Merge pull request #20374 from bfredl/notype
screen: refactor old curwin-heavy logic and graduate "msgsep" feature
This commit is contained in:
@@ -166,7 +166,7 @@ describe('fileio', function()
|
||||
[3] = {bold = true, foreground = Screen.colors.SeaGreen4}
|
||||
})
|
||||
screen:attach()
|
||||
command("set display-=msgsep shortmess-=F")
|
||||
command("set shortmess-=F")
|
||||
|
||||
command("e Xtest-overwrite-forced")
|
||||
screen:expect([[
|
||||
|
||||
@@ -172,83 +172,6 @@ describe('cmdline', function()
|
||||
|
|
||||
]])
|
||||
end)
|
||||
|
||||
-- oldtest: Test_redrawstatus_in_autocmd()
|
||||
it(':redrawstatus in cmdline mode', function()
|
||||
local screen = Screen.new(60, 8)
|
||||
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 * redrawstatus
|
||||
set display-=msgsep
|
||||
]])
|
||||
-- :redrawstatus is postponed if messages have scrolled
|
||||
feed([[:echo "one\ntwo\nthree\nfour"<CR>]])
|
||||
feed(':foobar')
|
||||
screen:expect([[
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{1: :echo "one\ntwo\nthree\nfour"}|
|
||||
one |
|
||||
two |
|
||||
three |
|
||||
four |
|
||||
:foobar^ |
|
||||
]])
|
||||
-- it is not postponed if messages have not scrolled
|
||||
feed('<Esc>:for in in range(3)')
|
||||
screen:expect([[
|
||||
|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{1: :for in in range(3)}|
|
||||
:for in in range(3)^ |
|
||||
]])
|
||||
-- with cmdheight=1 messages have scrolled when typing :endfor
|
||||
feed('<CR>:endfor')
|
||||
screen:expect([[
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{1: :for in in range(3)}|
|
||||
:for in in range(3) |
|
||||
: :endfor^ |
|
||||
]])
|
||||
feed('<CR>:set cmdheight=2<CR>')
|
||||
-- with cmdheight=2 messages haven't scrolled when typing :for or :endfor
|
||||
feed(':for in in range(3)')
|
||||
screen:expect([[
|
||||
|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{1: :for in in range(3)}|
|
||||
:for in in range(3)^ |
|
||||
|
|
||||
]])
|
||||
feed('<CR>:endfor')
|
||||
screen:expect([[
|
||||
|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{1: ::endfor}|
|
||||
:for in in range(3) |
|
||||
: :endfor^ |
|
||||
]])
|
||||
end)
|
||||
end)
|
||||
|
||||
describe('cmdwin', function()
|
||||
|
||||
@@ -822,7 +822,7 @@ describe('statusline is redrawn on entering cmdline', function()
|
||||
]]}
|
||||
end)
|
||||
|
||||
it('with scrolled messages and msgsep', function()
|
||||
it('with scrolled messages', function()
|
||||
screen:try_resize(35,14)
|
||||
exec([[
|
||||
let g:count = 0
|
||||
@@ -904,70 +904,6 @@ describe('statusline is redrawn on entering cmdline', function()
|
||||
]]}
|
||||
end)
|
||||
|
||||
it('but not with scrolled messages without msgsep', function()
|
||||
screen:try_resize(35,10)
|
||||
exec([[
|
||||
let g:count = 0
|
||||
autocmd CmdlineEnter * let g:count += 1
|
||||
set display-=msgsep
|
||||
set statusline=%{mode()}%{g:count}
|
||||
]])
|
||||
feed(':echoerr doesnotexist<cr>')
|
||||
screen:expect{grid=[[
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{3:c1 }|
|
||||
{4:E121: Undefined variable: doesnotex}|
|
||||
{4:ist} |
|
||||
{5:Press ENTER or type command to cont}|
|
||||
{5:inue}^ |
|
||||
]]}
|
||||
feed(':echoerr doesnotexist<cr>')
|
||||
screen:expect{grid=[[
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{3:c1 }|
|
||||
{4:E121: Undefined variable: doesnotex}|
|
||||
{4:ist} |
|
||||
{5:Press ENTER or type command to cont}|
|
||||
{4:E121: Undefined variable: doesnotex}|
|
||||
{4:ist} |
|
||||
{5:Press ENTER or type command to cont}|
|
||||
{5:inue}^ |
|
||||
]]}
|
||||
|
||||
feed(':echoerr doesnotexist<cr>')
|
||||
screen:expect{grid=[[
|
||||
{4:E121: Undefined variable: doesnotex}|
|
||||
{4:ist} |
|
||||
{5:Press ENTER or type command to cont}|
|
||||
{4:E121: Undefined variable: doesnotex}|
|
||||
{4:ist} |
|
||||
{5:Press ENTER or type command to cont}|
|
||||
{4:E121: Undefined variable: doesnotex}|
|
||||
{4:ist} |
|
||||
{5:Press ENTER or type command to cont}|
|
||||
{5:inue}^ |
|
||||
]]}
|
||||
|
||||
feed('<cr>')
|
||||
screen:expect{grid=[[
|
||||
^ |
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{3:n3 }|
|
||||
|
|
||||
]]}
|
||||
end)
|
||||
|
||||
describe('if custom statusline is set by', function()
|
||||
before_each(function()
|
||||
command('set statusline=')
|
||||
|
||||
@@ -82,20 +82,6 @@ local function test_embed(ext_linegrid)
|
||||
eq(Screen.colors.Green, screen.default_colors.rgb_bg)
|
||||
end}
|
||||
end)
|
||||
|
||||
it("set display-=msgsep before first redraw", function()
|
||||
startup('--cmd', 'set display-=msgsep')
|
||||
screen:expect{grid=[[
|
||||
^ |
|
||||
{3:~ }|
|
||||
{3:~ }|
|
||||
{3:~ }|
|
||||
{3:~ }|
|
||||
{3:~ }|
|
||||
{3:~ }|
|
||||
|
|
||||
]]}
|
||||
end)
|
||||
end
|
||||
|
||||
describe('--embed UI on startup (ext_linegrid=true)', function() test_embed(true) end)
|
||||
|
||||
@@ -1560,17 +1560,6 @@ describe("MsgSeparator highlight and msgsep fillchar", function()
|
||||
1 %a "[No Name]" line 1 |
|
||||
{3:Press ENTER or type command to continue}^ |
|
||||
]])
|
||||
|
||||
-- when display doesn't contain msgsep, these options have no effect
|
||||
feed_command("set display-=msgsep")
|
||||
feed_command("ls")
|
||||
screen:expect([[
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
:ls |
|
||||
1 %a "[No Name]" line 1 |
|
||||
{3:Press ENTER or type command to continue}^ |
|
||||
]])
|
||||
end)
|
||||
|
||||
it("and MsgArea", function()
|
||||
|
||||
@@ -1200,28 +1200,6 @@ vimComment xxx match /\s"[^\-:.%#=*].*$/ms=s+1,lc=1 excludenl contains=@vim
|
||||
it('prints lines in Ex mode correctly with a burst of carriage returns #19341', function()
|
||||
command('set number')
|
||||
meths.buf_set_lines(0, 0, 0, true, {'aaa', 'bbb', 'ccc'})
|
||||
command('set display-=msgsep')
|
||||
feed('gggQ<CR><CR>1<CR><CR>vi')
|
||||
screen:expect([[
|
||||
Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{11: 2 }bbb |
|
||||
{11: 3 }ccc |
|
||||
:1 |
|
||||
{11: 1 }aaa |
|
||||
{11: 2 }bbb |
|
||||
:vi^ |
|
||||
]])
|
||||
feed('<CR>')
|
||||
screen:expect([[
|
||||
{11: 1 }aaa |
|
||||
{11: 2 }^bbb |
|
||||
{11: 3 }ccc |
|
||||
{11: 4 } |
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
|
|
||||
]])
|
||||
command('set display+=msgsep')
|
||||
feed('gggQ<CR><CR>1<CR><CR>vi')
|
||||
screen:expect([[
|
||||
Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
|
||||
@@ -682,30 +682,7 @@ local function screen_tests(linegrid)
|
||||
]])
|
||||
end)
|
||||
|
||||
it('execute command with multi-line output without msgsep', function()
|
||||
command("set display-=msgsep")
|
||||
feed(':ls<cr>')
|
||||
screen:expect([[
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
:ls |
|
||||
1 %a "[No Name]" line 1 |
|
||||
{7:Press ENTER or type command to continue}^ |
|
||||
]])
|
||||
feed('<cr>') -- skip the "Press ENTER..." state or tests will hang
|
||||
end)
|
||||
|
||||
it('execute command with multi-line output and with msgsep', function()
|
||||
command("set display+=msgsep")
|
||||
it('execute command with multi-line output', function()
|
||||
feed(':ls<cr>')
|
||||
screen:expect([[
|
||||
|
|
||||
@@ -1050,39 +1027,3 @@ describe('Screen default colors', function()
|
||||
end}
|
||||
end)
|
||||
end)
|
||||
|
||||
|
||||
describe('screen with msgsep deactivated on startup', function()
|
||||
local screen
|
||||
|
||||
before_each(function()
|
||||
clear('--cmd', 'set display-=msgsep')
|
||||
screen = Screen.new()
|
||||
screen:attach()
|
||||
screen:set_default_attr_ids {
|
||||
[0] = {bold=true, foreground=255};
|
||||
[7] = {bold = true, foreground = Screen.colors.SeaGreen};
|
||||
}
|
||||
end)
|
||||
|
||||
it('execute command with multi-line output', function()
|
||||
feed ':ls<cr>'
|
||||
screen:expect([[
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
:ls |
|
||||
1 %a "[No Name]" line 1 |
|
||||
{7:Press ENTER or type command to continue}^ |
|
||||
]])
|
||||
feed '<cr>' -- skip the "Press ENTER..." state or tests will hang
|
||||
end)
|
||||
end)
|
||||
|
||||
@@ -184,11 +184,10 @@ describe("'wildmenu'", function()
|
||||
screen:expect_unchanged()
|
||||
end)
|
||||
|
||||
it('wildmode=list,full and display+=msgsep interaction #10092', function()
|
||||
it('wildmode=list,full and messages interaction #10092', function()
|
||||
-- Need more than 5 rows, else tabline is covered and will be redrawn.
|
||||
screen:try_resize(25, 7)
|
||||
|
||||
command('set display+=msgsep')
|
||||
command('set wildmenu wildmode=list,full')
|
||||
command('set showtabline=2')
|
||||
feed(':set wildm<tab>')
|
||||
@@ -223,44 +222,6 @@ describe("'wildmenu'", function()
|
||||
]])
|
||||
end)
|
||||
|
||||
it('wildmode=list,full and display-=msgsep interaction', function()
|
||||
-- Need more than 5 rows, else tabline is covered and will be redrawn.
|
||||
screen:try_resize(25, 7)
|
||||
|
||||
command('set display-=msgsep')
|
||||
command('set wildmenu wildmode=list,full')
|
||||
feed(':set wildm<tab>')
|
||||
screen:expect([[
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
:set wildm |
|
||||
wildmenu wildmode |
|
||||
:set wildm^ |
|
||||
]])
|
||||
feed('<tab>') -- trigger wildmode full
|
||||
screen:expect([[
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
:set wildm |
|
||||
wildmenu wildmode |
|
||||
wildmenu wildmode |
|
||||
:set wildmenu^ |
|
||||
]])
|
||||
feed('<Esc>')
|
||||
screen:expect([[
|
||||
^ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
|
|
||||
]])
|
||||
end)
|
||||
|
||||
it('wildmode=longest,list', function()
|
||||
-- Need more than 5 rows, else tabline is covered and will be redrawn.
|
||||
screen:try_resize(25, 7)
|
||||
@@ -365,7 +326,6 @@ describe("'wildmenu'", function()
|
||||
screen:try_resize(25, 7)
|
||||
|
||||
command('set laststatus=2')
|
||||
command('set display+=msgsep')
|
||||
feed(':set wildm')
|
||||
feed('<c-d>')
|
||||
screen:expect([[
|
||||
|
||||
Reference in New Issue
Block a user