aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui
diff options
context:
space:
mode:
authorb-r-o-c-k <brockmammen@gmail.com>2018-04-14 14:17:51 -0500
committerb-r-o-c-k <brockmammen@gmail.com>2018-04-14 14:17:51 -0500
commitad999eaa775d7d4b0cacedb30c6ea3a0ee699a6f (patch)
tree92de2079e80f5f289dd87a54af123cb7d90c3058 /test/functional/ui
parent78bc52ea5397c092d01cd08296fe1dc85d998329 (diff)
parentef4feab0e75be19c5f41d70a001db980b72090f5 (diff)
downloadrneovim-ad999eaa775d7d4b0cacedb30c6ea3a0ee699a6f.tar.gz
rneovim-ad999eaa775d7d4b0cacedb30c6ea3a0ee699a6f.tar.bz2
rneovim-ad999eaa775d7d4b0cacedb30c6ea3a0ee699a6f.zip
Merge branch 'master' into s-dash-stdin
Diffstat (limited to 'test/functional/ui')
-rw-r--r--test/functional/ui/bufhl_spec.lua17
-rw-r--r--test/functional/ui/cmdline_highlight_spec.lua128
-rw-r--r--test/functional/ui/cmdline_spec.lua408
-rw-r--r--test/functional/ui/cursor_spec.lua4
-rw-r--r--test/functional/ui/highlight_spec.lua196
-rw-r--r--test/functional/ui/inccommand_spec.lua99
-rw-r--r--test/functional/ui/input_spec.lua102
-rw-r--r--test/functional/ui/mouse_spec.lua492
-rw-r--r--test/functional/ui/options_spec.lua110
-rw-r--r--test/functional/ui/output_spec.lua183
-rw-r--r--test/functional/ui/screen.lua12
-rw-r--r--test/functional/ui/screen_basic_spec.lua192
-rw-r--r--test/functional/ui/searchhl_spec.lua131
-rw-r--r--test/functional/ui/sign_spec.lua2
-rw-r--r--test/functional/ui/spell_spec.lua49
-rw-r--r--test/functional/ui/syntax_conceal_spec.lua2
-rw-r--r--test/functional/ui/wildmode_spec.lua3
17 files changed, 1617 insertions, 513 deletions
diff --git a/test/functional/ui/bufhl_spec.lua b/test/functional/ui/bufhl_spec.lua
index 2143c01139..5b38921e50 100644
--- a/test/functional/ui/bufhl_spec.lua
+++ b/test/functional/ui/bufhl_spec.lua
@@ -2,13 +2,11 @@ local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
-local command, request, neq = helpers.command, helpers.request, helpers.neq
-
-if helpers.pending_win32(pending) then return end
+local command, neq = helpers.command, helpers.neq
+local curbufmeths = helpers.curbufmeths
describe('Buffer highlighting', function()
local screen
- local curbuf
before_each(function()
clear()
@@ -27,21 +25,14 @@ describe('Buffer highlighting', function()
[9] = {foreground = Screen.colors.SlateBlue, underline = true},
[10] = {foreground = Screen.colors.Red}
})
- curbuf = request('nvim_get_current_buf')
end)
after_each(function()
screen:detach()
end)
- local function add_hl(...)
- return request('nvim_buf_add_highlight', curbuf, ...)
- end
-
- local function clear_hl(...)
- return request('nvim_buf_clear_highlight', curbuf, ...)
- end
-
+ local add_hl = curbufmeths.add_highlight
+ local clear_hl = curbufmeths.clear_highlight
it('works', function()
insert([[
diff --git a/test/functional/ui/cmdline_highlight_spec.lua b/test/functional/ui/cmdline_highlight_spec.lua
index d87ce72599..3c316d1cfa 100644
--- a/test/functional/ui/cmdline_highlight_spec.lua
+++ b/test/functional/ui/cmdline_highlight_spec.lua
@@ -24,6 +24,7 @@ before_each(function()
clear()
screen = Screen.new(40, 8)
screen:attach()
+ command("set display-=msgsep")
source([[
highlight RBP1 guibg=Red
highlight RBP2 guibg=Yellow
@@ -144,7 +145,13 @@ before_each(function()
EOB={bold = true, foreground = Screen.colors.Blue1},
ERR={foreground = Screen.colors.Grey100, background = Screen.colors.Red},
SK={foreground = Screen.colors.Blue},
- PE={bold = true, foreground = Screen.colors.SeaGreen4}
+ PE={bold = true, foreground = Screen.colors.SeaGreen4},
+ NUM={foreground = Screen.colors.Blue2},
+ NPAR={foreground = Screen.colors.Yellow},
+ SQ={foreground = Screen.colors.Blue3},
+ SB={foreground = Screen.colors.Blue4},
+ E={foreground = Screen.colors.Red, background = Screen.colors.Blue},
+ M={bold = true},
})
end)
@@ -731,6 +738,22 @@ describe('Command-line coloring', function()
feed('<CR><CR>')
eq('', meths.get_var('out'))
end)
+ it('does not crash when callback has caught not-a-editor-command exception',
+ function()
+ source([[
+ function CaughtExc(cmdline) abort
+ try
+ gibberish
+ catch
+ " Do nothing
+ endtry
+ return []
+ endfunction
+ ]])
+ set_color_cb('CaughtExc')
+ start_prompt('1')
+ eq(1, meths.eval('1'))
+ end)
end)
describe('Ex commands coloring support', function()
it('works', function()
@@ -843,7 +866,7 @@ describe('Ex commands coloring support', function()
{EOB:~ }|
|
]])
- eq('\nError detected while processing :\nE605: Exception not caught: 42',
+ eq('Error detected while processing :\nE605: Exception not caught: 42',
meths.command_output('messages'))
end)
it('errors out when failing to get callback', function()
@@ -863,7 +886,10 @@ describe('Ex commands coloring support', function()
end)
describe('Expressions coloring support', function()
it('works', function()
- meths.set_var('Nvim_color_expr', 'RainBowParens')
+ meths.command('hi clear NvimNumber')
+ meths.command('hi clear NvimNestingParenthesis')
+ meths.command('hi NvimNumber guifg=Blue2')
+ meths.command('hi NvimNestingParenthesis guifg=Yellow')
feed(':echo <C-r>=(((1)))')
screen:expect([[
|
@@ -873,21 +899,103 @@ describe('Expressions coloring support', function()
{EOB:~ }|
{EOB:~ }|
{EOB:~ }|
- ={RBP1:(}{RBP2:(}{RBP3:(}1{RBP3:)}{RBP2:)}{RBP1:)}^ |
+ ={NPAR:(((}{NUM:1}{NPAR:)))}^ |
]])
end)
- it('errors out when failing to get callback', function()
+ it('does not use Nvim_color_expr', function()
meths.set_var('Nvim_color_expr', 42)
+ -- Used to error out due to failing to get callback.
+ meths.command('hi clear NvimNumber')
+ meths.command('hi NvimNumber guifg=Blue2')
feed(':<C-r>=1')
screen:expect([[
+ |
+ {EOB:~ }|
+ {EOB:~ }|
+ {EOB:~ }|
+ {EOB:~ }|
+ {EOB:~ }|
+ {EOB:~ }|
+ ={NUM:1}^ |
+ ]])
+ end)
+ it('works correctly with non-ASCII and control characters', function()
+ meths.command('hi clear NvimStringBody')
+ meths.command('hi clear NvimStringQuote')
+ meths.command('hi clear NvimInvalid')
+ meths.command('hi NvimStringQuote guifg=Blue3')
+ meths.command('hi NvimStringBody guifg=Blue4')
+ meths.command('hi NvimInvalid guifg=Red guibg=Blue')
+ feed('i<C-r>="«»"«»')
+ screen:expect([[
+ |
+ {EOB:~ }|
+ {EOB:~ }|
+ {EOB:~ }|
+ {EOB:~ }|
+ {EOB:~ }|
+ {EOB:~ }|
+ ={SQ:"}{SB:«»}{SQ:"}{E:«»}^ |
+ ]])
+ feed('<C-c>')
+ screen:expect([[
+ ^ |
+ {EOB:~ }|
+ {EOB:~ }|
+ {EOB:~ }|
+ {EOB:~ }|
+ {EOB:~ }|
+ {EOB:~ }|
+ {M:-- INSERT --} |
+ ]])
+ feed('<Esc>')
+ screen:expect([[
+ ^ |
+ {EOB:~ }|
+ {EOB:~ }|
+ {EOB:~ }|
+ {EOB:~ }|
+ {EOB:~ }|
+ {EOB:~ }|
+ |
+ ]])
+ feed(':<C-\\>e"<C-v><C-x>"<C-v><C-x>')
+ -- TODO(ZyX-I): Parser highlighting should not override special character
+ -- highlighting.
+ screen:expect([[
+ |
+ {EOB:~ }|
+ {EOB:~ }|
+ {EOB:~ }|
+ {EOB:~ }|
+ {EOB:~ }|
+ {EOB:~ }|
+ ={SQ:"}{SB:^X}{SQ:"}{ERR:^X}^ |
+ ]])
+ feed('<C-c>')
+ screen:expect([[
+ |
+ {EOB:~ }|
+ {EOB:~ }|
+ {EOB:~ }|
+ {EOB:~ }|
+ {EOB:~ }|
+ {EOB:~ }|
+ :^ |
+ ]])
+ funcs.setreg('a', {'\192'})
+ feed('<C-r>="<C-r><C-r>a"<C-r><C-r>a"foo"')
+ -- TODO(ZyX-I): Parser highlighting should not override special character
+ -- highlighting.
+ screen:expect([[
+ |
+ {EOB:~ }|
+ {EOB:~ }|
+ {EOB:~ }|
{EOB:~ }|
{EOB:~ }|
{EOB:~ }|
- = |
- {ERR:E5409: Unable to get g:Nvim_color_expr c}|
- {ERR:allback: Vim:E6000: Argument is not a fu}|
- {ERR:nction or function name} |
- =1^ |
+ ={SQ:"}{SB:<c0>}{SQ:"}{E:<c0>"}{SB:foo}{E:"}^ |
]])
end)
end)
diff --git a/test/functional/ui/cmdline_spec.lua b/test/functional/ui/cmdline_spec.lua
index 0f8302b036..f8680678ef 100644
--- a/test/functional/ui/cmdline_spec.lua
+++ b/test/functional/ui/cmdline_spec.lua
@@ -10,12 +10,19 @@ describe('external cmdline', function()
local last_level = 0
local cmdline = {}
local block = nil
+ local wild_items = nil
+ local wild_selected = nil
before_each(function()
clear()
cmdline, block = {}, nil
screen = Screen.new(25, 5)
screen:attach({rgb=true, ext_cmdline=true})
+ screen:set_default_attr_ids({
+ [1] = {bold = true, foreground = Screen.colors.Blue1},
+ [2] = {reverse = true},
+ [3] = {bold = true, reverse = true},
+ })
screen:set_on_event_handler(function(name, data)
if name == "cmdline_show" then
local content, pos, firstc, prompt, indent, level = unpack(data)
@@ -38,6 +45,12 @@ describe('external cmdline', function()
block[#block+1] = data[1]
elseif name == "cmdline_block_hide" then
block = nil
+ elseif name == "wildmenu_show" then
+ wild_items = data[1]
+ elseif name == "wildmenu_select" then
+ wild_selected = data[1]
+ elseif name == "wildmenu_hide" then
+ wild_items, wild_selected = nil, nil
end
end)
end)
@@ -66,9 +79,9 @@ describe('external cmdline', function()
feed(':')
screen:expect([[
^ |
- ~ |
- ~ |
- ~ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
|
]], nil, nil, function()
eq(1, last_level)
@@ -84,9 +97,9 @@ describe('external cmdline', function()
feed('sign')
screen:expect([[
^ |
- ~ |
- ~ |
- ~ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
|
]], nil, nil, function()
eq({{
@@ -101,9 +114,9 @@ describe('external cmdline', function()
feed('<Left>')
screen:expect([[
^ |
- ~ |
- ~ |
- ~ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
|
]], nil, nil, function()
eq({{
@@ -118,9 +131,9 @@ describe('external cmdline', function()
feed('<bs>')
screen:expect([[
^ |
- ~ |
- ~ |
- ~ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
|
]], nil, nil, function()
eq({{
@@ -135,9 +148,9 @@ describe('external cmdline', function()
feed('<Esc>')
screen:expect([[
^ |
- ~ |
- ~ |
- ~ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
|
]], nil, nil, function()
eq({}, cmdline)
@@ -148,9 +161,9 @@ describe('external cmdline', function()
feed(':call input("input", "default")<cr>')
screen:expect([[
^ |
- ~ |
- ~ |
- ~ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
|
]], nil, nil, function()
eq({{
@@ -164,9 +177,9 @@ describe('external cmdline', function()
feed('<cr>')
screen:expect([[
^ |
- ~ |
- ~ |
- ~ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
|
]], nil, nil, function()
eq({}, cmdline)
@@ -178,9 +191,9 @@ describe('external cmdline', function()
feed(':xx<c-r>')
screen:expect([[
^ |
- ~ |
- ~ |
- ~ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
|
]], nil, nil, function()
eq({{
@@ -196,9 +209,9 @@ describe('external cmdline', function()
feed('=')
screen:expect([[
^ |
- ~ |
- ~ |
- ~ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
|
]], nil, nil, function()
eq({{
@@ -226,7 +239,11 @@ describe('external cmdline', function()
prompt = "",
special = {'"', true},
},{
- content = { { {}, "1+2" } },
+ content = {
+ { {}, "1" },
+ { {}, "+" },
+ { {}, "2" },
+ },
firstc = "=",
indent = 0,
pos = 3,
@@ -234,9 +251,9 @@ describe('external cmdline', function()
}}
screen:expect([[
^ |
- ~ |
- ~ |
- ~ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
|
]], nil, nil, function()
eq(expectation, cmdline)
@@ -249,9 +266,9 @@ describe('external cmdline', function()
-- focus is at external cmdline anyway.
screen:expect([[
|
- ~ |
- ~ |
- ~ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
^ |
]], nil, nil, function()
eq(expectation, cmdline)
@@ -261,9 +278,9 @@ describe('external cmdline', function()
feed('<cr>')
screen:expect([[
|
- ~ |
- ~ |
- ~ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
^ |
]], nil, nil, function()
eq({{
@@ -278,9 +295,9 @@ describe('external cmdline', function()
feed('<esc>')
screen:expect([[
^ |
- ~ |
- ~ |
- ~ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
|
]], nil, nil, function()
eq({}, cmdline)
@@ -291,9 +308,9 @@ describe('external cmdline', function()
feed(':function Foo()<cr>')
screen:expect([[
^ |
- ~ |
- ~ |
- ~ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
|
]], nil, nil, function()
eq({{
@@ -303,41 +320,70 @@ describe('external cmdline', function()
pos = 0,
prompt = "",
}}, cmdline)
- eq({{{{}, 'function Foo()'}}}, block)
+ eq({ { { {}, 'function Foo()'} } }, block)
end)
feed('line1<cr>')
screen:expect([[
^ |
- ~ |
- ~ |
- ~ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
|
]], nil, nil, function()
- eq({{{{}, 'function Foo()'}},
- {{{}, ' line1'}}}, block)
+ eq({ { { {}, 'function Foo()'} },
+ { { {}, ' line1'} } }, block)
end)
block = {}
command("redraw!")
screen:expect([[
|
- ~ |
- ~ |
- ~ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
^ |
]], nil, nil, function()
- eq({{{{}, 'function Foo()'}},
- {{{}, ' line1'}}}, block)
+ eq({ { { {}, 'function Foo()'} },
+ { { {}, ' line1'} } }, block)
end)
+ feed('endfunction<cr>')
+ screen:expect([[
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]], nil, nil, function()
+ eq(nil, block)
+ end)
+
+ -- Try once more, to check buffer is reinitialized. #8007
+ feed(':function Bar()<cr>')
+ screen:expect([[
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]], nil, nil, function()
+ eq({{
+ content = { { {}, "" } },
+ firstc = ":",
+ indent = 2,
+ pos = 0,
+ prompt = "",
+ }}, cmdline)
+ eq({ { { {}, 'function Bar()'} } }, block)
+ end)
feed('endfunction<cr>')
screen:expect([[
^ |
- ~ |
- ~ |
- ~ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
|
]], nil, nil, function()
eq(nil, block)
@@ -348,9 +394,9 @@ describe('external cmdline', function()
feed(':make')
screen:expect([[
^ |
- ~ |
- ~ |
- ~ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
|
]], nil, nil, function()
eq({{
@@ -365,9 +411,9 @@ describe('external cmdline', function()
feed('<c-f>')
screen:expect([[
|
- [No Name] |
- :make^ |
- [Command Line] |
+ {2:[No Name] }|
+ {1::}make^ |
+ {3:[Command Line] }|
|
]], nil, nil, function()
eq({}, cmdline)
@@ -377,9 +423,9 @@ describe('external cmdline', function()
feed(':yank')
screen:expect([[
|
- [No Name] |
- :make^ |
- [Command Line] |
+ {2:[No Name] }|
+ {1::}make^ |
+ {3:[Command Line] }|
|
]], nil, nil, function()
eq({nil, {
@@ -395,9 +441,9 @@ describe('external cmdline', function()
command("redraw!")
screen:expect([[
|
- [No Name] |
- :make |
- [Command Line] |
+ {2:[No Name] }|
+ {1::}make |
+ {3:[Command Line] }|
^ |
]], nil, nil, function()
eq({nil, {
@@ -412,9 +458,9 @@ describe('external cmdline', function()
feed("<c-c>")
screen:expect([[
|
- [No Name] |
- :make^ |
- [Command Line] |
+ {2:[No Name] }|
+ {1::}make^ |
+ {3:[Command Line] }|
|
]], nil, nil, function()
eq({}, cmdline)
@@ -423,9 +469,9 @@ describe('external cmdline', function()
feed("<c-c>")
screen:expect([[
|
- [No Name] |
- :make^ |
- [Command Line] |
+ {2:[No Name] }|
+ {1::}make^ |
+ {3:[Command Line] }|
|
]], nil, nil, function()
eq({{
@@ -441,9 +487,9 @@ describe('external cmdline', function()
command("redraw!")
screen:expect([[
|
- ~ |
- ~ |
- ~ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
^ |
]], nil, nil, function()
eq({{
@@ -460,9 +506,9 @@ describe('external cmdline', function()
feed(":call inputsecret('secret:')<cr>abc123")
screen:expect([[
^ |
- ~ |
- ~ |
- ~ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
|
]], nil, nil, function()
eq({{
@@ -476,50 +522,160 @@ describe('external cmdline', function()
end)
it('works with highlighted cmdline', function()
- source([[
- highlight RBP1 guibg=Red
- highlight RBP2 guibg=Yellow
- highlight RBP3 guibg=Green
- highlight RBP4 guibg=Blue
- let g:NUM_LVLS = 4
- function RainBowParens(cmdline)
- let ret = []
- let i = 0
- let lvl = 0
- while i < len(a:cmdline)
- if a:cmdline[i] is# '('
- call add(ret, [i, i + 1, 'RBP' . ((lvl % g:NUM_LVLS) + 1)])
- let lvl += 1
- elseif a:cmdline[i] is# ')'
- let lvl -= 1
- call add(ret, [i, i + 1, 'RBP' . ((lvl % g:NUM_LVLS) + 1)])
- endif
- let i += 1
- endwhile
- return ret
- endfunction
- map <f5> :let x = input({'prompt':'>','highlight':'RainBowParens'})<cr>
- "map <f5> :let x = input({'prompt':'>'})<cr>
- ]])
- screen:set_default_attr_ids({
- RBP1={background = Screen.colors.Red},
- RBP2={background = Screen.colors.Yellow},
- RBP3={background = Screen.colors.Green},
- RBP4={background = Screen.colors.Blue},
- EOB={bold = true, foreground = Screen.colors.Blue1},
- ERR={foreground = Screen.colors.Grey100, background = Screen.colors.Red},
- SK={foreground = Screen.colors.Blue},
- PE={bold = true, foreground = Screen.colors.SeaGreen4}
- })
- feed('<f5>(a(b)a)')
- screen:expect([[
- ^ |
- {EOB:~ }|
- {EOB:~ }|
- {EOB:~ }|
- |
- ]], nil, nil, function()
- expect_cmdline(1, '{RBP1:(}a{RBP2:(}b{RBP2:)}a{RBP1:)}')
- end)
+ source([[
+ highlight RBP1 guibg=Red
+ highlight RBP2 guibg=Yellow
+ highlight RBP3 guibg=Green
+ highlight RBP4 guibg=Blue
+ let g:NUM_LVLS = 4
+ function RainBowParens(cmdline)
+ let ret = []
+ let i = 0
+ let lvl = 0
+ while i < len(a:cmdline)
+ if a:cmdline[i] is# '('
+ call add(ret, [i, i + 1, 'RBP' . ((lvl % g:NUM_LVLS) + 1)])
+ let lvl += 1
+ elseif a:cmdline[i] is# ')'
+ let lvl -= 1
+ call add(ret, [i, i + 1, 'RBP' . ((lvl % g:NUM_LVLS) + 1)])
+ endif
+ let i += 1
+ endwhile
+ return ret
+ endfunction
+ map <f5> :let x = input({'prompt':'>','highlight':'RainBowParens'})<cr>
+ "map <f5> :let x = input({'prompt':'>'})<cr>
+ ]])
+ screen:set_default_attr_ids({
+ RBP1={background = Screen.colors.Red},
+ RBP2={background = Screen.colors.Yellow},
+ RBP3={background = Screen.colors.Green},
+ RBP4={background = Screen.colors.Blue},
+ EOB={bold = true, foreground = Screen.colors.Blue1},
+ ERR={foreground = Screen.colors.Grey100, background = Screen.colors.Red},
+ SK={foreground = Screen.colors.Blue},
+ PE={bold = true, foreground = Screen.colors.SeaGreen4}
+ })
+ feed('<f5>(a(b)a)')
+ screen:expect([[
+ ^ |
+ {EOB:~ }|
+ {EOB:~ }|
+ {EOB:~ }|
+ |
+ ]], nil, nil, function()
+ expect_cmdline(1, '{RBP1:(}a{RBP2:(}b{RBP2:)}a{RBP1:)}')
+ end)
+ end)
+
+ it('works together with ext_wildmenu', function()
+ local expected = {
+ 'define',
+ 'jump',
+ 'list',
+ 'place',
+ 'undefine',
+ 'unplace',
+ }
+
+ command('set wildmode=full')
+ command('set wildmenu')
+ screen:set_option('ext_wildmenu', true)
+ feed(':sign <tab>')
+
+ screen:expect([[
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]], nil, nil, function()
+ eq({{
+ content = { { {}, "sign define"} },
+ firstc = ":",
+ indent = 0,
+ pos = 11,
+ prompt = ""
+ }}, cmdline)
+ eq(expected, wild_items)
+ eq(0, wild_selected)
+ end)
+
+ feed('<tab>')
+ screen:expect([[
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]], nil, nil, function()
+ eq({{
+ content = { { {}, "sign jump"} },
+ firstc = ":",
+ indent = 0,
+ pos = 9,
+ prompt = ""
+ }}, cmdline)
+ eq(expected, wild_items)
+ eq(1, wild_selected)
+ end)
+
+ feed('<left><left>')
+ screen:expect([[
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]], nil, nil, function()
+ eq({{
+ content = { { {}, "sign "} },
+ firstc = ":",
+ indent = 0,
+ pos = 5,
+ prompt = ""
+ }}, cmdline)
+ eq(expected, wild_items)
+ eq(-1, wild_selected)
+ end)
+
+ feed('<right>')
+ screen:expect([[
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]], nil, nil, function()
+ eq({{
+ content = { { {}, "sign define"} },
+ firstc = ":",
+ indent = 0,
+ pos = 11,
+ prompt = ""
+ }}, cmdline)
+ eq(expected, wild_items)
+ eq(0, wild_selected)
+ end)
+
+ feed('a')
+ screen:expect([[
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]], nil, nil, function()
+ eq({{
+ content = { { {}, "sign definea"} },
+ firstc = ":",
+ indent = 0,
+ pos = 12,
+ prompt = ""
+ }}, cmdline)
+ eq(nil, wild_items)
+ eq(nil, wild_selected)
+ end)
end)
end)
diff --git a/test/functional/ui/cursor_spec.lua b/test/functional/ui/cursor_spec.lua
index b47210a777..812c095add 100644
--- a/test/functional/ui/cursor_spec.lua
+++ b/test/functional/ui/cursor_spec.lua
@@ -194,8 +194,8 @@ describe('ui/cursor', function()
if m.blinkoff then m.blinkoff = 400 end
if m.blinkwait then m.blinkwait = 700 end
end
- if m.hl_id then m.hl_id = 48 end
- if m.id_lm then m.id_lm = 49 end
+ if m.hl_id then m.hl_id = 49 end
+ if m.id_lm then m.id_lm = 50 end
end
-- Assert the new expectation.
diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua
index 2252e3580f..ab3b1c3cac 100644
--- a/test/functional/ui/highlight_spec.lua
+++ b/test/functional/ui/highlight_spec.lua
@@ -94,6 +94,7 @@ describe('highlight defaults', function()
clear()
screen = Screen.new()
screen:attach()
+ command("set display-=msgsep")
end)
after_each(function()
@@ -108,12 +109,12 @@ describe('highlight defaults', function()
})
feed_command('sp', 'vsp', 'vsp')
screen:expect([[
- ^ {2:|} {2:|} |
- {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
- {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
- {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
- {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
- {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
+ ^ {2:│} {2:│} |
+ {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
+ {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
+ {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
+ {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
+ {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
{1:[No Name] }{2:[No Name] [No Name] }|
|
{0:~ }|
@@ -126,12 +127,12 @@ describe('highlight defaults', function()
-- navigate to verify that the attributes are properly moved
feed('<c-w>j')
screen:expect([[
- {2:|} {2:|} |
- {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
- {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
- {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
- {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
- {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
+ {2:│} {2:│} |
+ {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
+ {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
+ {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
+ {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
+ {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
{2:[No Name] [No Name] [No Name] }|
^ |
{0:~ }|
@@ -146,12 +147,12 @@ describe('highlight defaults', function()
-- (upstream vim has the same behavior)
feed('<c-w>k<c-w>l')
screen:expect([[
- {2:|}^ {2:|} |
- {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
- {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
- {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
- {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
- {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
+ {2:│}^ {2:│} |
+ {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
+ {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
+ {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
+ {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
+ {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
{2:[No Name] }{1:[No Name] }{2:[No Name] }|
|
{0:~ }|
@@ -163,12 +164,12 @@ describe('highlight defaults', function()
]])
feed('<c-w>l')
screen:expect([[
- {2:|} {2:|}^ |
- {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
- {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
- {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
- {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
- {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
+ {2:│} {2:│}^ |
+ {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
+ {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
+ {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
+ {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
+ {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
{2:[No Name] [No Name] }{1:[No Name] }|
|
{0:~ }|
@@ -180,12 +181,12 @@ describe('highlight defaults', function()
]])
feed('<c-w>h<c-w>h')
screen:expect([[
- ^ {2:|} {2:|} |
- {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
- {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
- {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
- {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
- {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
+ ^ {2:│} {2:│} |
+ {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
+ {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
+ {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
+ {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
+ {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
{1:[No Name] }{2:[No Name] [No Name] }|
|
{0:~ }|
@@ -312,7 +313,7 @@ describe('highlight defaults', function()
end)
end)
-describe('guisp (special/undercurl)', function()
+describe('highlight', function()
local screen
before_each(function()
@@ -321,7 +322,31 @@ describe('guisp (special/undercurl)', function()
screen:attach()
end)
- it('can be set and is applied like foreground or background', function()
+ it('cterm=standout gui=standout', function()
+ screen:detach()
+ screen = Screen.new(20,5)
+ screen:attach()
+ screen:set_default_attr_ids({
+ [1] = {bold = true, foreground = Screen.colors.Blue1},
+ [2] = {standout = true, bold = true, underline = true,
+ background = Screen.colors.Gray90, foreground = Screen.colors.Blue1},
+ [3] = {standout = true, underline = true,
+ background = Screen.colors.Gray90}
+ })
+ feed_command('hi CursorLine cterm=standout,underline gui=standout,underline')
+ feed_command('set cursorline')
+ feed_command('set listchars=space:.,eol:¬,tab:>-,extends:>,precedes:<,trail:* list')
+ feed('i\t abcd <cr>\t abcd <cr><esc>k')
+ screen:expect([[
+ {1:>-------.}abcd{1:*¬} |
+ {2:^>-------.}{3:abcd}{2:*¬}{3: }|
+ {1:¬} |
+ {1:~ }|
+ |
+ ]])
+ end)
+
+ it('guisp (special/undercurl)', function()
feed_command('syntax on')
feed_command('syn keyword TmpKeyword neovim')
feed_command('syn keyword TmpKeyword1 special')
@@ -650,6 +675,76 @@ describe("'listchars' highlight", function()
end)
end)
+describe("MsgSeparator highlight and msgsep fillchar", function()
+ before_each(clear)
+ it("works", function()
+ local screen = Screen.new(50,5)
+ screen:set_default_attr_ids({
+ [1] = {bold=true, foreground=Screen.colors.Blue},
+ [2] = {bold=true, reverse=true},
+ [3] = {bold = true, foreground = Screen.colors.SeaGreen4},
+ [4] = {background = Screen.colors.Cyan, bold = true, reverse = true},
+ [5] = {bold = true, background = Screen.colors.Magenta}
+ })
+ screen:attach()
+
+ -- defaults
+ feed_command("ls")
+ screen:expect([[
+ |
+ {2: }|
+ :ls |
+ 1 %a "[No Name]" line 1 |
+ {3:Press ENTER or type command to continue}^ |
+ ]])
+ feed('<cr>')
+
+ feed_command("set fillchars+=msgsep:-")
+ feed_command("ls")
+ screen:expect([[
+ |
+ {2:--------------------------------------------------}|
+ :ls |
+ 1 %a "[No Name]" line 1 |
+ {3:Press ENTER or type command to continue}^ |
+ ]])
+
+ -- linked to StatusLine per default
+ feed_command("hi StatusLine guibg=Cyan")
+ feed_command("ls")
+ screen:expect([[
+ |
+ {4:--------------------------------------------------}|
+ :ls |
+ 1 %a "[No Name]" line 1 |
+ {3:Press ENTER or type command to continue}^ |
+ ]])
+
+ -- but can be unlinked
+ feed_command("hi clear MsgSeparator")
+ feed_command("hi MsgSeparator guibg=Magenta gui=bold")
+ feed_command("ls")
+ screen:expect([[
+ |
+ {5:--------------------------------------------------}|
+ :ls |
+ 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)
+end)
+
describe("'winhighlight' highlight", function()
local screen
@@ -683,6 +778,9 @@ describe("'winhighlight' highlight", function()
[22] = {bold = true, foreground = Screen.colors.SeaGreen4},
[23] = {background = Screen.colors.LightMagenta},
[24] = {background = Screen.colors.WebGray},
+ [25] = {bold = true, foreground = Screen.colors.Green1},
+ [26] = {background = Screen.colors.Red},
+ [27] = {background = Screen.colors.DarkBlue, bold = true, foreground = Screen.colors.Green1},
})
command("hi Background1 guibg=DarkBlue")
command("hi Background2 guibg=DarkGreen")
@@ -905,6 +1003,7 @@ describe("'winhighlight' highlight", function()
end)
it('background applies also to non-text', function()
+ command('set sidescroll=0')
insert('Lorem ipsum dolor sit amet ')
command('set shiftwidth=2')
feed('>>')
@@ -951,6 +1050,39 @@ describe("'winhighlight' highlight", function()
]])
end)
+ it("background doesn't override syntax background", function()
+ command('syntax on')
+ command('syntax keyword Foobar foobar')
+ command('syntax keyword Article the')
+ command('hi Foobar guibg=#FF0000')
+ command('hi Article guifg=#00FF00 gui=bold')
+ insert('the foobar was foobar')
+ screen:expect([[
+ {25:the} {26:foobar} was {26:fooba}|
+ {26:^r} |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+
+ -- winhl=Normal:Group with background doesn't override syntax background,
+ -- but does combine with syntax foreground.
+ command('set winhl=Normal:Background1')
+ screen:expect([[
+ {27:the}{1: }{26:foobar}{1: was }{26:fooba}|
+ {26:^r}{1: }|
+ {2:~ }|
+ {2:~ }|
+ {2:~ }|
+ {2:~ }|
+ {2:~ }|
+ |
+ ]])
+ end)
+
it('can override NonText, Conceal and EndOfBuffer', function()
curbufmeths.set_lines(0,-1,true, {"raa\000"})
command('call matchaddpos("Conceal", [[1,2]], 0, -1, {"conceal": "#"})')
diff --git a/test/functional/ui/inccommand_spec.lua b/test/functional/ui/inccommand_spec.lua
index 53fd17c309..27e4066d9f 100644
--- a/test/functional/ui/inccommand_spec.lua
+++ b/test/functional/ui/inccommand_spec.lua
@@ -12,6 +12,7 @@ local insert = helpers.insert
local meths = helpers.meths
local neq = helpers.neq
local ok = helpers.ok
+local retry = helpers.retry
local source = helpers.source
local wait = helpers.wait
local nvim = helpers.nvim
@@ -62,6 +63,7 @@ local function common_setup(screen, inccommand, text)
command("syntax on")
command("set nohlsearch")
command("hi Substitute guifg=red guibg=yellow")
+ command("set display-=msgsep")
screen:attach()
screen:set_default_attr_ids({
[1] = {foreground = Screen.colors.Fuchsia},
@@ -91,22 +93,30 @@ local function common_setup(screen, inccommand, text)
end
end
-describe(":substitute, inccommand=split does not trigger preview", function()
+describe(":substitute, inccommand=split", function()
before_each(function()
clear()
common_setup(nil, "split", default_text)
end)
- it("if invoked by a script ", function()
+ -- Test the tests: verify that the `1==bufnr('$')` assertion
+ -- in the "no preview" tests (below) actually means something.
+ it("previews interactive cmdline", function()
+ feed(':%s/tw/MO/g')
+ retry(nil, 1000, function()
+ eq(2, eval("bufnr('$')"))
+ end)
+ end)
+
+ it("no preview if invoked by a script", function()
source('%s/tw/MO/g')
wait()
eq(1, eval("bufnr('$')"))
-
-- sanity check: assert the buffer state
expect(default_text:gsub("tw", "MO"))
end)
- it("if invoked by feedkeys()", function()
+ it("no preview if invoked by feedkeys()", function()
-- in a script...
source([[:call feedkeys(":%s/tw/MO/g\<CR>")]])
wait()
@@ -114,15 +124,12 @@ describe(":substitute, inccommand=split does not trigger preview", function()
feed([[:call feedkeys(":%s/tw/MO/g\<CR>")<CR>]])
wait()
eq(1, eval("bufnr('$')"))
-
-- sanity check: assert the buffer state
expect(default_text:gsub("tw", "MO"))
end)
end)
describe(":substitute, 'inccommand' preserves", function()
- if helpers.pending_win32(pending) then return end
-
before_each(clear)
it('listed buffers (:ls)', function()
@@ -285,8 +292,6 @@ describe(":substitute, 'inccommand' preserves", function()
end)
describe(":substitute, 'inccommand' preserves undo", function()
- if helpers.pending_win32(pending) then return end
-
local cases = { "", "split", "nosplit" }
local substrings = {
@@ -700,8 +705,6 @@ describe(":substitute, 'inccommand' preserves undo", function()
end)
describe(":substitute, inccommand=split", function()
- if helpers.pending_win32(pending) then return end
-
local screen = Screen.new(30,15)
before_each(function()
@@ -1169,8 +1172,6 @@ describe(":substitute, inccommand=split", function()
end)
describe("inccommand=nosplit", function()
- if helpers.pending_win32(pending) then return end
-
local screen = Screen.new(20,10)
before_each(function()
@@ -1356,8 +1357,6 @@ describe("inccommand=nosplit", function()
end)
describe(":substitute, 'inccommand' with a failing expression", function()
- if helpers.pending_win32(pending) then return end
-
local screen = Screen.new(20,10)
local cases = { "", "split", "nosplit" }
@@ -1621,8 +1620,6 @@ describe("'inccommand' autocommands", function()
end)
describe("'inccommand' split windows", function()
- if helpers.pending_win32(pending) then return end
-
local screen
local function refresh()
clear()
@@ -1642,26 +1639,26 @@ describe("'inccommand' split windows", function()
feed_command("split")
feed(":%s/tw")
screen:expect([[
- Inc substitution on {10:|}Inc substitution on|
- {12:tw}o lines {10:|}{12:tw}o lines |
- {10:|} |
- {15:~ }{10:|}{15:~ }|
- {15:~ }{10:|}{15:~ }|
- {15:~ }{10:|}{15:~ }|
- {15:~ }{10:|}{15:~ }|
- {15:~ }{10:|}{15:~ }|
- {15:~ }{10:|}{15:~ }|
- {15:~ }{10:|}{15:~ }|
- {15:~ }{10:|}{15:~ }|
- {15:~ }{10:|}{15:~ }|
- {15:~ }{10:|}{15:~ }|
- {15:~ }{10:|}{15:~ }|
- {11:[No Name] [+] }{10:|}{15:~ }|
- Inc substitution on {10:|}{15:~ }|
- {12:tw}o lines {10:|}{15:~ }|
- {10:|}{15:~ }|
- {15:~ }{10:|}{15:~ }|
- {15:~ }{10:|}{15:~ }|
+ Inc substitution on {10:│}Inc substitution on|
+ {12:tw}o lines {10:│}{12:tw}o lines |
+ {10:│} |
+ {15:~ }{10:│}{15:~ }|
+ {15:~ }{10:│}{15:~ }|
+ {15:~ }{10:│}{15:~ }|
+ {15:~ }{10:│}{15:~ }|
+ {15:~ }{10:│}{15:~ }|
+ {15:~ }{10:│}{15:~ }|
+ {15:~ }{10:│}{15:~ }|
+ {15:~ }{10:│}{15:~ }|
+ {15:~ }{10:│}{15:~ }|
+ {15:~ }{10:│}{15:~ }|
+ {15:~ }{10:│}{15:~ }|
+ {11:[No Name] [+] }{10:│}{15:~ }|
+ Inc substitution on {10:│}{15:~ }|
+ {12:tw}o lines {10:│}{15:~ }|
+ {10:│}{15:~ }|
+ {15:~ }{10:│}{15:~ }|
+ {15:~ }{10:│}{15:~ }|
{10:[No Name] [+] [No Name] [+] }|
|2| {12:tw}o lines |
{15:~ }|
@@ -1681,20 +1678,20 @@ describe("'inccommand' split windows", function()
feed(":%s/tw")
screen:expect([[
- Inc substitution on {10:|}Inc substitution on|
- {12:tw}o lines {10:|}{12:tw}o lines |
- {10:|} |
- {15:~ }{10:|}{15:~ }|
- {15:~ }{10:|}{15:~ }|
- {15:~ }{10:|}{15:~ }|
- {15:~ }{10:|}{15:~ }|
- {15:~ }{10:|}{15:~ }|
- {15:~ }{10:|}{15:~ }|
- {15:~ }{10:|}{15:~ }|
- {15:~ }{10:|}{15:~ }|
- {15:~ }{10:|}{15:~ }|
- {15:~ }{10:|}{15:~ }|
- {15:~ }{10:|}{15:~ }|
+ Inc substitution on {10:│}Inc substitution on|
+ {12:tw}o lines {10:│}{12:tw}o lines |
+ {10:│} |
+ {15:~ }{10:│}{15:~ }|
+ {15:~ }{10:│}{15:~ }|
+ {15:~ }{10:│}{15:~ }|
+ {15:~ }{10:│}{15:~ }|
+ {15:~ }{10:│}{15:~ }|
+ {15:~ }{10:│}{15:~ }|
+ {15:~ }{10:│}{15:~ }|
+ {15:~ }{10:│}{15:~ }|
+ {15:~ }{10:│}{15:~ }|
+ {15:~ }{10:│}{15:~ }|
+ {15:~ }{10:│}{15:~ }|
{11:[No Name] [+] }{10:[No Name] [+] }|
Inc substitution on |
{12:tw}o lines |
diff --git a/test/functional/ui/input_spec.lua b/test/functional/ui/input_spec.lua
index 29d974b709..3dd9a2506e 100644
--- a/test/functional/ui/input_spec.lua
+++ b/test/functional/ui/input_spec.lua
@@ -1,11 +1,11 @@
local helpers = require('test.functional.helpers')(after_each)
local clear, feed_command, nvim = helpers.clear, helpers.feed_command, helpers.nvim
-local feed, next_message, eq = helpers.feed, helpers.next_message, helpers.eq
+local feed, next_msg, eq = helpers.feed, helpers.next_msg, helpers.eq
+local command = helpers.command
local expect = helpers.expect
+local write_file = helpers.write_file
local Screen = require('test.functional.ui.screen')
-if helpers.pending_win32(pending) then return end
-
describe('mappings', function()
local cid
@@ -17,7 +17,7 @@ describe('mappings', function()
local check_mapping = function(mapping, expected)
feed(mapping)
- eq({'notification', 'mapped', {expected}}, next_message())
+ eq({'notification', 'mapped', {expected}}, next_msg())
end
before_each(function()
@@ -126,3 +126,97 @@ describe('input utf sequences that contain CSI/K_SPECIAL', function()
expect('…')
end)
end)
+
+describe('input non-printable chars', function()
+ after_each(function()
+ os.remove('Xtest-overwrite')
+ end)
+
+ it("doesn't crash when echoing them back", function()
+ write_file("Xtest-overwrite", [[foobar]])
+ clear()
+ local screen = Screen.new(60,8)
+ screen:set_default_attr_ids({
+ [1] = {bold = true, foreground = Screen.colors.Blue1},
+ [2] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red},
+ [3] = {bold = true, foreground = Screen.colors.SeaGreen4}
+ })
+ screen:attach()
+ command("set display-=msgsep")
+
+ feed_command("e Xtest-overwrite")
+ screen:expect([[
+ ^foobar |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ "Xtest-overwrite" [noeol] 1L, 6C |
+ ]])
+
+ -- The timestamp is in second resolution, wait two seconds to be sure.
+ screen:sleep(2000)
+ write_file("Xtest-overwrite", [[smurf]])
+ feed_command("w")
+ screen:expect([[
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ "Xtest-overwrite" |
+ {2:WARNING: The file has been changed since reading it!!!} |
+ {3:Do you really want to write to it (y/n)?}^ |
+ ]])
+
+ feed("u")
+ screen:expect([[
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ "Xtest-overwrite" |
+ {2:WARNING: The file has been changed since reading it!!!} |
+ {3:Do you really want to write to it (y/n)?}u |
+ {3:Do you really want to write to it (y/n)?}^ |
+ ]])
+
+ feed("\005")
+ screen:expect([[
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ "Xtest-overwrite" |
+ {2:WARNING: The file has been changed since reading it!!!} |
+ {3:Do you really want to write to it (y/n)?}u |
+ {3:Do you really want to write to it (y/n)?} |
+ {3:Do you really want to write to it (y/n)?}^ |
+ ]])
+
+ feed("n")
+ screen:expect([[
+ {1:~ }|
+ {1:~ }|
+ "Xtest-overwrite" |
+ {2:WARNING: The file has been changed since reading it!!!} |
+ {3:Do you really want to write to it (y/n)?}u |
+ {3:Do you really want to write to it (y/n)?} |
+ {3:Do you really want to write to it (y/n)?}n |
+ {3:Press ENTER or type command to continue}^ |
+ ]])
+
+ feed("<cr>")
+ screen:expect([[
+ ^foobar |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]])
+ end)
+end)
diff --git a/test/functional/ui/mouse_spec.lua b/test/functional/ui/mouse_spec.lua
index 3daf92eea0..debd324977 100644
--- a/test/functional/ui/mouse_spec.lua
+++ b/test/functional/ui/mouse_spec.lua
@@ -3,8 +3,7 @@ local Screen = require('test.functional.ui.screen')
local clear, feed, meths = helpers.clear, helpers.feed, helpers.meths
local insert, feed_command = helpers.insert, helpers.feed_command
local eq, funcs = helpers.eq, helpers.funcs
-
-if helpers.pending_win32(pending) then return end
+local command = helpers.command
describe('ui/mouse/input', function()
local screen
@@ -27,6 +26,7 @@ describe('ui/mouse/input', function()
[4] = {reverse = true},
[5] = {bold = true, reverse = true},
})
+ command("set display-=msgsep")
feed('itesting<cr>mouse<cr>support and selection<esc>')
screen:expect([[
testing |
@@ -639,12 +639,12 @@ describe('ui/mouse/input', function()
screen:try_resize(53, 14)
feed_command('sp', 'vsp')
screen:expect([[
- lines {4:|}lines |
- to {4:|}to |
- test {4:|}test |
- mouse scrolling {4:|}mouse scrolling |
- ^ {4:|} |
- {0:~ }{4:|}{0:~ }|
+ lines {4:│}lines |
+ to {4:│}to |
+ test {4:│}test |
+ mouse scrolling {4:│}mouse scrolling |
+ ^ {4:│} |
+ {0:~ }{4:│}{0:~ }|
{5:[No Name] [+] }{4:[No Name] [+] }|
to |
test |
@@ -656,12 +656,12 @@ describe('ui/mouse/input', function()
]])
feed('<ScrollWheelDown><0,0>')
screen:expect([[
- mouse scrolling {4:|}lines |
- ^ {4:|}to |
- {0:~ }{4:|}test |
- {0:~ }{4:|}mouse scrolling |
- {0:~ }{4:|} |
- {0:~ }{4:|}{0:~ }|
+ mouse scrolling {4:│}lines |
+ ^ {4:│}to |
+ {0:~ }{4:│}test |
+ {0:~ }{4:│}mouse scrolling |
+ {0:~ }{4:│} |
+ {0:~ }{4:│}{0:~ }|
{5:[No Name] [+] }{4:[No Name] [+] }|
to |
test |
@@ -673,12 +673,12 @@ describe('ui/mouse/input', function()
]])
feed('<ScrollWheelUp><27,0>')
screen:expect([[
- mouse scrolling {4:|}text |
- ^ {4:|}with |
- {0:~ }{4:|}many |
- {0:~ }{4:|}lines |
- {0:~ }{4:|}to |
- {0:~ }{4:|}test |
+ mouse scrolling {4:│}text |
+ ^ {4:│}with |
+ {0:~ }{4:│}many |
+ {0:~ }{4:│}lines |
+ {0:~ }{4:│}to |
+ {0:~ }{4:│}test |
{5:[No Name] [+] }{4:[No Name] [+] }|
to |
test |
@@ -690,12 +690,12 @@ describe('ui/mouse/input', function()
]])
feed('<ScrollWheelUp><27,7><ScrollWheelUp>')
screen:expect([[
- mouse scrolling {4:|}text |
- ^ {4:|}with |
- {0:~ }{4:|}many |
- {0:~ }{4:|}lines |
- {0:~ }{4:|}to |
- {0:~ }{4:|}test |
+ mouse scrolling {4:│}text |
+ ^ {4:│}with |
+ {0:~ }{4:│}many |
+ {0:~ }{4:│}lines |
+ {0:~ }{4:│}to |
+ {0:~ }{4:│}test |
{5:[No Name] [+] }{4:[No Name] [+] }|
Inserting |
text |
@@ -708,6 +708,7 @@ describe('ui/mouse/input', function()
end)
it('horizontal scrolling', function()
+ command('set sidescroll=0')
feed("<esc>:set nowrap<cr>")
feed("a <esc>20Ab<esc>")
@@ -752,17 +753,19 @@ describe('ui/mouse/input', function()
feed_command('set concealcursor=n')
feed_command('set nowrap')
- feed_command('syntax match NonText "\\<amet\\>" conceal')
- feed_command('syntax match NonText "\\cs\\|g." conceal cchar=X')
- feed_command('syntax match NonText "\\%(lo\\|cl\\)." conceal')
- feed_command('syntax match NonText "Lo" conceal cchar=Y')
+ feed_command('set shiftwidth=2 tabstop=4 list listchars=tab:>-')
+ feed_command('syntax match NonText "\\*" conceal')
+ feed_command('syntax match NonText "cats" conceal cchar=X')
+ feed_command('syntax match NonText "x" conceal cchar=>')
+ -- First column is there to retain the tabs.
insert([[
- Lorem ipsum dolor sit amet, consetetur sadipscing elitr.
- Stet clita kasd gubergren, no sea takimata sanctus est.
+ |Section *t1*
+ | *t2* *t3* *t4*
+ |x 私は猫が大好き *cats* ✨🐈✨
]])
- feed('gg')
+ feed('gg<c-v>Gxgg')
end)
it('(level 1) click on non-wrapped lines', function()
@@ -770,93 +773,138 @@ describe('ui/mouse/input', function()
feed('<esc><LeftMouse><0,0>')
screen:expect([[
- {c:^Y}rem ip{c:X}um do{c: } {c:X}it {c: }, con|
- {c:X}tet {c: }ta ka{c:X}d {c:X}ber{c:X}en, no|
+ ^Section{0:>>--->--->---}{c: }t1{c: } |
+ {0:>--->--->---} {c: }t2{c: } {c: }t3{c: } {c: }|
+ {c:>} 私は猫が大好き{0:>---}{c: X } {0:>}|
|
{0:~ }|
{0:~ }|
- {0:~ }|
|
]])
feed('<esc><LeftMouse><1,0>')
screen:expect([[
- {c:Y}^rem ip{c:X}um do{c: } {c:X}it {c: }, con|
- {c:X}tet {c: }ta ka{c:X}d {c:X}ber{c:X}en, no|
+ S^ection{0:>>--->--->---}{c: }t1{c: } |
+ {0:>--->--->---} {c: }t2{c: } {c: }t3{c: } {c: }|
+ {c:>} 私は猫が大好き{0:>---}{c: X } {0:>}|
|
{0:~ }|
{0:~ }|
+ |
+ ]])
+
+ feed('<esc><LeftMouse><21,0>')
+ screen:expect([[
+ Section{0:>>--->--->---}{c: }^t1{c: } |
+ {0:>--->--->---} {c: }t2{c: } {c: }t3{c: } {c: }|
+ {c:>} 私は猫が大好き{0:>---}{c: X } {0:>}|
+ |
+ {0:~ }|
{0:~ }|
|
]])
- feed('<esc><LeftMouse><15,0>')
+ feed('<esc><LeftMouse><21,1>')
screen:expect([[
- {c:Y}rem ip{c:X}um do{c: } {c:^X}it {c: }, con|
- {c:X}tet {c: }ta ka{c:X}d {c:X}ber{c:X}en, no|
+ Section{0:>>--->--->---}{c: }t1{c: } |
+ {0:>--->--->---} {c: }t2{c: } {c: }t^3{c: } {c: }|
+ {c:>} 私は猫が大好き{0:>---}{c: X } {0:>}|
|
{0:~ }|
{0:~ }|
+ |
+ ]])
+
+ feed('<esc><LeftMouse><0,2>')
+ screen:expect([[
+ Section{0:>>--->--->---}{c: }t1{c: } |
+ {0:>--->--->---} {c: }t2{c: } {c: }t3{c: } {c: }|
+ {c:^>} 私は猫が大好き{0:>---}{c: X } {0:>}|
+ |
+ {0:~ }|
{0:~ }|
|
]])
- feed('<esc><LeftMouse><15,1>')
+ feed('<esc><LeftMouse><7,2>')
screen:expect([[
- {c:Y}rem ip{c:X}um do{c: } {c:X}it {c: }, con|
- {c:X}tet {c: }ta ka{c:X}d {c:X}^ber{c:X}en, no|
+ Section{0:>>--->--->---}{c: }t1{c: } |
+ {0:>--->--->---} {c: }t2{c: } {c: }t3{c: } {c: }|
+ {c:>} 私は^猫が大好き{0:>---}{c: X } {0:>}|
|
{0:~ }|
{0:~ }|
+ |
+ ]])
+
+ feed('<esc><LeftMouse><21,2>')
+ screen:expect([[
+ Section{0:>>--->--->---}{c: }t1{c: } |
+ {0:>--->--->---} {c: }t2{c: } {c: }t3{c: } {c: }|
+ {c:>} 私は猫が大好き{0:>---}{c: ^X } {0:>}|
+ |
+ {0:~ }|
{0:~ }|
|
]])
+
end) -- level 1 - non wrapped
it('(level 1) click on wrapped lines', function()
feed_command('let &conceallevel=1', 'let &wrap=1', 'echo')
- feed('<esc><LeftMouse><0,0>')
+ feed('<esc><LeftMouse><24,1>')
screen:expect([[
- {c:^Y}rem ip{c:X}um do{c: } {c:X}it {c: } |
- , con{c:X}etetur {c:X}adip{c:X}cin{c:X} |
- elitr. |
- {c:X}tet {c: }ta ka{c:X}d {c:X}ber{c:X}en |
- , no {c:X}ea takimata {c:X}anctu{c:X}|
- e{c:X}t. |
+ Section{0:>>--->--->---}{c: }t1{c: } |
+ {0:>--->--->---} {c: }t2{c: } {c: }t3{c: } {c:^ }|
+ t4{c: } |
+ {c:>} 私は猫が大好き{0:>---}{c: X} |
+ {c: } ✨🐈✨ |
+ |
|
]])
- feed('<esc><LeftMouse><6,1>')
+ feed('<esc><LeftMouse><0,2>')
screen:expect([[
- {c:Y}rem ip{c:X}um do{c: } {c:X}it {c: } |
- , con{c:X}^etetur {c:X}adip{c:X}cin{c:X} |
- elitr. |
- {c:X}tet {c: }ta ka{c:X}d {c:X}ber{c:X}en |
- , no {c:X}ea takimata {c:X}anctu{c:X}|
- e{c:X}t. |
+ Section{0:>>--->--->---}{c: }t1{c: } |
+ {0:>--->--->---} {c: }t2{c: } {c: }t3{c: } {c: }|
+ ^t4{c: } |
+ {c:>} 私は猫が大好き{0:>---}{c: X} |
+ {c: } ✨🐈✨ |
+ |
|
]])
- feed('<esc><LeftMouse><15,1>')
+ feed('<esc><LeftMouse><8,3>')
screen:expect([[
- {c:Y}rem ip{c:X}um do{c: } {c:X}it {c: } |
- , con{c:X}etetur {c:X}a^dip{c:X}cin{c:X} |
- elitr. |
- {c:X}tet {c: }ta ka{c:X}d {c:X}ber{c:X}en |
- , no {c:X}ea takimata {c:X}anctu{c:X}|
- e{c:X}t. |
+ Section{0:>>--->--->---}{c: }t1{c: } |
+ {0:>--->--->---} {c: }t2{c: } {c: }t3{c: } {c: }|
+ t4{c: } |
+ {c:>} 私は猫^が大好き{0:>---}{c: X} |
+ {c: } ✨🐈✨ |
+ |
|
]])
- feed('<esc><LeftMouse><15,3>')
+ feed('<esc><LeftMouse><21,3>')
screen:expect([[
- {c:Y}rem ip{c:X}um do{c: } {c:X}it {c: } |
- , con{c:X}etetur {c:X}adip{c:X}cin{c:X} |
- elitr. |
- {c:X}tet {c: }ta ka{c:X}d {c:X}^ber{c:X}en |
- , no {c:X}ea takimata {c:X}anctu{c:X}|
- e{c:X}t. |
+ Section{0:>>--->--->---}{c: }t1{c: } |
+ {0:>--->--->---} {c: }t2{c: } {c: }t3{c: } {c: }|
+ t4{c: } |
+ {c:>} 私は猫が大好き{0:>---}{c: ^X} |
+ {c: } ✨🐈✨ |
+ |
+ |
+ ]])
+
+ feed('<esc><LeftMouse><4,4>')
+ screen:expect([[
+ Section{0:>>--->--->---}{c: }t1{c: } |
+ {0:>--->--->---} {c: }t2{c: } {c: }t3{c: } {c: }|
+ t4{c: } |
+ {c:>} 私は猫が大好き{0:>---}{c: X} |
+ {c: } ✨^🐈✨ |
+ |
|
]])
end) -- level 1 - wrapped
@@ -865,46 +913,68 @@ describe('ui/mouse/input', function()
it('(level 2) click on non-wrapped lines', function()
feed_command('let &conceallevel=2', 'echo')
- feed('<esc><LeftMouse><0,0>')
+ feed('<esc><LeftMouse><20,0>')
screen:expect([[
- {c:^Y}rem ip{c:X}um do {c:X}it , con{c:X}e|
- {c:X}tet ta ka{c:X}d {c:X}ber{c:X}en, no |
+ Section{0:>>--->--->---}^t1 |
+ {0:>--->--->---} t2 t3 t4 |
+ {c:>} 私は猫が大好き{0:>---}{c:X} ✨{0:>}|
|
{0:~ }|
{0:~ }|
- {0:~ }|
|
]])
- feed('<esc><LeftMouse><1,0>')
+ feed('<esc><LeftMouse><14,1>')
screen:expect([[
- {c:Y}^rem ip{c:X}um do {c:X}it , con{c:X}e|
- {c:X}tet ta ka{c:X}d {c:X}ber{c:X}en, no |
+ Section{0:>>--->--->---}t1 |
+ {0:>--->--->---} ^t2 t3 t4 |
+ {c:>} 私は猫が大好き{0:>---}{c:X} ✨{0:>}|
|
{0:~ }|
{0:~ }|
- {0:~ }|
|
]])
- feed('<esc><LeftMouse><15,0>')
+ feed('<esc><LeftMouse><18,1>')
screen:expect([[
- {c:Y}rem ip{c:X}um do {c:X}^it , con{c:X}e|
- {c:X}tet ta ka{c:X}d {c:X}ber{c:X}en, no |
+ Section{0:>>--->--->---}t1 |
+ {0:>--->--->---} t2 t^3 t4 |
+ {c:>} 私は猫が大好き{0:>---}{c:X} ✨{0:>}|
|
{0:~ }|
{0:~ }|
+ |
+ ]])
+
+ feed('<esc><LeftMouse><0,2>') -- Weirdness
+ screen:expect([[
+ Section{0:>>--->--->---}t1 |
+ {0:>--->--->---} t2 t3 t4 |
+ {c:^>} 私は猫が大好き{0:>---}{c:X} ✨{0:>}|
+ |
+ {0:~ }|
{0:~ }|
|
]])
- feed('<esc><LeftMouse><15,1>')
+ feed('<esc><LeftMouse><8,2>')
screen:expect([[
- {c:Y}rem ip{c:X}um do {c:X}it , con{c:X}e|
- {c:X}tet ta ka{c:X}d {c:X}b^er{c:X}en, no |
+ Section{0:>>--->--->---}t1 |
+ {0:>--->--->---} t2 t3 t4 |
+ {c:>} 私は猫^が大好き{0:>---}{c:X} ✨{0:>}|
|
{0:~ }|
{0:~ }|
+ |
+ ]])
+
+ feed('<esc><LeftMouse><20,2>')
+ screen:expect([[
+ Section{0:>>--->--->---}t1 |
+ {0:>--->--->---} t2 t3 t4 |
+ {c:>} 私は猫が大好き{0:>---}{c:^X} ✨{0:>}|
+ |
+ {0:~ }|
{0:~ }|
|
]])
@@ -913,47 +983,108 @@ describe('ui/mouse/input', function()
it('(level 2) click on wrapped lines', function()
feed_command('let &conceallevel=2', 'let &wrap=1', 'echo')
- feed('<esc><LeftMouse><0,0>')
+ feed('<esc><LeftMouse><20,0>')
screen:expect([[
- {c:^Y}rem ip{c:X}um do {c:X}it |
- , con{c:X}etetur {c:X}adip{c:X}cin{c:X} |
- elitr. |
- {c:X}tet ta ka{c:X}d {c:X}ber{c:X}en |
- , no {c:X}ea takimata {c:X}anctu{c:X}|
- e{c:X}t. |
+ Section{0:>>--->--->---}^t1 |
+ {0:>--->--->---} t2 t3 |
+ t4 |
+ {c:>} 私は猫が大好き{0:>---}{c:X} |
+ ✨🐈✨ |
+ |
|
]])
- feed('<esc><LeftMouse><6,1>')
+ feed('<esc><LeftMouse><14,1>')
screen:expect([[
- {c:Y}rem ip{c:X}um do {c:X}it |
- , con{c:X}^etetur {c:X}adip{c:X}cin{c:X} |
- elitr. |
- {c:X}tet ta ka{c:X}d {c:X}ber{c:X}en |
- , no {c:X}ea takimata {c:X}anctu{c:X}|
- e{c:X}t. |
+ Section{0:>>--->--->---}t1 |
+ {0:>--->--->---} ^t2 t3 |
+ t4 |
+ {c:>} 私は猫が大好き{0:>---}{c:X} |
+ ✨🐈✨ |
+ |
|
]])
- feed('<esc><LeftMouse><15,1>')
+ feed('<esc><LeftMouse><18,1>')
screen:expect([[
- {c:Y}rem ip{c:X}um do {c:X}it |
- , con{c:X}etetur {c:X}a^dip{c:X}cin{c:X} |
- elitr. |
- {c:X}tet ta ka{c:X}d {c:X}ber{c:X}en |
- , no {c:X}ea takimata {c:X}anctu{c:X}|
- e{c:X}t. |
+ Section{0:>>--->--->---}t1 |
+ {0:>--->--->---} t2 t^3 |
+ t4 |
+ {c:>} 私は猫が大好き{0:>---}{c:X} |
+ ✨🐈✨ |
+ |
|
]])
- feed('<esc><LeftMouse><15,3>')
+ -- NOTE: The click would ideally be on the 't' in 't4', but wrapping
+ -- caused the invisible '*' right before 't4' to remain on the previous
+ -- screen line. This is being treated as expected because fixing this is
+ -- out of scope for mouse clicks. Should the wrapping behavior of
+ -- concealed characters change in the future, this case should be
+ -- reevaluated.
+ feed('<esc><LeftMouse><0,2>')
screen:expect([[
- {c:Y}rem ip{c:X}um do {c:X}it |
- , con{c:X}etetur {c:X}adip{c:X}cin{c:X} |
- elitr. |
- {c:X}tet ta ka{c:X}d {c:X}b^er{c:X}en |
- , no {c:X}ea takimata {c:X}anctu{c:X}|
- e{c:X}t. |
+ Section{0:>>--->--->---}t1 |
+ {0:>--->--->---} t2 t3 ^ |
+ t4 |
+ {c:>} 私は猫が大好き{0:>---}{c:X} |
+ ✨🐈✨ |
+ |
+ |
+ ]])
+
+ feed('<esc><LeftMouse><1,2>')
+ screen:expect([[
+ Section{0:>>--->--->---}t1 |
+ {0:>--->--->---} t2 t3 |
+ t^4 |
+ {c:>} 私は猫が大好き{0:>---}{c:X} |
+ ✨🐈✨ |
+ |
+ |
+ ]])
+
+ feed('<esc><LeftMouse><0,3>')
+ screen:expect([[
+ Section{0:>>--->--->---}t1 |
+ {0:>--->--->---} t2 t3 |
+ t4 |
+ {c:^>} 私は猫が大好き{0:>---}{c:X} |
+ ✨🐈✨ |
+ |
+ |
+ ]])
+
+ feed('<esc><LeftMouse><20,3>')
+ screen:expect([[
+ Section{0:>>--->--->---}t1 |
+ {0:>--->--->---} t2 t3 |
+ t4 |
+ {c:>} 私は猫が大好き{0:>---}{c:^X} |
+ ✨🐈✨ |
+ |
+ |
+ ]])
+
+ feed('<esc><LeftMouse><1,4>')
+ screen:expect([[
+ Section{0:>>--->--->---}t1 |
+ {0:>--->--->---} t2 t3 |
+ t4 |
+ {c:>} 私は猫が大好き{0:>---}{c:X} |
+ ^✨🐈✨ |
+ |
+ |
+ ]])
+
+ feed('<esc><LeftMouse><5,4>')
+ screen:expect([[
+ Section{0:>>--->--->---}t1 |
+ {0:>--->--->---} t2 t3 |
+ t4 |
+ {c:>} 私は猫が大好き{0:>---}{c:X} |
+ ✨🐈^✨ |
+ |
|
]])
end) -- level 2 - wrapped
@@ -962,47 +1093,47 @@ describe('ui/mouse/input', function()
it('(level 3) click on non-wrapped lines', function()
feed_command('let &conceallevel=3', 'echo')
- feed('<esc><LeftMouse><0,0>')
+ feed('<esc><LeftMouse><0,2>')
screen:expect([[
- ^rem ipum do it , conetetu|
- tet ta kad beren, no ea t|
+ Section{0:>>--->--->---}t1 |
+ {0:>--->--->---} t2 t3 t4 |
+ ^ 私は猫が大好き{0:>----} ✨🐈|
|
{0:~ }|
{0:~ }|
- {0:~ }|
|
]])
- feed('<esc><LeftMouse><1,0>')
+ feed('<esc><LeftMouse><1,2>')
screen:expect([[
- r^em ipum do it , conetetu|
- tet ta kad beren, no ea t|
+ Section{0:>>--->--->---}t1 |
+ {0:>--->--->---} t2 t3 t4 |
+ ^私は猫が大好き{0:>----} ✨🐈|
|
{0:~ }|
{0:~ }|
- {0:~ }|
|
]])
- feed('<esc><LeftMouse><15,0>')
+ feed('<esc><LeftMouse><13,2>')
screen:expect([[
- rem ipum do it ^, conetetu|
- tet ta kad beren, no ea t|
+ Section{0:>>--->--->---}t1 |
+ {0:>--->--->---} t2 t3 t4 |
+ 私は猫が大好^き{0:>----} ✨🐈|
|
{0:~ }|
{0:~ }|
- {0:~ }|
|
]])
- feed('<esc><LeftMouse><15,1>')
+ feed('<esc><LeftMouse><20,2>')
screen:expect([[
- rem ipum do it , conetetu|
- tet ta kad bere^n, no ea t|
+ Section{0:>>--->--->---}t1 |
+ {0:>--->--->---} t2 t3 t4 |
+ 私は猫が大好き{0:>----}^ ✨🐈|
|
{0:~ }|
{0:~ }|
- {0:~ }|
|
]])
end) -- level 3 - non wrapped
@@ -1010,49 +1141,94 @@ describe('ui/mouse/input', function()
it('(level 3) click on wrapped lines', function()
feed_command('let &conceallevel=3', 'let &wrap=1', 'echo')
- feed('<esc><LeftMouse><0,0>')
+ feed('<esc><LeftMouse><14,1>')
+ screen:expect([[
+ Section{0:>>--->--->---}t1 |
+ {0:>--->--->---} ^t2 t3 |
+ t4 |
+ 私は猫が大好き{0:>----} |
+ ✨🐈✨ |
+ |
+ |
+ ]])
+
+ feed('<esc><LeftMouse><18,1>')
screen:expect([[
- ^rem ipum do it |
- , conetetur adipcin |
- elitr. |
- tet ta kad beren |
- , no ea takimata anctu |
- et. |
+ Section{0:>>--->--->---}t1 |
+ {0:>--->--->---} t2 t^3 |
+ t4 |
+ 私は猫が大好き{0:>----} |
+ ✨🐈✨ |
+ |
|
]])
- feed('<esc><LeftMouse><6,1>')
+ feed('<esc><LeftMouse><1,2>')
screen:expect([[
- rem ipum do it |
- , cone^tetur adipcin |
- elitr. |
- tet ta kad beren |
- , no ea takimata anctu |
- et. |
+ Section{0:>>--->--->---}t1 |
+ {0:>--->--->---} t2 t3 |
+ t^4 |
+ 私は猫が大好き{0:>----} |
+ ✨🐈✨ |
+ |
|
]])
- feed('<esc><LeftMouse><15,1>')
+ feed('<esc><LeftMouse><0,3>')
screen:expect([[
- rem ipum do it |
- , conetetur adi^pcin |
- elitr. |
- tet ta kad beren |
- , no ea takimata anctu |
- et. |
+ Section{0:>>--->--->---}t1 |
+ {0:>--->--->---} t2 t3 |
+ t4 |
+ ^ 私は猫が大好き{0:>----} |
+ ✨🐈✨ |
+ |
|
]])
- feed('<esc><LeftMouse><15,3>')
+ feed('<esc><LeftMouse><20,3>')
screen:expect([[
- rem ipum do it |
- , conetetur adipcin |
- elitr. |
- tet ta kad bere^n |
- , no ea takimata anctu |
- et. |
+ Section{0:>>--->--->---}t1 |
+ {0:>--->--->---} t2 t3 |
+ t4 |
+ 私は猫が大好き{0:>----}^ |
+ ✨🐈✨ |
+ |
|
]])
+
+ feed('<esc><LeftMouse><1,4>')
+ screen:expect([[
+ Section{0:>>--->--->---}t1 |
+ {0:>--->--->---} t2 t3 |
+ t4 |
+ 私は猫が大好き{0:>----} |
+ ^✨🐈✨ |
+ |
+ |
+ ]])
+
+ feed('<esc><LeftMouse><3,4>')
+ screen:expect([[
+ Section{0:>>--->--->---}t1 |
+ {0:>--->--->---} t2 t3 |
+ t4 |
+ 私は猫が大好き{0:>----} |
+ ✨^🐈✨ |
+ |
+ |
+ ]])
+
+ feed('<esc><LeftMouse><5,4>')
+ screen:expect([[
+ Section{0:>>--->--->---}t1 |
+ {0:>--->--->---} t2 t3 |
+ t4 |
+ 私は猫が大好き{0:>----} |
+ ✨🐈^✨ |
+ |
+ |
+ ]])
+
end) -- level 3 - wrapped
end)
end)
diff --git a/test/functional/ui/options_spec.lua b/test/functional/ui/options_spec.lua
new file mode 100644
index 0000000000..62b08c0967
--- /dev/null
+++ b/test/functional/ui/options_spec.lua
@@ -0,0 +1,110 @@
+local helpers = require('test.functional.helpers')(after_each)
+local Screen = require('test.functional.ui.screen')
+local clear = helpers.clear
+local command = helpers.command
+local eq = helpers.eq
+
+describe('ui receives option updates', function()
+ local screen
+
+ before_each(function()
+ clear()
+ screen = Screen.new(20,5)
+ end)
+
+ after_each(function()
+ screen:detach()
+ end)
+
+ local defaults = {
+ ambiwidth='single',
+ arabicshape=true,
+ emoji=true,
+ guifont='',
+ guifontset='',
+ guifontwide='',
+ linespace=0,
+ showtabline=1,
+ termguicolors=false,
+ ext_cmdline=false,
+ ext_popupmenu=false,
+ ext_tabline=false,
+ ext_wildmenu=false,
+ }
+
+ it("for defaults", function()
+ screen:attach()
+ screen:expect(function()
+ eq(defaults, screen.options)
+ end)
+ end)
+
+ it("when setting options", function()
+ screen:attach()
+ local changed = {}
+ for k,v in pairs(defaults) do
+ changed[k] = v
+ end
+
+ command("set termguicolors")
+ changed.termguicolors = true
+ screen:expect(function()
+ eq(changed, screen.options)
+ end)
+
+ command("set guifont=Comic\\ Sans")
+ changed.guifont = "Comic Sans"
+ screen:expect(function()
+ eq(changed, screen.options)
+ end)
+
+ command("set showtabline=0")
+ changed.showtabline = 0
+ screen:expect(function()
+ eq(changed, screen.options)
+ end)
+
+ command("set linespace=13")
+ changed.linespace = 13
+ screen:expect(function()
+ eq(changed, screen.options)
+ end)
+
+ command("set linespace=-11")
+ changed.linespace = -11
+ screen:expect(function()
+ eq(changed, screen.options)
+ end)
+
+ command("set all&")
+ screen:expect(function()
+ eq(defaults, screen.options)
+ end)
+ end)
+
+ it('with UI extensions', function()
+ local changed = {}
+ for k,v in pairs(defaults) do
+ changed[k] = v
+ end
+
+ screen:attach({ext_cmdline=true, ext_wildmenu=true})
+ changed.ext_cmdline = true
+ changed.ext_wildmenu = true
+ screen:expect(function()
+ eq(changed, screen.options)
+ end)
+
+ screen:set_option('ext_popupmenu', true)
+ changed.ext_popupmenu = true
+ screen:expect(function()
+ eq(changed, screen.options)
+ end)
+
+ screen:set_option('ext_wildmenu', false)
+ changed.ext_wildmenu = false
+ screen:expect(function()
+ eq(changed, screen.options)
+ end)
+ end)
+end)
diff --git a/test/functional/ui/output_spec.lua b/test/functional/ui/output_spec.lua
index c6d564e8dc..02ca566bd8 100644
--- a/test/functional/ui/output_spec.lua
+++ b/test/functional/ui/output_spec.lua
@@ -1,14 +1,24 @@
-local session = require('test.functional.helpers')(after_each)
+local Screen = require('test.functional.ui.screen')
+local helpers = require('test.functional.helpers')(after_each)
local child_session = require('test.functional.terminal.helpers')
-
-if session.pending_win32(pending) then return end
+local mkdir, write_file, rmdir = helpers.mkdir, helpers.write_file, helpers.rmdir
+local eq = helpers.eq
+local eval = helpers.eval
+local feed = helpers.feed
+local feed_command = helpers.feed_command
+local iswin = helpers.iswin
+local clear = helpers.clear
+local command = helpers.command
+local nvim_dir = helpers.nvim_dir
describe("shell command :!", function()
+ if helpers.pending_win32(pending) then return end
+
local screen
before_each(function()
- session.clear()
- screen = child_session.screen_setup(0, '["'..session.nvim_prog..
- '", "-u", "NONE", "-i", "NONE", "--cmd", "'..session.nvim_set..'"]')
+ clear()
+ screen = child_session.screen_setup(0, '["'..helpers.nvim_prog..
+ '", "-u", "NONE", "-i", "NONE", "--cmd", "'..helpers.nvim_set..'"]')
screen:expect([[
{1: } |
{4:~ }|
@@ -30,18 +40,18 @@ describe("shell command :!", function()
-- to avoid triggering a UI flush.
child_session.feed_data(":!printf foo; sleep 200\n")
screen:expect([[
+ |
{4:~ }|
{4:~ }|
- {4:~ }|
+ {5: }|
:!printf foo; sleep 200 |
- |
foo |
{3:-- TERMINAL --} |
]])
end)
it("throttles shell-command output greater than ~10KB", function()
- if os.getenv("TRAVIS") and session.os_name() == "osx" then
+ if os.getenv("TRAVIS") and helpers.os_name() == "osx" then
pending("[Unreliable on Travis macOS.]", function() end)
return
end
@@ -56,13 +66,166 @@ describe("shell command :!", function()
-- Final chunk of output should always be displayed, never skipped.
-- (Throttling is non-deterministic, this test is merely a sanity check.)
screen:expect([[
- XXXXXXXXXX 2996 |
XXXXXXXXXX 2997 |
XXXXXXXXXX 2998 |
XXXXXXXXXX 2999 |
XXXXXXXXXX 3000 |
+ |
{10:Press ENTER or type command to continue}{1: } |
{3:-- TERMINAL --} |
]])
end)
end)
+
+describe("shell command :!", function()
+ before_each(function()
+ clear()
+ end)
+
+ it("cat a binary file #4142", function()
+ feed(":exe 'silent !cat '.shellescape(v:progpath)<CR>")
+ eq(2, eval('1+1')) -- Still alive?
+ end)
+
+ it([[display \x08 char #4142]], function()
+ feed(":silent !echo \08<CR>")
+ eq(2, eval('1+1')) -- Still alive?
+ end)
+
+ it([[handles control codes]], function()
+ if iswin() then
+ pending('missing printf', function() end)
+ return
+ end
+ local screen = Screen.new(50, 4)
+ screen:attach()
+ command("set display-=msgsep")
+ -- Print TAB chars. #2958
+ feed([[:!printf '1\t2\t3'<CR>]])
+ screen:expect([[
+ ~ |
+ :!printf '1\t2\t3' |
+ 1 2 3 |
+ Press ENTER or type command to continue^ |
+ ]])
+ feed([[<CR>]])
+ -- Print BELL control code. #4338
+ screen.bell = false
+ feed([[:!printf '\x07\x07\x07\x07text'<CR>]])
+ screen:expect([[
+ ~ |
+ :!printf '\x07\x07\x07\x07text' |
+ text |
+ Press ENTER or type command to continue^ |
+ ]], nil, nil, function()
+ eq(true, screen.bell)
+ end)
+ feed([[<CR>]])
+ -- Print BS control code.
+ feed([[:echo system('printf ''\x08\n''')<CR>]])
+ screen:expect([[
+ ~ |
+ ^H |
+ |
+ Press ENTER or type command to continue^ |
+ ]])
+ feed([[<CR>]])
+ -- Print LF control code.
+ feed([[:!printf '\n'<CR>]])
+ screen:expect([[
+ :!printf '\n' |
+ |
+ |
+ Press ENTER or type command to continue^ |
+ ]])
+ feed([[<CR>]])
+ end)
+
+ describe('', function()
+ local screen
+ before_each(function()
+ rmdir('bang_filter_spec')
+ mkdir('bang_filter_spec')
+ write_file('bang_filter_spec/f1', 'f1')
+ write_file('bang_filter_spec/f2', 'f2')
+ write_file('bang_filter_spec/f3', 'f3')
+ screen = Screen.new(53,10)
+ screen:set_default_attr_ids({
+ [1] = {bold = true, foreground = Screen.colors.Blue1},
+ [2] = {foreground = Screen.colors.Blue1},
+ [3] = {bold = true, foreground = Screen.colors.SeaGreen4},
+ [4] = {bold = true, reverse = true},
+ })
+ screen:attach()
+ end)
+
+ after_each(function()
+ rmdir('bang_filter_spec')
+ end)
+
+ it("doesn't truncate Last line of shell output #3269", function()
+ command(helpers.iswin()
+ and [[nnoremap <silent>\l :!dir /b bang_filter_spec<cr>]]
+ or [[nnoremap <silent>\l :!ls bang_filter_spec<cr>]])
+ local result = (helpers.iswin()
+ and [[:!dir /b bang_filter_spec]]
+ or [[:!ls bang_filter_spec ]])
+ feed([[\l]])
+ screen:expect([[
+ |
+ {1:~ }|
+ {1:~ }|
+ {4: }|
+ ]]..result..[[ |
+ f1 |
+ f2 |
+ f3 |
+ |
+ {3:Press ENTER or type command to continue}^ |
+ ]])
+ end)
+
+ it('handles binary and multibyte data', function()
+ feed_command('!cat test/functional/fixtures/shell_data.txt')
+ screen.bell = false
+ screen:expect([[
+ |
+ {1:~ }|
+ {4: }|
+ :!cat test/functional/fixtures/shell_data.txt |
+ {2:^@^A^B^C^D^E^F^H} |
+ {2:^N^O^P^Q^R^S^T^U^V^W^X^Y^Z^[^\^]^^^_} |
+ ö 한글 {2:<a5><c3>} |
+ t {2:<ff>} |
+ |
+ {3:Press ENTER or type command to continue}^ |
+ ]], nil, nil, function()
+ eq(true, screen.bell)
+ end)
+ end)
+
+ it('handles multibyte sequences split over buffer boundaries', function()
+ command('cd '..nvim_dir)
+ local cmd
+ if iswin() then
+ cmd = '!shell-test UTF-8 '
+ else
+ cmd = '!./shell-test UTF-8'
+ end
+ feed_command(cmd)
+ -- Note: only the first example of split composed char works
+ screen:expect([[
+ |
+ {4: }|
+ :]]..cmd..[[ |
+ å |
+ ref: å̲ |
+ 1: å̲ |
+ 2: å ̲ |
+ 3: å ̲ |
+ |
+ {3:Press ENTER or type command to continue}^ |
+ ]])
+ end)
+ end)
+end)
diff --git a/test/functional/ui/screen.lua b/test/functional/ui/screen.lua
index a6b7fb2997..52e108f389 100644
--- a/test/functional/ui/screen.lua
+++ b/test/functional/ui/screen.lua
@@ -137,6 +137,7 @@ function Screen.new(width, height)
visual_bell = false,
suspended = false,
mode = 'normal',
+ options = {},
_default_attr_ids = nil,
_default_attr_ignore = nil,
_mouse_enabled = true,
@@ -176,6 +177,10 @@ function Screen:try_resize(columns, rows)
self:sleep(0.1)
end
+function Screen:set_option(option, value)
+ uimeths.set_option(option, value)
+end
+
-- Asserts that `expected` eventually matches the screen state.
--
-- expected: Expected screen state (string). Each line represents a screen
@@ -450,6 +455,9 @@ function Screen:_handle_visual_bell()
self.visual_bell = true
end
+function Screen:_handle_default_colors_set()
+end
+
function Screen:_handle_update_fg(fg)
self._fg = fg
end
@@ -478,6 +486,10 @@ function Screen:_handle_set_icon(icon)
self.icon = icon
end
+function Screen:_handle_option_set(name, value)
+ self.options[name] = value
+end
+
function Screen:_clear_block(top, bot, left, right)
for i = top, bot do
self:_clear_row_section(i, left, right)
diff --git a/test/functional/ui/screen_basic_spec.lua b/test/functional/ui/screen_basic_spec.lua
index b31d9cb32f..8a1f9b0d19 100644
--- a/test/functional/ui/screen_basic_spec.lua
+++ b/test/functional/ui/screen_basic_spec.lua
@@ -4,7 +4,6 @@ local spawn, set_session, clear = helpers.spawn, helpers.set_session, helpers.cl
local feed, command = helpers.feed, helpers.command
local insert = helpers.insert
local eq = helpers.eq
-local eval = helpers.eval
local iswin = helpers.iswin
describe('screen', function()
@@ -189,12 +188,12 @@ describe('Screen', function()
command('vsp')
command('vsp')
screen:expect([[
- ^ {3:|} {3:|} |
- {0:~ }{3:|}{0:~ }{3:|}{0:~ }|
- {0:~ }{3:|}{0:~ }{3:|}{0:~ }|
- {0:~ }{3:|}{0:~ }{3:|}{0:~ }|
- {0:~ }{3:|}{0:~ }{3:|}{0:~ }|
- {0:~ }{3:|}{0:~ }{3:|}{0:~ }|
+ ^ {3:│} {3:│} |
+ {0:~ }{3:│}{0:~ }{3:│}{0:~ }|
+ {0:~ }{3:│}{0:~ }{3:│}{0:~ }|
+ {0:~ }{3:│}{0:~ }{3:│}{0:~ }|
+ {0:~ }{3:│}{0:~ }{3:│}{0:~ }|
+ {0:~ }{3:│}{0:~ }{3:│}{0:~ }|
{1:[No Name] }{3:[No Name] [No Name] }|
|
{0:~ }|
@@ -206,12 +205,12 @@ describe('Screen', function()
]])
insert('hello')
screen:expect([[
- hell^o {3:|}hello {3:|}hello |
- {0:~ }{3:|}{0:~ }{3:|}{0:~ }|
- {0:~ }{3:|}{0:~ }{3:|}{0:~ }|
- {0:~ }{3:|}{0:~ }{3:|}{0:~ }|
- {0:~ }{3:|}{0:~ }{3:|}{0:~ }|
- {0:~ }{3:|}{0:~ }{3:|}{0:~ }|
+ hell^o {3:│}hello {3:│}hello |
+ {0:~ }{3:│}{0:~ }{3:│}{0:~ }|
+ {0:~ }{3:│}{0:~ }{3:│}{0:~ }|
+ {0:~ }{3:│}{0:~ }{3:│}{0:~ }|
+ {0:~ }{3:│}{0:~ }{3:│}{0:~ }|
+ {0:~ }{3:│}{0:~ }{3:│}{0:~ }|
{1:[No Name] [+] }{3:[No Name] [+] [No Name] [+] }|
hello |
{0:~ }|
@@ -232,12 +231,12 @@ describe('Screen', function()
command('vsp')
insert('hello')
screen:expect([[
- hell^o {3:|}hello {3:|}hello |
- {0:~ }{3:|}{0:~ }{3:|}{0:~ }|
- {0:~ }{3:|}{0:~ }{3:|}{0:~ }|
- {0:~ }{3:|}{0:~ }{3:|}{0:~ }|
- {0:~ }{3:|}{0:~ }{3:|}{0:~ }|
- {0:~ }{3:|}{0:~ }{3:|}{0:~ }|
+ hell^o {3:│}hello {3:│}hello |
+ {0:~ }{3:│}{0:~ }{3:│}{0:~ }|
+ {0:~ }{3:│}{0:~ }{3:│}{0:~ }|
+ {0:~ }{3:│}{0:~ }{3:│}{0:~ }|
+ {0:~ }{3:│}{0:~ }{3:│}{0:~ }|
+ {0:~ }{3:│}{0:~ }{3:│}{0:~ }|
{1:[No Name] [+] }{3:[No Name] [+] [No Name] [+] }|
hello |
{0:~ }|
@@ -269,12 +268,12 @@ describe('Screen', function()
command('tabprevious')
screen:expect([[
{2: }{6:4}{2:+ [No Name] }{4: + [No Name] }{3: }{4:X}|
- hell^o {3:|}hello {3:|}hello |
- {0:~ }{3:|}{0:~ }{3:|}{0:~ }|
- {0:~ }{3:|}{0:~ }{3:|}{0:~ }|
- {0:~ }{3:|}{0:~ }{3:|}{0:~ }|
- {0:~ }{3:|}{0:~ }{3:|}{0:~ }|
- {0:~ }{3:|}{0:~ }{3:|}{0:~ }|
+ hell^o {3:│}hello {3:│}hello |
+ {0:~ }{3:│}{0:~ }{3:│}{0:~ }|
+ {0:~ }{3:│}{0:~ }{3:│}{0:~ }|
+ {0:~ }{3:│}{0:~ }{3:│}{0:~ }|
+ {0:~ }{3:│}{0:~ }{3:│}{0:~ }|
+ {0:~ }{3:│}{0:~ }{3:│}{0:~ }|
{1:[No Name] [+] }{3:[No Name] [+] [No Name] [+] }|
hello |
{0:~ }|
@@ -355,7 +354,8 @@ describe('Screen', function()
]])
end)
- it('execute command with multi-line output', function()
+ it('execute command with multi-line output without msgsep', function()
+ command("set display-=msgsep")
feed(':ls<cr>')
screen:expect([[
{0:~ }|
@@ -375,6 +375,28 @@ describe('Screen', function()
]])
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")
+ feed(':ls<cr>')
+ screen:expect([[
+ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {1: }|
+ :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)
describe('scrolling and clearing', function()
@@ -398,12 +420,12 @@ describe('Screen', function()
command('vsp')
command('vsp')
screen:expect([[
- and {3:|}and {3:|}and |
- clearing {3:|}clearing {3:|}clearing |
- in {3:|}in {3:|}in |
- split {3:|}split {3:|}split |
- windows {3:|}windows {3:|}windows |
- ^ {3:|} {3:|} |
+ and {3:│}and {3:│}and |
+ clearing {3:│}clearing {3:│}clearing |
+ in {3:│}in {3:│}in |
+ split {3:│}split {3:│}split |
+ windows {3:│}windows {3:│}windows |
+ ^ {3:│} {3:│} |
{1:[No Name] [+] }{3:[No Name] [+] [No Name] [+] }|
clearing |
in |
@@ -418,12 +440,12 @@ describe('Screen', function()
it('only affects the current scroll region', function()
feed('6k')
screen:expect([[
- ^scrolling {3:|}and {3:|}and |
- and {3:|}clearing {3:|}clearing |
- clearing {3:|}in {3:|}in |
- in {3:|}split {3:|}split |
- split {3:|}windows {3:|}windows |
- windows {3:|} {3:|} |
+ ^scrolling {3:│}and {3:│}and |
+ and {3:│}clearing {3:│}clearing |
+ clearing {3:│}in {3:│}in |
+ in {3:│}split {3:│}split |
+ split {3:│}windows {3:│}windows |
+ windows {3:│} {3:│} |
{1:[No Name] [+] }{3:[No Name] [+] [No Name] [+] }|
clearing |
in |
@@ -435,12 +457,12 @@ describe('Screen', function()
]])
feed('<c-w>l')
screen:expect([[
- scrolling {3:|}and {3:|}and |
- and {3:|}clearing {3:|}clearing |
- clearing {3:|}in {3:|}in |
- in {3:|}split {3:|}split |
- split {3:|}windows {3:|}windows |
- windows {3:|}^ {3:|} |
+ scrolling {3:│}and {3:│}and |
+ and {3:│}clearing {3:│}clearing |
+ clearing {3:│}in {3:│}in |
+ in {3:│}split {3:│}split |
+ split {3:│}windows {3:│}windows |
+ windows {3:│}^ {3:│} |
{3:[No Name] [+] }{1:[No Name] [+] }{3:<Name] [+] }|
clearing |
in |
@@ -452,12 +474,12 @@ describe('Screen', function()
]])
feed('gg')
screen:expect([[
- scrolling {3:|}^Inserting {3:|}and |
- and {3:|}text {3:|}clearing |
- clearing {3:|}with {3:|}in |
- in {3:|}many {3:|}split |
- split {3:|}lines {3:|}windows |
- windows {3:|}to {3:|} |
+ scrolling {3:│}^Inserting {3:│}and |
+ and {3:│}text {3:│}clearing |
+ clearing {3:│}with {3:│}in |
+ in {3:│}many {3:│}split |
+ split {3:│}lines {3:│}windows |
+ windows {3:│}to {3:│} |
{3:[No Name] [+] }{1:[No Name] [+] }{3:<Name] [+] }|
clearing |
in |
@@ -469,12 +491,12 @@ describe('Screen', function()
]])
feed('7j')
screen:expect([[
- scrolling {3:|}with {3:|}and |
- and {3:|}many {3:|}clearing |
- clearing {3:|}lines {3:|}in |
- in {3:|}to {3:|}split |
- split {3:|}test {3:|}windows |
- windows {3:|}^scrolling {3:|} |
+ scrolling {3:│}with {3:│}and |
+ and {3:│}many {3:│}clearing |
+ clearing {3:│}lines {3:│}in |
+ in {3:│}to {3:│}split |
+ split {3:│}test {3:│}windows |
+ windows {3:│}^scrolling {3:│} |
{3:[No Name] [+] }{1:[No Name] [+] }{3:<Name] [+] }|
clearing |
in |
@@ -486,12 +508,12 @@ describe('Screen', function()
]])
feed('2j')
screen:expect([[
- scrolling {3:|}lines {3:|}and |
- and {3:|}to {3:|}clearing |
- clearing {3:|}test {3:|}in |
- in {3:|}scrolling {3:|}split |
- split {3:|}and {3:|}windows |
- windows {3:|}^clearing {3:|} |
+ scrolling {3:│}lines {3:│}and |
+ and {3:│}to {3:│}clearing |
+ clearing {3:│}test {3:│}in |
+ in {3:│}scrolling {3:│}split |
+ split {3:│}and {3:│}windows |
+ windows {3:│}^clearing {3:│} |
{3:[No Name] [+] }{1:[No Name] [+] }{3:<Name] [+] }|
clearing |
in |
@@ -503,12 +525,12 @@ describe('Screen', function()
]])
feed('5k')
screen:expect([[
- scrolling {3:|}^lines {3:|}and |
- and {3:|}to {3:|}clearing |
- clearing {3:|}test {3:|}in |
- in {3:|}scrolling {3:|}split |
- split {3:|}and {3:|}windows |
- windows {3:|}clearing {3:|} |
+ scrolling {3:│}^lines {3:│}and |
+ and {3:│}to {3:│}clearing |
+ clearing {3:│}test {3:│}in |
+ in {3:│}scrolling {3:│}split |
+ split {3:│}and {3:│}windows |
+ windows {3:│}clearing {3:│} |
{3:[No Name] [+] }{1:[No Name] [+] }{3:<Name] [+] }|
clearing |
in |
@@ -520,12 +542,12 @@ describe('Screen', function()
]])
feed('k')
screen:expect([[
- scrolling {3:|}^many {3:|}and |
- and {3:|}lines {3:|}clearing |
- clearing {3:|}to {3:|}in |
- in {3:|}test {3:|}split |
- split {3:|}scrolling {3:|}windows |
- windows {3:|}and {3:|} |
+ scrolling {3:│}^many {3:│}and |
+ and {3:│}lines {3:│}clearing |
+ clearing {3:│}to {3:│}in |
+ in {3:│}test {3:│}split |
+ split {3:│}scrolling {3:│}windows |
+ windows {3:│}and {3:│} |
{3:[No Name] [+] }{1:[No Name] [+] }{3:<Name] [+] }|
clearing |
in |
@@ -573,6 +595,7 @@ describe('Screen', function()
command('nnoremap <F1> :echo "TEST"<CR>')
feed(':ls<CR>')
screen:expect([[
+ |
{0:~ }|
{0:~ }|
{0:~ }|
@@ -582,8 +605,7 @@ describe('Screen', function()
{0:~ }|
{0:~ }|
{0:~ }|
- {0:~ }|
- {0:~ }|
+ {1: }|
:ls |
1 %a "[No Name]" line 1 |
{7:Press ENTER or type command to continue}^ |
@@ -608,21 +630,3 @@ describe('Screen', function()
end)
end)
end)
-
-describe('nvim_ui_attach()', function()
- before_each(function()
- clear()
- end)
- it('handles very large width/height #2180', function()
- local screen = Screen.new(999, 999)
- screen:attach()
- eq(999, eval('&lines'))
- eq(999, eval('&columns'))
- end)
- it('invalid option returns error', function()
- local screen = Screen.new()
- local status, rv = pcall(function() screen:attach({foo={'foo'}}) end)
- eq(false, status)
- eq('No such ui option', rv:match("No such .*"))
- end)
-end)
diff --git a/test/functional/ui/searchhl_spec.lua b/test/functional/ui/searchhl_spec.lua
index 11b18d015f..9f273e8dc9 100644
--- a/test/functional/ui/searchhl_spec.lua
+++ b/test/functional/ui/searchhl_spec.lua
@@ -2,8 +2,8 @@ local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
local feed_command = helpers.feed_command
-
-if helpers.pending_win32(pending) then return end
+local eq = helpers.eq
+local eval = helpers.eval
describe('search highlighting', function()
local screen
@@ -101,7 +101,30 @@ describe('search highlighting', function()
feed("gg/li")
screen:expect([[
the first {3:li}ne |
- in a little file |
+ in a {2:li}ttle file |
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ /li^ |
+ ]])
+
+ -- check that consecutive matches are caught by C-g/C-t
+ feed("<C-g>")
+ screen:expect([[
+ the first {2:li}ne |
+ in a {3:li}ttle file |
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ /li^ |
+ ]])
+
+ feed("<C-t>")
+ screen:expect([[
+ the first {3:li}ne |
+ in a {2:li}ttle file |
|
{1:~ }|
{1:~ }|
@@ -134,7 +157,7 @@ describe('search highlighting', function()
feed("/fir")
screen:expect([[
the {3:fir}st line |
- in a {2:lit}tle file |
+ in a little file |
|
{1:~ }|
{1:~ }|
@@ -146,13 +169,107 @@ describe('search highlighting', function()
feed("<esc>/ttle")
screen:expect([[
the first line |
- in a {2:li}{3:ttle} file |
+ in a li{3:ttle} file |
|
{1:~ }|
{1:~ }|
{1:~ }|
/ttle^ |
]])
+
+ -- cancelling search resets to the old search term
+ feed('<esc>')
+ screen:expect([[
+ the first line |
+ in a {2:^lit}tle file |
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]])
+ eq('lit', eval('@/'))
+
+ -- cancelling inc search restores the hl state
+ feed(':noh<cr>')
+ screen:expect([[
+ the first line |
+ in a ^little file |
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ :noh |
+ ]])
+
+ feed('/first')
+ screen:expect([[
+ the {3:first} line |
+ in a little file |
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ /first^ |
+ ]])
+ feed('<esc>')
+ screen:expect([[
+ the first line |
+ in a ^little file |
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]])
+
+ -- test that pressing C-g in an empty command line does not move the cursor
+ feed('/<C-g>')
+ screen:expect([[
+ the first line |
+ in a little file |
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ /^ |
+ ]])
+
+ -- same, for C-t
+ feed('<ESC>/<C-t>')
+ screen:expect([[
+ the first line |
+ in a little file |
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ /^ |
+ ]])
+
+ -- 8.0.1304, test that C-g and C-t works with incsearch and empty pattern
+ feed('<esc>/fi<CR>')
+ feed('//')
+ screen:expect([[
+ the {3:fi}rst line |
+ in a little {2:fi}le |
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ //^ |
+ ]])
+
+ feed('<C-g>')
+ screen:expect([[
+ the {2:fi}rst line |
+ in a little {3:fi}le |
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ //^ |
+ ]])
end)
it('works with incsearch and offset', function()
@@ -165,7 +282,7 @@ describe('search highlighting', function()
feed("gg/mat/e")
screen:expect([[
not the {3:mat}ch you're looking for |
- the match is here |
+ the {2:mat}ch is here |
{1:~ }|
{1:~ }|
{1:~ }|
@@ -176,7 +293,7 @@ describe('search highlighting', function()
-- Search with count and /e offset fixed in Vim patch 7.4.532.
feed("<esc>2/mat/e")
screen:expect([[
- not the match you're looking for |
+ not the {2:mat}ch you're looking for |
the {3:mat}ch is here |
{1:~ }|
{1:~ }|
diff --git a/test/functional/ui/sign_spec.lua b/test/functional/ui/sign_spec.lua
index e5c96f2ec0..c00d99cf90 100644
--- a/test/functional/ui/sign_spec.lua
+++ b/test/functional/ui/sign_spec.lua
@@ -2,8 +2,6 @@ local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local clear, feed, command = helpers.clear, helpers.feed, helpers.command
-if helpers.pending_win32(pending) then return end
-
describe('Signs', function()
local screen
diff --git a/test/functional/ui/spell_spec.lua b/test/functional/ui/spell_spec.lua
new file mode 100644
index 0000000000..913f1b9bed
--- /dev/null
+++ b/test/functional/ui/spell_spec.lua
@@ -0,0 +1,49 @@
+-- Test for scenarios involving 'spell'
+
+local helpers = require('test.functional.helpers')(after_each)
+local Screen = require('test.functional.ui.screen')
+local clear = helpers.clear
+local feed = helpers.feed
+local feed_command = helpers.feed_command
+local insert = helpers.insert
+
+describe("'spell'", function()
+ local screen
+
+ before_each(function()
+ clear()
+ screen = Screen.new(80, 8)
+ screen:attach()
+ screen:set_default_attr_ids( {
+ [0] = {bold=true, foreground=Screen.colors.Blue},
+ [1] = {special = Screen.colors.Red, undercurl = true}
+ })
+ end)
+
+ after_each(function()
+ screen:detach()
+ end)
+
+ it('joins long lines #7937', function()
+ feed_command('set spell')
+ insert([[
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
+ tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
+ quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
+ consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
+ cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat
+ non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
+ ]])
+ feed('ggJJJJJJ0')
+ screen:expect([[
+ {1:^Lorem} {1:ipsum} dolor sit {1:amet}, {1:consectetur} {1:adipiscing} {1:elit}, {1:sed} do {1:eiusmod} {1:tempor} {1:i}|
+ {1:ncididunt} {1:ut} {1:labore} {1:et} {1:dolore} {1:magna} {1:aliqua}. {1:Ut} {1:enim} ad minim {1:veniam}, {1:quis} {1:nostru}|
+ {1:d} {1:exercitation} {1:ullamco} {1:laboris} {1:nisi} {1:ut} {1:aliquip} ex ea {1:commodo} {1:consequat}. {1:Duis} {1:aut}|
+ {1:e} {1:irure} dolor in {1:reprehenderit} in {1:voluptate} {1:velit} {1:esse} {1:cillum} {1:dolore} {1:eu} {1:fugiat} {1:n}|
+ {1:ulla} {1:pariatur}. {1:Excepteur} {1:sint} {1:occaecat} {1:cupidatat} non {1:proident}, {1:sunt} in culpa {1:qui}|
+ {1:officia} {1:deserunt} {1:mollit} {1:anim} id est {1:laborum}. |
+ {0:~ }|
+ |
+ ]])
+ end)
+end)
diff --git a/test/functional/ui/syntax_conceal_spec.lua b/test/functional/ui/syntax_conceal_spec.lua
index 28a104360d..e7a7004c1e 100644
--- a/test/functional/ui/syntax_conceal_spec.lua
+++ b/test/functional/ui/syntax_conceal_spec.lua
@@ -3,8 +3,6 @@ local Screen = require('test.functional.ui.screen')
local clear, feed, command = helpers.clear, helpers.feed, helpers.command
local insert = helpers.insert
-if helpers.pending_win32(pending) then return end
-
describe('Screen', function()
local screen
diff --git a/test/functional/ui/wildmode_spec.lua b/test/functional/ui/wildmode_spec.lua
index 042969357e..c6ddc78618 100644
--- a/test/functional/ui/wildmode_spec.lua
+++ b/test/functional/ui/wildmode_spec.lua
@@ -60,8 +60,7 @@ describe("'wildmenu'", function()
command('set wildmenu wildmode=full')
command('set scrollback=4')
if iswin() then
- if helpers.pending_win32(pending) then return end
- -- feed([[:terminal 1,2,3,4,5 | foreach-object -process {echo $_; sleep 0.1}]])
+ feed([[:terminal for /L \%I in (1,1,5000) do @(echo foo & echo foo & echo foo)<cr>]])
else
feed([[:terminal for i in $(seq 1 5000); do printf 'foo\nfoo\nfoo\n'; sleep 0.1; done<cr>]])
end