aboutsummaryrefslogtreecommitdiff
path: root/test/functional/legacy
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-10-01 18:32:08 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-10-02 07:28:38 +0800
commit85c7d4f7a92326dcd70317b048bafe96c8051701 (patch)
treefa1284ca2c4eccbaf495d8135c6bbd97f81cb646 /test/functional/legacy
parent01721aaa667f7fe32f5b9fbf7b6fd99cb775de48 (diff)
downloadrneovim-85c7d4f7a92326dcd70317b048bafe96c8051701.tar.gz
rneovim-85c7d4f7a92326dcd70317b048bafe96c8051701.tar.bz2
rneovim-85c7d4f7a92326dcd70317b048bafe96c8051701.zip
vim-patch:9.0.0620: matchaddpos() can only add up to 8 matches
Problem: matchaddpos() can only add up to 8 matches. Solution: Allocate the array of positions. (closes vim/vim#11248) https://github.com/vim/vim/commit/50faf02f43d7f1a56ec2023028fca7c72dbce83e
Diffstat (limited to 'test/functional/legacy')
-rw-r--r--test/functional/legacy/match_spec.lua38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/functional/legacy/match_spec.lua b/test/functional/legacy/match_spec.lua
new file mode 100644
index 0000000000..271f844f9d
--- /dev/null
+++ b/test/functional/legacy/match_spec.lua
@@ -0,0 +1,38 @@
+local helpers = require('test.functional.helpers')(after_each)
+local Screen = require('test.functional.ui.screen')
+local clear = helpers.clear
+local exec = helpers.exec
+
+before_each(clear)
+
+describe('matchaddpos()', function()
+ -- oldtest: Test_matchaddpos_dump()
+ it('can add more than 8 match positions vim-patch:9.0.0620', function()
+ local screen = Screen.new(60, 14)
+ screen:set_default_attr_ids({
+ [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [1] = {background = Screen.colors.Yellow}, -- Search
+ })
+ screen:attach()
+ exec([[
+ call setline(1, ['1234567890123']->repeat(14))
+ call matchaddpos('Search', range(1, 12)->map({i, v -> [v, v]}))
+ ]])
+ screen:expect([[
+ {1:^1}234567890123 |
+ 1{1:2}34567890123 |
+ 12{1:3}4567890123 |
+ 123{1:4}567890123 |
+ 1234{1:5}67890123 |
+ 12345{1:6}7890123 |
+ 123456{1:7}890123 |
+ 1234567{1:8}90123 |
+ 12345678{1:9}0123 |
+ 123456789{1:0}123 |
+ 1234567890{1:1}23 |
+ 12345678901{1:2}3 |
+ 1234567890123 |
+ |
+ ]])
+ end)
+end)