diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2024-11-25 19:15:05 +0000 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2024-11-25 19:27:38 +0000 |
commit | c5d770d311841ea5230426cc4c868e8db27300a8 (patch) | |
tree | dd21f70127b4b8b5f109baefc8ecc5016f507c91 /test/functional/editor | |
parent | 9be89f131f87608f224f0ee06d199fcd09d32176 (diff) | |
parent | 081beb3659bd6d8efc3e977a160b1e72becbd8a2 (diff) | |
download | rneovim-c5d770d311841ea5230426cc4c868e8db27300a8.tar.gz rneovim-c5d770d311841ea5230426cc4c868e8db27300a8.tar.bz2 rneovim-c5d770d311841ea5230426cc4c868e8db27300a8.zip |
Merge remote-tracking branch 'upstream/master' into mix_20240309
Diffstat (limited to 'test/functional/editor')
-rw-r--r-- | test/functional/editor/completion_spec.lua | 1 | ||||
-rw-r--r-- | test/functional/editor/ctrl_c_spec.lua | 1 | ||||
-rw-r--r-- | test/functional/editor/defaults_spec.lua | 157 | ||||
-rw-r--r-- | test/functional/editor/jump_spec.lua | 6 | ||||
-rw-r--r-- | test/functional/editor/mark_spec.lua | 4 | ||||
-rw-r--r-- | test/functional/editor/mode_cmdline_spec.lua | 21 | ||||
-rw-r--r-- | test/functional/editor/mode_insert_spec.lua | 24 | ||||
-rw-r--r-- | test/functional/editor/mode_normal_spec.lua | 20 | ||||
-rw-r--r-- | test/functional/editor/put_spec.lua | 1 | ||||
-rw-r--r-- | test/functional/editor/tabpage_spec.lua | 1 |
10 files changed, 199 insertions, 37 deletions
diff --git a/test/functional/editor/completion_spec.lua b/test/functional/editor/completion_spec.lua index d543de4acd..030181764d 100644 --- a/test/functional/editor/completion_spec.lua +++ b/test/functional/editor/completion_spec.lua @@ -17,7 +17,6 @@ describe('completion', function() before_each(function() clear() screen = Screen.new(60, 8) - screen:attach() screen:add_extra_attr_ids { [100] = { foreground = Screen.colors.Gray0, background = Screen.colors.Yellow }, [101] = { background = Screen.colors.Gray0 }, diff --git a/test/functional/editor/ctrl_c_spec.lua b/test/functional/editor/ctrl_c_spec.lua index e1258c7df8..cb6bc57681 100644 --- a/test/functional/editor/ctrl_c_spec.lua +++ b/test/functional/editor/ctrl_c_spec.lua @@ -13,7 +13,6 @@ describe('CTRL-C (mapped)', function() before_each(function() clear() screen = Screen.new(52, 6) - screen:attach() end) it('interrupts :global', function() diff --git a/test/functional/editor/defaults_spec.lua b/test/functional/editor/defaults_spec.lua index 47fd177f7b..82d285cc9a 100644 --- a/test/functional/editor/defaults_spec.lua +++ b/test/functional/editor/defaults_spec.lua @@ -35,7 +35,6 @@ describe('default', function() args = { '+autocmd! nvim_popupmenu', '+aunmenu PopUp' }, } local screen = Screen.new(40, 8) - screen:attach() n.insert([[ 1 line 1 2 https://example.com @@ -58,7 +57,6 @@ describe('default', function() it('right-click on URL shows "Open in web browser"', function() n.clear() local screen = Screen.new(40, 8) - screen:attach() n.insert([[ 1 line 1 2 https://example.com @@ -95,6 +93,157 @@ describe('default', function() end) end) - -- describe('key mappings', function() - -- end) + describe('key mappings', function() + describe('unimpaired-style mappings', function() + it('do not show a full stack trace #30625', function() + n.clear({ args_rm = { '--cmd' } }) + local screen = Screen.new(40, 8) + screen:set_default_attr_ids({ + [1] = { foreground = Screen.colors.NvimDarkGray4 }, + [2] = { + background = Screen.colors.NvimLightGrey3, + foreground = Screen.colors.NvimDarkGray3, + }, + [3] = { foreground = Screen.colors.NvimLightRed }, + [4] = { foreground = Screen.colors.NvimLightCyan }, + }) + + n.feed('[a') + screen:expect({ + grid = [[ + | + {1:~ }|*4 + {2: }| + {3:E163: There is only one file to edit} | + {4:Press ENTER or type command to continue}^ | + ]], + }) + + n.feed('[q') + screen:expect({ + grid = [[ + ^ | + {1:~ }|*5 + {2:[No Name] 0,0-1 All}| + {3:E42: No Errors} | + ]], + }) + + n.feed('[l') + screen:expect({ + grid = [[ + ^ | + {1:~ }|*5 + {2:[No Name] 0,0-1 All}| + {3:E776: No location list} | + ]], + }) + + n.feed('[t') + screen:expect({ + grid = [[ + ^ | + {1:~ }|*5 + {2:[No Name] 0,0-1 All}| + {3:E73: Tag stack empty} | + ]], + }) + end) + + describe('[<Space>', function() + it('adds an empty line above the current line', function() + n.clear({ args_rm = { '--cmd' } }) + n.insert([[first line]]) + n.feed('[<Space>') + n.expect([[ + + first line]]) + end) + + it('works with a count', function() + n.clear({ args_rm = { '--cmd' } }) + n.insert([[first line]]) + n.feed('5[<Space>') + n.expect([[ + + + + + + first line]]) + end) + + it('supports dot repetition', function() + n.clear({ args_rm = { '--cmd' } }) + n.insert([[first line]]) + n.feed('[<Space>') + n.feed('.') + n.expect([[ + + + first line]]) + end) + + it('supports dot repetition and a count', function() + n.clear({ args_rm = { '--cmd' } }) + n.insert([[first line]]) + n.feed('[<Space>') + n.feed('3.') + n.expect([[ + + + + + first line]]) + end) + end) + + describe(']<Space>', function() + it('adds an empty line below the current line', function() + n.clear({ args_rm = { '--cmd' } }) + n.insert([[first line]]) + n.feed(']<Space>') + n.expect([[ + first line + ]]) + end) + + it('works with a count', function() + n.clear({ args_rm = { '--cmd' } }) + n.insert([[first line]]) + n.feed('5]<Space>') + n.expect([[ + first line + + + + + ]]) + end) + + it('supports dot repetition', function() + n.clear({ args_rm = { '--cmd' } }) + n.insert([[first line]]) + n.feed(']<Space>') + n.feed('.') + n.expect([[ + first line + + ]]) + end) + + it('supports dot repetition and a count', function() + n.clear({ args_rm = { '--cmd' } }) + n.insert([[first line]]) + n.feed(']<Space>') + n.feed('2.') + n.expect([[ + first line + + + ]]) + end) + end) + end) + end) end) diff --git a/test/functional/editor/jump_spec.lua b/test/functional/editor/jump_spec.lua index ab4cefaf84..dab8fb3fda 100644 --- a/test/functional/editor/jump_spec.lua +++ b/test/functional/editor/jump_spec.lua @@ -56,7 +56,6 @@ describe('jumplist', function() write_file(fname2, 'baz') local screen = Screen.new(5, 25) - screen:attach() command('set number') command('edit ' .. fname1) feed('35gg') @@ -386,7 +385,6 @@ describe('jumpoptions=view', function() it('restores the view', function() local screen = Screen.new(5, 8) - screen:attach() command('edit ' .. file1) feed('12Gztj') feed('gg<C-o>') @@ -404,7 +402,6 @@ describe('jumpoptions=view', function() it('restores the view across files', function() local screen = Screen.new(5, 5) - screen:attach() command('args ' .. file1 .. ' ' .. file2) feed('12Gzt') command('next') @@ -428,7 +425,6 @@ describe('jumpoptions=view', function() it('restores the view across files with <C-^>', function() local screen = Screen.new(5, 5) - screen:attach() command('args ' .. file1 .. ' ' .. file2) feed('12Gzt') command('next') @@ -452,7 +448,6 @@ describe('jumpoptions=view', function() it("falls back to standard behavior when view can't be recovered", function() local screen = Screen.new(5, 8) - screen:attach() command('edit ' .. file1) feed('7GzbG') api.nvim_buf_set_lines(0, 0, 2, true, {}) @@ -477,7 +472,6 @@ describe('jumpoptions=view', function() it('falls back to standard behavior for a mark without a view', function() local screen = Screen.new(5, 8) - screen:attach() command('edit ' .. file1) feed('10ggzzvwy') screen:expect([[ diff --git a/test/functional/editor/mark_spec.lua b/test/functional/editor/mark_spec.lua index 69cb95e1c3..08f90b088d 100644 --- a/test/functional/editor/mark_spec.lua +++ b/test/functional/editor/mark_spec.lua @@ -348,7 +348,6 @@ describe('named marks view', function() it('is restored in normal mode but not op-pending mode', function() local screen = Screen.new(5, 8) - screen:attach() command('edit ' .. file1) feed('<C-e>jWma') feed("G'a") @@ -390,7 +389,6 @@ describe('named marks view', function() it('is restored across files', function() local screen = Screen.new(5, 5) - screen:attach() command('args ' .. file1 .. ' ' .. file2) feed('<C-e>mA') local mark_view = [[ @@ -415,7 +413,6 @@ describe('named marks view', function() it("fallback to standard behavior when view can't be recovered", function() local screen = Screen.new(10, 10) - screen:attach() command('edit ' .. file1) feed('7GzbmaG') -- Seven lines from the top command('new') -- Screen size for window is now half the height can't be restored @@ -434,7 +431,6 @@ describe('named marks view', function() it('fallback to standard behavior when mark is loaded from shada', function() local screen = Screen.new(10, 6) - screen:attach() command('edit ' .. file1) feed('G') feed('mA') diff --git a/test/functional/editor/mode_cmdline_spec.lua b/test/functional/editor/mode_cmdline_spec.lua index efd7a37c0b..52f2bf7f8c 100644 --- a/test/functional/editor/mode_cmdline_spec.lua +++ b/test/functional/editor/mode_cmdline_spec.lua @@ -38,6 +38,26 @@ describe('cmdline', function() feed([[:<C-R>="foo\nbar\rbaz"<CR>]]) eq('foo\nbar\rbaz', fn.getcmdline()) end) + + it('pasting handles composing chars properly', function() + local screen = Screen.new(60, 4) + -- 'arabicshape' cheats and always redraws everything which trivially works, + -- this test is for partial redraws in 'noarabicshape' mode. + command('set noarabicshape') + fn.setreg('a', 'π»') + feed(':test π§β') + screen:expect([[ + | + {1:~ }|*2 + :test π§β^ | + ]]) + feed('<c-r><c-r>a') + screen:expect([[ + | + {1:~ }|*2 + :test π§βπ»^ | + ]]) + end) end) it('Ctrl-Shift-V supports entering unsimplified key notations', function() @@ -48,7 +68,6 @@ describe('cmdline', function() it('redraws statusline when toggling overstrike', function() local screen = Screen.new(60, 4) - screen:attach() command('set laststatus=2 statusline=%!mode(1)') feed(':') screen:expect { diff --git a/test/functional/editor/mode_insert_spec.lua b/test/functional/editor/mode_insert_spec.lua index 87d5c46134..a9fa93590f 100644 --- a/test/functional/editor/mode_insert_spec.lua +++ b/test/functional/editor/mode_insert_spec.lua @@ -55,7 +55,6 @@ describe('insert-mode', function() it('double quote is removed after hit-enter prompt #22609', function() local screen = Screen.new(50, 6) - screen:attach() feed('i<C-R>') screen:expect([[ {18:^"} | @@ -180,7 +179,6 @@ describe('insert-mode', function() it('multi-char mapping updates screen properly #25626', function() local screen = Screen.new(60, 6) - screen:attach() command('vnew') insert('foo\nfoo\nfoo') command('wincmd w') @@ -228,8 +226,7 @@ describe('insert-mode', function() end it('works with tabs and spaces', function() - local screen = Screen.new(30, 2) - screen:attach() + local _ = Screen.new(30, 2) command('setl ts=4 sw=4') set_lines(0, 1, '\t' .. s(4) .. '\t' .. s(9) .. '\t a') feed('$i') @@ -246,8 +243,7 @@ describe('insert-mode', function() end) it('works with varsofttabstop', function() - local screen = Screen.new(30, 2) - screen:attach() + local _ = Screen.new(30, 2) command('setl vsts=6,2,5,3') set_lines(0, 1, 'a\t' .. s(4) .. '\t a') feed('$i') @@ -263,8 +259,7 @@ describe('insert-mode', function() end) it('works with tab as ^I', function() - local screen = Screen.new(30, 2) - screen:attach() + local _ = Screen.new(30, 2) command('set list listchars=space:.') command('setl ts=4 sw=4') set_lines(0, 1, '\t' .. s(4) .. '\t' .. s(9) .. '\t a') @@ -280,8 +275,7 @@ describe('insert-mode', function() end) it('works in replace mode', function() - local screen = Screen.new(50, 2) - screen:attach() + local _ = Screen.new(50, 2) command('setl ts=8 sw=8 sts=8') set_lines(0, 1, '\t' .. s(4) .. '\t' .. s(9) .. '\t a') feed('$R') @@ -296,8 +290,7 @@ describe('insert-mode', function() end) it('works with breakindent', function() - local screen = Screen.new(17, 4) - screen:attach() + local _ = Screen.new(17, 4) command('setl ts=4 sw=4 bri briopt=min:5') set_lines(0, 1, '\t' .. s(4) .. '\t' .. s(9) .. '\t a') feed('$i') @@ -314,8 +307,7 @@ describe('insert-mode', function() end) it('works with inline virtual text', function() - local screen = Screen.new(50, 2) - screen:attach() + local _ = Screen.new(50, 2) command('setl ts=4 sw=4') set_lines(0, 1, '\t' .. s(4) .. '\t' .. s(9) .. '\t a') local ns = api.nvim_create_namespace('') @@ -335,8 +327,7 @@ describe('insert-mode', function() end) it("works with 'revins'", function() - local screen = Screen.new(30, 3) - screen:attach() + local _ = Screen.new(30, 3) command('setl ts=4 sw=4 revins') set_lines(0, 1, ('a'):rep(16), s(3) .. '\t' .. s(4) .. '\t a') feed('j$i') @@ -354,7 +345,6 @@ describe('insert-mode', function() it('backspace after replacing multibyte chars', function() local screen = Screen.new(30, 3) - screen:attach() api.nvim_buf_set_lines(0, 0, -1, true, { 'test aΜΜΜΜΜΜ
mΜΜΜΜΜΜ Γ₯' }) feed('^Rabcdefghi') screen:expect([[ diff --git a/test/functional/editor/mode_normal_spec.lua b/test/functional/editor/mode_normal_spec.lua index b3ef4866dc..5237f51237 100644 --- a/test/functional/editor/mode_normal_spec.lua +++ b/test/functional/editor/mode_normal_spec.lua @@ -9,6 +9,7 @@ local feed = n.feed local fn = n.fn local command = n.command local eq = t.eq +local api = n.api describe('Normal mode', function() before_each(clear) @@ -25,7 +26,6 @@ describe('Normal mode', function() it('&showcmd does not crash with :startinsert #28419', function() local screen = Screen.new(60, 17) - screen:attach() fn.termopen( { n.nvim_prog, '--clean', '--cmd', 'startinsert' }, { env = { VIMRUNTIME = os.getenv('VIMRUNTIME') } } @@ -41,4 +41,22 @@ describe('Normal mode', function() attr_ids = {}, }) end) + + it('replacing with ZWJ emoji sequences', function() + local screen = Screen.new(30, 8) + api.nvim_buf_set_lines(0, 0, -1, true, { 'abcdefg' }) + feed('05rπ§βπΎ') -- ZWJ + screen:expect([[ + π§βπΎπ§βπΎπ§βπΎπ§βπΎ^π§βπΎfg | + {1:~ }|*6 + | + ]]) + + feed('2rπ³οΈββ§οΈ') -- ZWJ and variant selectors + screen:expect([[ + π§βπΎπ§βπΎπ§βπΎπ§βπΎπ³οΈββ§οΈ^π³οΈββ§οΈg | + {1:~ }|*6 + | + ]]) + end) end) diff --git a/test/functional/editor/put_spec.lua b/test/functional/editor/put_spec.lua index 0f6936cd31..79f9d97bc5 100644 --- a/test/functional/editor/put_spec.lua +++ b/test/functional/editor/put_spec.lua @@ -883,7 +883,6 @@ describe('put command', function() local screen setup(function() screen = Screen.new() - screen:attach() end) local function bell_test(actions, should_ring) diff --git a/test/functional/editor/tabpage_spec.lua b/test/functional/editor/tabpage_spec.lua index c20a6e5cb5..b6fbebb20c 100644 --- a/test/functional/editor/tabpage_spec.lua +++ b/test/functional/editor/tabpage_spec.lua @@ -105,7 +105,6 @@ describe('tabpage', function() screen:add_extra_attr_ids { [100] = { bold = true, foreground = Screen.colors.Fuchsia }, } - screen:attach() command('tabnew') command('tabprev') |