diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-11-24 19:41:02 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-24 19:41:02 +0800 |
commit | 38863f5242baad3e4a7c6fc970b9d66ae851a6db (patch) | |
tree | b74efce53711db5265c187a359425dd55c34b2fa /test | |
parent | 868d8d69627c4b8fd5225da0dff5905f75645946 (diff) | |
parent | a98970219ddc90b6f599203f6bb24da79fc6bbeb (diff) | |
download | rneovim-38863f5242baad3e4a7c6fc970b9d66ae851a6db.tar.gz rneovim-38863f5242baad3e4a7c6fc970b9d66ae851a6db.tar.bz2 rneovim-38863f5242baad3e4a7c6fc970b9d66ae851a6db.zip |
Merge pull request #21173 from zeertzjq/vim-8.2.3698
vim-patch:8.2.{3698,3940,4062}: match highlight continues in linebreak
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/legacy/match_spec.lua | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/test/functional/legacy/match_spec.lua b/test/functional/legacy/match_spec.lua index 271f844f9d..b6e45c396c 100644 --- a/test/functional/legacy/match_spec.lua +++ b/test/functional/legacy/match_spec.lua @@ -2,6 +2,7 @@ local helpers = require('test.functional.helpers')(after_each) local Screen = require('test.functional.ui.screen') local clear = helpers.clear local exec = helpers.exec +local feed = helpers.feed before_each(clear) @@ -36,3 +37,90 @@ describe('matchaddpos()', function() ]]) end) end) + +describe('match highlighting', function() + -- oldtest: Test_match_in_linebreak() + it('does not continue in linebreak vim-patch:8.2.3698', function() + local screen = Screen.new(75, 10) + screen:set_default_attr_ids({ + [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText + [1] = {background = Screen.colors.Red, foreground = Screen.colors.White}, -- ErrorMsg + }) + screen:attach() + exec([=[ + set breakindent linebreak breakat+=] + call printf('%s]%s', repeat('x', 50), repeat('x', 70))->setline(1) + call matchaddpos('ErrorMsg', [[1, 51]]) + ]=]) + screen:expect([[ + ^xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx{1:]} | + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + | + ]]) + end) + + it('is shown with incsearch vim-patch:8.2.3940', function() + local screen = Screen.new(75, 6) + screen:set_default_attr_ids({ + [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText + [1] = {background = Screen.colors.Yellow}, -- Search + [2] = {background = Screen.colors.Red, foreground = Screen.colors.White}, -- ErrorMsg + }) + screen:attach() + exec([[ + set incsearch + call setline(1, range(20)) + call matchaddpos('ErrorMsg', [3]) + ]]) + screen:expect([[ + ^0 | + 1 | + {2:2} | + 3 | + 4 | + | + ]]) + feed(':s/0') + screen:expect([[ + {1:0} | + 1 | + {2:2} | + 3 | + 4 | + :s/0^ | + ]]) + end) + + it('on a Tab vim-patch:8.2.4062', function() + local screen = Screen.new(75, 10) + screen:set_default_attr_ids({ + [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText + [1] = {background = Screen.colors.Red, foreground = Screen.colors.White}, -- ErrorMsg + }) + screen:attach() + exec([[ + set linebreak + call setline(1, "\tix") + call matchadd('ErrorMsg', '\t') + ]]) + screen:expect([[ + {1: ^ }ix | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + | + ]]) + end) +end) |