patch 8.2.0179: still a few places where range() does not work
Problem: Still a few places where range() does not work.
Solution: Fix using range() causing problems.
diff --git a/src/testdir/dumps/Test_popup_settext_07.dump b/src/testdir/dumps/Test_popup_settext_07.dump
new file mode 100644
index 0000000..146dec6
--- /dev/null
+++ b/src/testdir/dumps/Test_popup_settext_07.dump
@@ -0,0 +1,10 @@
+> +0&#ffffff0@74
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @35| +0#0000001#ffd7ff255| +0#4040ff13#ffffff0@36
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|E+0#ffffff16#e000002|7|1|5|:| |D|i|c|t|i|o|n|a|r|y| |r|e|q|u|i|r|e|d| +0#0000000#ffffff0@31|0|,|0|-|1| @8|A|l@1|
diff --git a/src/testdir/dumps/Test_popupwin_20.dump b/src/testdir/dumps/Test_popupwin_20.dump
index 707db58..692708b 100644
--- a/src/testdir/dumps/Test_popupwin_20.dump
+++ b/src/testdir/dumps/Test_popupwin_20.dump
@@ -3,11 +3,11 @@
|3| ||+0#0000001#ffd7ff255|h|e|l@1|o| |b|o|r|d|e|r||| +0#0000000#ffffff0@5| +0#0000001#ffd7ff255|h|e|l@1|o| |p|a|d@1|i|n|g| | +0#0000000#ffffff0@4||| @11||| @16|X+0#0000001#ffd7ff255| +0#0000000#ffffff0
|4| |++0#0000001#ffd7ff255|-@11|+| +0#0000000#ffffff0@5| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@4||| |h|e|l@1|o| |b|o|t|h| ||| @17|X+0#0000001#ffd7ff255
|5+0#0000000#ffffff0| @40||| @11||| @17|X+0#0000001#ffd7ff255
-|6+0#0000000#ffffff0| |++0#0000001#ffd7ff255|-@8| +0#0000000#ffffff0@9| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@4|+|-@11|+| @18
-|7| ||+0#0000001#ffd7ff255|b|o|r|d|e|r| |T|L| +0#0000000#ffffff0@9| +0#0000001#ffd7ff255@3|p|a|d@1|i|n|g|s| @2| +0#0000000#ffffff0@37
-|8| @20| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@12||+0#0000001#ffd7ff255| @2|w|r|a|p@1|e|d| |l|o|n|g|e|r| |t|e| @2||
-|9+0#0000000#ffffff0| @20| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@12||+0#0000001#ffd7ff255| @2|x|t| @17||
-|1+0#0000000#ffffff0|0| @72
+|6+0#0000000#ffffff0| |++0#0000001#ffd7ff255|-@8| +0#0000000#ffffff0@9| +0#0000001#ffd7ff255@13| +0#0000000#ffffff0@5|+|-@11|+| @18
+|7| ||+0#0000001#ffd7ff255|b|o|r|d|e|r| |T|L| +0#0000000#ffffff0@9| +0#0000001#ffd7ff255@3|p|a|d@1|i|n|g|s| @1| +0#0000000#ffffff0@38
+|8| @20| +0#0000001#ffd7ff255@13| +0#0000000#ffffff0@13||+0#0000001#ffd7ff255| @2|w|r|a|p@1|e|d| |l|o|n|g|e|r| |t|e| @2||
+|9+0#0000000#ffffff0| @20| +0#0000001#ffd7ff255@13| +0#0000000#ffffff0@13||+0#0000001#ffd7ff255| @2|x|t| @17||
+|1+0#0000000#ffffff0|0| @19| +0#0000001#ffd7ff255@13| +0#0000000#ffffff0@38
|1@1| @46||+0#0000001#ffd7ff255| @2|r|i|g|h|t| |a|l|i|g|n|e|d| |t|e|x|t| @2||
|1+0#0000000#ffffff0|2| @72
|1|3| @72
diff --git a/src/testdir/dumps/Test_popupwin_21.dump b/src/testdir/dumps/Test_popupwin_21.dump
index 9b6f4d0..6398549 100644
--- a/src/testdir/dumps/Test_popupwin_21.dump
+++ b/src/testdir/dumps/Test_popupwin_21.dump
@@ -3,11 +3,11 @@
|3| |║+0#0000001#ffd7ff255|h|e|l@1|o| |b|o|r|d|e|r|║| +0#0000000#ffffff0@5| +0#0000001#ffd7ff255|h|e|l@1|o| |p|a|d@1|i|n|g| | +0#0000000#ffffff0@4|║| @11|║| @16|X+0#0000001#ffd7ff255| +0#0000000#ffffff0
|4| |╚+0#0000001#ffd7ff255|═@11|╝| +0#0000000#ffffff0@5| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@4|║| |h|e|l@1|o| |b|o|t|h| |║| @17|X+0#0000001#ffd7ff255
|5+0#0000000#ffffff0| @40|║| @11|║| @17|X+0#0000001#ffd7ff255
-|6+0#0000000#ffffff0| |╔+0#0000001#ffd7ff255|═@8| +0#0000000#ffffff0@9| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@4|╚|═@11|╝| @18
-|7| |║+0#0000001#ffd7ff255|b|o|r|d|e|r| |T|L| +0#0000000#ffffff0@9| +0#0000001#ffd7ff255@3|p|a|d@1|i|n|g|s| @2| +0#0000000#ffffff0@37
-|8| @20| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@12|║+0#0000001#ffd7ff255| @2|w|r|a|p@1|e|d| |l|o|n|g|e|r| |t|e| @2|║
-|9+0#0000000#ffffff0| @20| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@12|║+0#0000001#ffd7ff255| @2|x|t| @17|║
-|1+0#0000000#ffffff0|0| @72
+|6+0#0000000#ffffff0| |╔+0#0000001#ffd7ff255|═@8| +0#0000000#ffffff0@9| +0#0000001#ffd7ff255@13| +0#0000000#ffffff0@5|╚|═@11|╝| @18
+|7| |║+0#0000001#ffd7ff255|b|o|r|d|e|r| |T|L| +0#0000000#ffffff0@9| +0#0000001#ffd7ff255@3|p|a|d@1|i|n|g|s| @1| +0#0000000#ffffff0@38
+|8| @20| +0#0000001#ffd7ff255@13| +0#0000000#ffffff0@13|║+0#0000001#ffd7ff255| @2|w|r|a|p@1|e|d| |l|o|n|g|e|r| |t|e| @2|║
+|9+0#0000000#ffffff0| @20| +0#0000001#ffd7ff255@13| +0#0000000#ffffff0@13|║+0#0000001#ffd7ff255| @2|x|t| @17|║
+|1+0#0000000#ffffff0|0| @19| +0#0000001#ffd7ff255@13| +0#0000000#ffffff0@38
|1@1| @46|║+0#0000001#ffd7ff255| @2|r|i|g|h|t| |a|l|i|g|n|e|d| |t|e|x|t| @2|║
|1+0#0000000#ffffff0|2| @72
|1|3| @72
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index 595a963..6150a0c 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -1955,12 +1955,49 @@
call setreg('a', range(3))
call assert_equal("0\n1\n2\n", getreg('a'))
+ " settagstack()
+ call settagstack(1, #{items : range(4)})
+
+ " sign_define()
+ call assert_fails("call sign_define(range(5))", "E715:")
+ call assert_fails("call sign_placelist(range(5))", "E715:")
+
+ " sign_undefine()
+ call assert_fails("call sign_undefine(range(5))", "E908:")
+
+ " sign_unplacelist()
+ call assert_fails("call sign_unplacelist(range(5))", "E715:")
+
" sort()
call assert_equal([0, 1, 2, 3, 4, 5], sort(range(5, 0, -1)))
+ " 'spellsuggest'
+ func MySuggest()
+ return range(3)
+ endfunc
+ set spell spellsuggest=expr:MySuggest()
+ call assert_equal([], spellsuggest('baord', 3))
+ set nospell spellsuggest&
+
" string()
call assert_equal('[0, 1, 2, 3, 4]', string(range(5)))
+ " taglist() with 'tagfunc'
+ func TagFunc(pattern, flags, info)
+ return range(10)
+ endfunc
+ set tagfunc=TagFunc
+ call assert_fails("call taglist('asdf')", 'E987:')
+ set tagfunc=
+
+ " term_start()
+ if has('terminal')
+ call assert_fails('call term_start(range(3, 4))', 'E474:')
+ let g:terminal_ansi_colors = range(16)
+ call assert_fails('call term_start("ls", #{term_finish: "close"})', 'E475:')
+ unlet g:terminal_ansi_colors
+ endif
+
" type()
call assert_equal(v:t_list, type(range(5)))
diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim
index ebcc1f4..75247b5 100644
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -86,7 +86,7 @@
call popup_create('hello padding', #{line: 2, col: 23, padding: []})
call popup_create('hello both', #{line: 2, col: 43, border: [], padding: [], highlight: 'Normal'})
call popup_create('border TL', #{line: 6, col: 3, border: [1, 0, 0, 4]})
- call popup_create('paddings', #{line: 6, col: 23, padding: [1, 3, 2, 4]})
+ call popup_create('paddings', #{line: 6, col: 23, padding: range(1, 4)})
call popup_create('wrapped longer text', #{line: 8, col: 55, padding: [0, 3, 0, 3], border: [0, 1, 0, 1]})
call popup_create('right aligned text', #{line: 11, col: 56, wrap: 0, padding: [0, 3, 0, 3], border: [0, 1, 0, 1]})
call popup_create('X', #{line: 2, col: 73})
@@ -180,6 +180,14 @@
call popup_setoptions(winid, options)
call assert_equal(options, popup_getoptions(winid))
+ " Check that range() doesn't crash
+ call popup_setoptions(winid, #{
+ \ padding: range(1, 4),
+ \ border: range(5, 8),
+ \ borderhighlight: range(4),
+ \ borderchars: range(8),
+ \ })
+
let winid = popup_create('hello both', #{line: 3, col: 8, border: [], padding: []})
call assert_equal(#{
\ line: 3,
@@ -883,8 +891,14 @@
call popup_clear()
call assert_fails('call popup_create([#{text: "text", props: ["none"]}], {})', 'E715:')
call popup_clear()
+ call assert_fails('call popup_create([#{text: "text", props: range(3)}], {})', 'E715:')
+ call popup_clear()
call assert_fails('call popup_create("text", #{mask: ["asdf"]})', 'E475:')
call popup_clear()
+ call assert_fails('call popup_create("text", #{mask: range(5)})', 'E475:')
+ call popup_clear()
+ call popup_create("text", #{mask: [range(4)]})
+ call popup_clear()
call assert_fails('call popup_create("text", #{mask: test_null_list()})', 'E475:')
call assert_fails('call popup_create("text", #{mapping: []})', 'E745:')
call popup_clear()
@@ -1331,7 +1345,8 @@
normal 3G45|r@
let winid1 = popup_atcursor(['First', 'SeconD'], #{
\ pos: 'topright',
- \ moved: [0, 0, 0],
+ \ moved: range(3),
+ \ mousemoved: range(3),
\ })
END
call writefile(lines, 'XtestPopupAtcursorPos')
@@ -2099,6 +2114,10 @@
call term_sendkeys(buf, ":call popup_settext(p, [#{text: 'aaaa'}, #{text: 'bbbb'}, #{text: 'cccc'}])\<CR>")
call VerifyScreenDump(buf, 'Test_popup_settext_06', {})
+ " range() (doesn't work)
+ call term_sendkeys(buf, ":call popup_settext(p, range(4, 8))\<CR>")
+ call VerifyScreenDump(buf, 'Test_popup_settext_07', {})
+
" clean up
call StopVimInTerminal(buf)
call delete('XtestPopupSetText')