aboutsummaryrefslogtreecommitdiff
path: root/test/functional/editor
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2025-02-05 23:09:29 +0000
committerJosh Rahm <joshuarahm@gmail.com>2025-02-05 23:09:29 +0000
commitd5f194ce780c95821a855aca3c19426576d28ae0 (patch)
treed45f461b19f9118ad2bb1f440a7a08973ad18832 /test/functional/editor
parentc5d770d311841ea5230426cc4c868e8db27300a8 (diff)
parent44740e561fc93afe3ebecfd3618bda2d2abeafb0 (diff)
downloadrneovim-rahm.tar.gz
rneovim-rahm.tar.bz2
rneovim-rahm.zip
Merge remote-tracking branch 'upstream/master' into mix_20240309HEADrahm
Diffstat (limited to 'test/functional/editor')
-rw-r--r--test/functional/editor/completion_spec.lua69
-rw-r--r--test/functional/editor/defaults_spec.lua99
-rw-r--r--test/functional/editor/mode_normal_spec.lua8
3 files changed, 160 insertions, 16 deletions
diff --git a/test/functional/editor/completion_spec.lua b/test/functional/editor/completion_spec.lua
index 030181764d..7c68de272b 100644
--- a/test/functional/editor/completion_spec.lua
+++ b/test/functional/editor/completion_spec.lua
@@ -10,6 +10,7 @@ local fn = n.fn
local command = n.command
local api = n.api
local poke_eventloop = n.poke_eventloop
+local exec_lua = n.exec_lua
describe('completion', function()
local screen
@@ -1023,18 +1024,18 @@ describe('completion', function()
it("'ignorecase' 'infercase' CTRL-X CTRL-N #6451", function()
feed_command('set ignorecase infercase')
- feed_command('edit runtime/doc/backers.txt')
+ feed_command('edit runtime/doc/credits.txt')
feed('oX<C-X><C-N>')
screen:expect {
grid = [[
- *backers.txt* Nvim |
- Xnull^ |
- {12:Xnull }{101: } |
- {4:Xoxomoon }{101: } |
- {4:Xu }{101: } NVIM REFERENCE MANUAL |
- {4:Xpayn }{12: } |
- {4:Xinity }{12: } |
- {5:-- Keyword Local completion (^N^P) }{6:match 1 of 7} |
+ *credits.txt* Nvim |
+ Xvi^ |
+ {12:Xvi }{101: } |
+ {4:Xvim }{101: } |
+ {4:X11 }{12: } NVIM REFERENCE MANUAL |
+ {4:Xnull }{12: } |
+ {4:Xoxomoon }{12: } |
+ {5:-- Keyword Local completion (^N^P) }{6:match 1 of 10} |
]],
}
end)
@@ -1265,7 +1266,7 @@ describe('completion', function()
command([[
call setline(1, ['aaaa'])
let ns_id = nvim_create_namespace('extmark')
- let mark_id = nvim_buf_set_extmark(0, ns_id, 0, 0, { 'end_col':2, 'hl_group':'Error'})
+ let mark_id = nvim_buf_set_extmark(0, ns_id, 0, 0, { 'end_col':2, 'hl_group':'Error' })
let mark = nvim_buf_get_extmark_by_id(0, ns_id, mark_id, { 'details':1 })
inoremap <C-x> <C-r>=Complete()<CR>
function Complete() abort
@@ -1302,5 +1303,53 @@ describe('completion', function()
aaaaa |
{5:-- INSERT --} |
]])
+ -- Also when completion leader is changed #31384
+ feed('<Esc>hi<C-N><C-P>a')
+ screen:expect({
+ grid = [[
+ {9:aa}a^aa |
+ {4:aaaa } |
+ {4:aaaaa } |
+ {5:-- Keyword completion (^N^P) }{19:Back at original} |
+ ]],
+ })
+ -- But still grows with end_right_gravity #31437
+ command(
+ "call nvim_buf_set_extmark(0, ns_id, 1, 0, { 'end_col':2, 'hl_group':'Error', 'end_right_gravity': 1 })"
+ )
+ feed('<Esc>ji<C-N>a')
+ screen:expect({
+ grid = [[
+ {9:aa}aaa |
+ {9:aaa}^aa |
+ aaaaa |
+ {5:-- INSERT --} |
+ ]],
+ })
+ end)
+
+ describe('nvim__complete_set', function()
+ it("fails when 'completeopt' does not include popup", function()
+ exec_lua([[
+ function _G.omni_test(findstart, base)
+ if findstart == 1 then
+ return vim.fn.col('.') - 1
+ end
+ return { { word = 'one' } }
+ end
+ vim.api.nvim_create_autocmd('CompleteChanged', {
+ callback = function()
+ local ok, err = pcall(vim.api.nvim__complete_set, 0, { info = '1info' })
+ if not ok then
+ vim.g.err_msg = err
+ end
+ end,
+ })
+ vim.opt.completeopt = 'menu,menuone'
+ vim.opt.omnifunc = 'v:lua.omni_test'
+ ]])
+ feed('S<C-X><C-O>')
+ eq('completeopt option does not include popup', api.nvim_get_var('err_msg'))
+ end)
end)
end)
diff --git a/test/functional/editor/defaults_spec.lua b/test/functional/editor/defaults_spec.lua
index 82d285cc9a..ee6bfa1be9 100644
--- a/test/functional/editor/defaults_spec.lua
+++ b/test/functional/editor/defaults_spec.lua
@@ -32,7 +32,7 @@ describe('default', function()
describe('popupmenu', function()
it('can be disabled by user', function()
n.clear {
- args = { '+autocmd! nvim_popupmenu', '+aunmenu PopUp' },
+ args = { '+autocmd! nvim.popupmenu', '+aunmenu PopUp' },
}
local screen = Screen.new(40, 8)
n.insert([[
@@ -94,8 +94,103 @@ describe('default', function()
end)
describe('key mappings', function()
+ describe('Visual mode search mappings', function()
+ it('handle various chars properly', function()
+ n.clear({ args_rm = { '--cmd' } })
+ local screen = Screen.new(60, 8)
+ screen:set_default_attr_ids({
+ [1] = { foreground = Screen.colors.NvimDarkGray4 },
+ [2] = {
+ foreground = Screen.colors.NvimDarkGray3,
+ background = Screen.colors.NvimLightGray3,
+ },
+ [3] = {
+ foreground = Screen.colors.NvimLightGrey1,
+ background = Screen.colors.NvimDarkYellow,
+ },
+ [4] = {
+ foreground = Screen.colors.NvimDarkGrey1,
+ background = Screen.colors.NvimLightYellow,
+ },
+ })
+ n.api.nvim_buf_set_lines(0, 0, -1, true, {
+ [[testing <CR> /?\!1]],
+ [[testing <CR> /?\!2]],
+ [[testing <CR> /?\!3]],
+ [[testing <CR> /?\!4]],
+ })
+ n.feed('gg0vf!o*')
+ screen:expect([[
+ {3:testing <CR> /?\!}1 |
+ {4:^testing <CR> /?\!}2 |
+ {3:testing <CR> /?\!}3 |
+ {3:testing <CR> /?\!}4 |
+ {1:~ }|*2
+ {2:[No Name] [+] 2,1 All}|
+ /\Vtesting <CR> \/?\\! [2/4] |
+ ]])
+ n.feed('n')
+ screen:expect([[
+ {3:testing <CR> /?\!}1 |
+ {3:testing <CR> /?\!}2 |
+ {4:^testing <CR> /?\!}3 |
+ {3:testing <CR> /?\!}4 |
+ {1:~ }|*2
+ {2:[No Name] [+] 3,1 All}|
+ /\Vtesting <CR> \/?\\! [3/4] |
+ ]])
+ n.feed('G0vf!o#')
+ screen:expect([[
+ {3:testing <CR> /?\!}1 |
+ {3:testing <CR> /?\!}2 |
+ {4:^testing <CR> /?\!}3 |
+ {3:testing <CR> /?\!}4 |
+ {1:~ }|*2
+ {2:[No Name] [+] 3,1 All}|
+ ?\Vtesting <CR> /?\\! [3/4] |
+ ]])
+ n.feed('n')
+ screen:expect([[
+ {3:testing <CR> /?\!}1 |
+ {4:^testing <CR> /?\!}2 |
+ {3:testing <CR> /?\!}3 |
+ {3:testing <CR> /?\!}4 |
+ {1:~ }|*2
+ {2:[No Name] [+] 2,1 All}|
+ ?\Vtesting <CR> /?\\! [2/4] |
+ ]])
+ end)
+ end)
+
describe('unimpaired-style mappings', function()
- it('do not show a full stack trace #30625', function()
+ it('show the command ouptut when successful', function()
+ n.clear({ args_rm = { '--cmd' } })
+ local screen = Screen.new(40, 8)
+ n.fn.setqflist({
+ { filename = 'file1', text = 'item1' },
+ { filename = 'file2', text = 'item2' },
+ })
+
+ n.feed(']q')
+
+ screen:set_default_attr_ids({
+ [1] = { foreground = Screen.colors.NvimDarkGrey4 },
+ [2] = {
+ background = Screen.colors.NvimLightGray3,
+ foreground = Screen.colors.NvimDarkGrey3,
+ },
+ })
+ screen:expect({
+ grid = [[
+ ^ |
+ {1:~ }|*5
+ {2:file2 0,0-1 All}|
+ (2 of 2): item2 |
+ ]],
+ })
+ end)
+
+ it('do not show a full stack trace when unsuccessful #30625', function()
n.clear({ args_rm = { '--cmd' } })
local screen = Screen.new(40, 8)
screen:set_default_attr_ids({
diff --git a/test/functional/editor/mode_normal_spec.lua b/test/functional/editor/mode_normal_spec.lua
index 5237f51237..353a261edb 100644
--- a/test/functional/editor/mode_normal_spec.lua
+++ b/test/functional/editor/mode_normal_spec.lua
@@ -26,10 +26,10 @@ describe('Normal mode', function()
it('&showcmd does not crash with :startinsert #28419', function()
local screen = Screen.new(60, 17)
- fn.termopen(
- { n.nvim_prog, '--clean', '--cmd', 'startinsert' },
- { env = { VIMRUNTIME = os.getenv('VIMRUNTIME') } }
- )
+ fn.jobstart({ n.nvim_prog, '--clean', '--cmd', 'startinsert' }, {
+ term = true,
+ env = { VIMRUNTIME = os.getenv('VIMRUNTIME') },
+ })
screen:expect({
grid = [[
^ |