aboutsummaryrefslogtreecommitdiff
path: root/test/functional/legacy
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/legacy')
-rw-r--r--test/functional/legacy/conceal_spec.lua269
-rw-r--r--test/functional/legacy/matchparen_spec.lua43
-rw-r--r--test/functional/legacy/memory_usage_spec.lua2
3 files changed, 309 insertions, 5 deletions
diff --git a/test/functional/legacy/conceal_spec.lua b/test/functional/legacy/conceal_spec.lua
index 9a23d16c5b..e2cc3b23df 100644
--- a/test/functional/legacy/conceal_spec.lua
+++ b/test/functional/legacy/conceal_spec.lua
@@ -4,6 +4,7 @@ local clear = helpers.clear
local command = helpers.command
local exec = helpers.exec
local feed = helpers.feed
+local api = helpers.api
local expect_pos = function(row, col)
return helpers.eq({ row, col }, helpers.eval('[screenrow(), screencol()]'))
@@ -433,6 +434,68 @@ describe('Conceal', function()
]])
end)
+ -- oldtest: Test_conceal_wrapped_cursorline_wincolor()
+ it('CursorLine highlight on wrapped lines', function()
+ local screen = Screen.new(40, 4)
+ screen:set_default_attr_ids({
+ [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [1] = { background = Screen.colors.Green }, -- CursorLine (low-priority)
+ [2] = { foreground = Screen.colors.Red }, -- CursorLine (high-priority)
+ })
+ screen:attach()
+ exec([[
+ call setline(1, 'one one one |hidden| one one one one one one one one')
+ syntax match test /|hidden|/ conceal
+ set conceallevel=2 concealcursor=n cursorline
+ normal! g$
+ hi! CursorLine guibg=Green
+ ]])
+ screen:expect([[
+ {1:one one one one one one one on^e }|
+ {1: one one one }|
+ {0:~ }|
+ |
+ ]])
+ command('hi! CursorLine guibg=NONE guifg=Red')
+ screen:expect([[
+ {2:one one one one one one one on^e }|
+ {2: one one one }|
+ {0:~ }|
+ |
+ ]])
+ end)
+
+ -- oldtest: Test_conceal_wrapped_cursorline_wincolor_rightleft()
+ it('CursorLine highlight on wrapped lines with rightleft', function()
+ local screen = Screen.new(40, 4)
+ screen:set_default_attr_ids({
+ [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [1] = { background = Screen.colors.Green }, -- CursorLine (low-priority)
+ [2] = { foreground = Screen.colors.Red }, -- CursorLine (high-priority)
+ })
+ screen:attach()
+ exec([[
+ call setline(1, 'one one one |hidden| one one one one one one one one')
+ syntax match test /|hidden|/ conceal
+ set conceallevel=2 concealcursor=n cursorline rightleft
+ normal! g$
+ hi! CursorLine guibg=Green
+ ]])
+ screen:expect([[
+ {1: ^eno eno eno eno eno eno eno eno}|
+ {1: eno eno eno }|
+ {0: ~}|
+ |
+ ]])
+ command('hi! CursorLine guibg=NONE guifg=Red')
+ screen:expect([[
+ {2: ^eno eno eno eno eno eno eno eno}|
+ {2: eno eno eno }|
+ {0: ~}|
+ |
+ ]])
+ end)
+
-- oldtest: Test_conceal_resize_term()
it('resize editor', function()
local screen = Screen.new(75, 6)
@@ -570,4 +633,210 @@ describe('Conceal', function()
feed('$')
expect_pos(9, 26)
end)
+
+ local function test_conceal_virtualedit_after_eol(wrap)
+ local screen = Screen.new(60, 3)
+ screen:set_default_attr_ids({
+ [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ })
+ screen:attach()
+ api.nvim_set_option_value('wrap', wrap, {})
+ exec([[
+ call setline(1, 'abcdefgh|hidden|ijklmnpop')
+ syntax match test /|hidden|/ conceal
+ set conceallevel=2 concealcursor=n virtualedit=all
+ normal! $
+ ]])
+ screen:expect([[
+ abcdefghijklmnpo^p |
+ {0:~ }|
+ |
+ ]])
+ feed('l')
+ screen:expect([[
+ abcdefghijklmnpop^ |
+ {0:~ }|
+ |
+ ]])
+ feed('l')
+ screen:expect([[
+ abcdefghijklmnpop ^ |
+ {0:~ }|
+ |
+ ]])
+ feed('l')
+ screen:expect([[
+ abcdefghijklmnpop ^ |
+ {0:~ }|
+ |
+ ]])
+ feed('rr')
+ screen:expect([[
+ abcdefghijklmnpop ^r |
+ {0:~ }|
+ |
+ ]])
+ end
+
+ -- oldtest: Test_conceal_virtualedit_after_eol()
+ describe('cursor drawn at correct column with virtualedit', function()
+ it('with wrapping', function()
+ test_conceal_virtualedit_after_eol(true)
+ end)
+ it('without wrapping', function()
+ test_conceal_virtualedit_after_eol(false)
+ end)
+ end)
+
+ local function test_conceal_virtualedit_after_eol_rightleft(wrap)
+ local screen = Screen.new(60, 3)
+ screen:set_default_attr_ids({
+ [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ })
+ screen:attach()
+ api.nvim_set_option_value('wrap', wrap, {})
+ exec([[
+ call setline(1, 'abcdefgh|hidden|ijklmnpop')
+ syntax match test /|hidden|/ conceal
+ set conceallevel=2 concealcursor=n virtualedit=all rightleft
+ normal! $
+ ]])
+ screen:expect([[
+ ^popnmlkjihgfedcba|
+ {0: ~}|
+ |
+ ]])
+ feed('h')
+ screen:expect([[
+ ^ popnmlkjihgfedcba|
+ {0: ~}|
+ |
+ ]])
+ feed('h')
+ screen:expect([[
+ ^ popnmlkjihgfedcba|
+ {0: ~}|
+ |
+ ]])
+ feed('h')
+ screen:expect([[
+ ^ popnmlkjihgfedcba|
+ {0: ~}|
+ |
+ ]])
+ feed('rr')
+ screen:expect([[
+ ^r popnmlkjihgfedcba|
+ {0: ~}|
+ |
+ ]])
+ end
+
+ -- oldtest: Test_conceal_virtualedit_after_eol_rightleft()
+ describe('cursor drawn correctly with virtualedit and rightleft', function()
+ it('with wrapping', function()
+ test_conceal_virtualedit_after_eol_rightleft(true)
+ end)
+ it('without wrapping', function()
+ test_conceal_virtualedit_after_eol_rightleft(false)
+ end)
+ end)
+
+ local function test_conceal_double_width(wrap)
+ local screen = Screen.new(60, 4)
+ screen:set_default_attr_ids({
+ [0] = { bold = true, foreground = Screen.colors.Blue },
+ [1] = { background = Screen.colors.DarkGrey, foreground = Screen.colors.LightGrey },
+ [2] = { background = Screen.colors.LightRed },
+ })
+ screen:attach()
+ api.nvim_set_option_value('wrap', wrap, {})
+ exec([[
+ call setline(1, ['aaaaa口=口bbbbb口=口ccccc', 'foobar'])
+ syntax match test /口=口/ conceal cchar=β
+ set conceallevel=2 concealcursor=n colorcolumn=30
+ normal! $
+ ]])
+ screen:expect([[
+ aaaaa{1:β}bbbbb{1:β}cccc^c {2: } |
+ foobar {2: } |
+ {0:~ }|
+ |
+ ]])
+ feed('gM')
+ screen:expect([[
+ aaaaa{1:β}bb^bbb{1:β}ccccc {2: } |
+ foobar {2: } |
+ {0:~ }|
+ |
+ ]])
+ command('set conceallevel=3')
+ screen:expect([[
+ aaaaabb^bbbccccc {2: } |
+ foobar {2: } |
+ {0:~ }|
+ |
+ ]])
+ feed('$')
+ screen:expect([[
+ aaaaabbbbbcccc^c {2: } |
+ foobar {2: } |
+ {0:~ }|
+ |
+ ]])
+ end
+
+ -- oldtest: Test_conceal_double_width()
+ describe('cursor drawn correctly when double-width chars are concealed', function()
+ it('with wrapping', function()
+ test_conceal_double_width(true)
+ end)
+ it('without wrapping', function()
+ test_conceal_double_width(false)
+ end)
+ end)
+
+ -- oldtest: Test_conceal_double_width_wrap()
+ it('line wraps correctly when double-width chars are concealed', function()
+ local screen = Screen.new(20, 4)
+ screen:set_default_attr_ids({
+ [0] = { bold = true, foreground = Screen.colors.Blue },
+ [1] = { background = Screen.colors.DarkGrey, foreground = Screen.colors.LightGrey },
+ [2] = { background = Screen.colors.LightRed },
+ })
+ screen:attach()
+ exec([[
+ call setline(1, 'aaaaaaaaaa口=口bbbbbbbbbb口=口cccccccccc')
+ syntax match test /口=口/ conceal cchar=β
+ set conceallevel=2 concealcursor=n
+ normal! $
+ ]])
+ screen:expect([[
+ aaaaaaaaaa{1:β}bbbbb |
+ bbbbb{1:β}ccccccccc^c |
+ {0:~ }|
+ |
+ ]])
+ feed('gM')
+ screen:expect([[
+ aaaaaaaaaa{1:β}bbbbb |
+ ^bbbbb{1:β}cccccccccc |
+ {0:~ }|
+ |
+ ]])
+ command('set conceallevel=3')
+ screen:expect([[
+ aaaaaaaaaabbbbb |
+ ^bbbbbcccccccccc |
+ {0:~ }|
+ |
+ ]])
+ feed('$')
+ screen:expect([[
+ aaaaaaaaaabbbbb |
+ bbbbbccccccccc^c |
+ {0:~ }|
+ |
+ ]])
+ end)
end)
diff --git a/test/functional/legacy/matchparen_spec.lua b/test/functional/legacy/matchparen_spec.lua
index b03107deb0..137448acbd 100644
--- a/test/functional/legacy/matchparen_spec.lua
+++ b/test/functional/legacy/matchparen_spec.lua
@@ -61,13 +61,15 @@ describe('matchparen', function()
set hidden
call setline(1, ['()'])
normal 0
+
+ func OtherBuffer()
+ enew
+ exe "normal iaa\<Esc>0"
+ endfunc
]])
screen:expect(screen1)
- exec([[
- enew
- exe "normal iaa\<Esc>0"
- ]])
+ exec('call OtherBuffer()')
screen:expect(screen2)
feed('<C-^>')
@@ -77,6 +79,39 @@ describe('matchparen', function()
screen:expect(screen2)
end)
+ -- oldtest: Test_matchparen_win_execute()
+ it('matchparen highlight when switching buffer in win_execute()', function()
+ local screen = Screen.new(20, 5)
+ screen:set_default_attr_ids({
+ [1] = { background = Screen.colors.Cyan },
+ [2] = { reverse = true, bold = true },
+ [3] = { reverse = true },
+ })
+ screen:attach()
+
+ exec([[
+ source $VIMRUNTIME/plugin/matchparen.vim
+ let s:win = win_getid()
+ call setline(1, '{}')
+ split
+
+ func SwitchBuf()
+ call win_execute(s:win, 'enew | buffer #')
+ endfunc
+ ]])
+ screen:expect([[
+ {1:^{}} |
+ {2:[No Name] [+] }|
+ {} |
+ {3:[No Name] [+] }|
+ |
+ ]])
+
+ -- Switching buffer away and back shouldn't change matchparen highlight.
+ exec('call SwitchBuf()')
+ screen:expect_unchanged()
+ end)
+
-- oldtest: Test_matchparen_pum_clear()
it('is cleared when completion popup is shown', function()
local screen = Screen.new(30, 9)
diff --git a/test/functional/legacy/memory_usage_spec.lua b/test/functional/legacy/memory_usage_spec.lua
index a05e9fdf57..3a6eb2c31c 100644
--- a/test/functional/legacy/memory_usage_spec.lua
+++ b/test/functional/legacy/memory_usage_spec.lua
@@ -59,7 +59,7 @@ local monitor_memory_usage = {
end
table.remove(self.hist, 1)
self.last = self.hist[#self.hist]
- eq(#result, 1)
+ eq(1, #result)
end)
end,
dump = function(self)