diff options
-rw-r--r-- | runtime/doc/eval.txt | 6 | ||||
-rw-r--r-- | runtime/doc/popup.txt | 20 | ||||
-rw-r--r-- | src/eval.c | 8 | ||||
-rw-r--r-- | src/testdir/dumps/Test_popupwin_07.dump | 2 | ||||
-rw-r--r-- | src/testdir/dumps/Test_popupwin_mask_2.dump | 2 | ||||
-rw-r--r-- | src/testdir/dumps/Test_popupwin_mask_3.dump | 2 | ||||
-rw-r--r-- | src/testdir/dumps/Test_popupwin_mask_4.dump | 2 | ||||
-rw-r--r-- | src/testdir/dumps/Test_popupwin_mask_5.dump | 2 | ||||
-rw-r--r-- | src/testdir/dumps/Test_popupwin_scroll_2.dump | 2 | ||||
-rw-r--r-- | src/testdir/dumps/Test_popupwin_scroll_3.dump | 2 | ||||
-rw-r--r-- | src/testdir/dumps/Test_popupwin_scroll_4.dump | 2 | ||||
-rw-r--r-- | src/testdir/test_listdict.vim | 7 | ||||
-rw-r--r-- | src/testdir/test_popupwin.vim | 330 | ||||
-rw-r--r-- | src/version.c | 2 |
14 files changed, 201 insertions, 188 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 1944fdd869..b100682385 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -60,7 +60,7 @@ Dictionary An associative, unordered array: Each entry has a key and a value. |Dictionary| Examples: {'blue': "#0000ff", 'red': "#ff0000"} - *{blue: "#0000ff", red: "#ff0000"} + ~{blue: "#0000ff", red: "#ff0000"} Funcref A reference to a function |Funcref|. Example: function("strlen") @@ -482,10 +482,10 @@ entry. Note that the String '04' and the Number 04 are different, since the Number will be converted to the String '4'. The empty string can also be used as a key. *literal-Dict* -To avoid having to put quotes around every key the *{} form can be used. This +To avoid having to put quotes around every key the ~{} form can be used. This does require the key to consist only of ASCII letters, digits, '-' and '_'. Example: > - let mydict = *{zero: 0, one_key: 1, two-key: 2, 333: 3} + let mydict = ~{zero: 0, one_key: 1, two-key: 2, 333: 3} Note that 333 here is the string "333". Empty keys are not possible here. A value can be any expression. Using a Dictionary for a value creates a diff --git a/runtime/doc/popup.txt b/runtime/doc/popup.txt index 0fd30ebfbe..564bcbe4a4 100644 --- a/runtime/doc/popup.txt +++ b/runtime/doc/popup.txt @@ -178,7 +178,7 @@ DETAILS *popup-function-details* popup_atcursor({what}, {options}) *popup_atcursor()* Show the {what} above the cursor, and close it when the cursor moves. This works like: > - call popup_create({what}, *{ + call popup_create({what}, ~{ \ pos: 'botleft', \ line: 'cursor-1', \ col: 'cursor', @@ -191,7 +191,7 @@ popup_beval({what}, {options}) *popup_beval()* Show the {what} above the position from 'ballooneval' and close it when the mouse moves. This works like: > let pos = screenpos(v:beval_winnr, v:beval_lnum, v:beval_col) - call popup_create({what}, *{ + call popup_create({what}, ~{ \ pos: 'botleft', \ line: pos.row - 1, \ col: pos.col, @@ -240,7 +240,7 @@ popup_create({what}, {options}) *popup_create()* popup_dialog({what}, {options}) *popup_dialog()* Just like |popup_create()| but with these default options: > - call popup_create({what}, *{ + call popup_create({what}, ~{ \ pos: 'center', \ zindex: 200, \ drag: 1, @@ -249,7 +249,7 @@ popup_dialog({what}, {options}) *popup_dialog()* \}) < Use {options} to change the properties. E.g. add a 'filter' option with value 'popup_filter_yesno'. Example: > - call popup_create('do you want to quit (Yes/no)?', *{ + call popup_create('do you want to quit (Yes/no)?', ~{ \ filter: 'popup_filter_yesno', \ callback: 'QuitCallback', \ }) @@ -356,7 +356,7 @@ popup_menu({what}, {options}) *popup_menu()* items with cursorkeys, and close it an item is selected with Space or Enter. {what} should have multiple lines to make this useful. This works like: > - call popup_create({what}, *{ + call popup_create({what}, ~{ \ pos: 'center', \ zindex: 200, \ drag: 1, @@ -391,7 +391,7 @@ popup_move({id}, {options}) *popup_move()* popup_notification({what}, {options}) *popup_notification()* Show the {what} for 3 seconds at the top of the Vim window. This works like: > - call popup_create({what}, *{ + call popup_create({what}, ~{ \ line: 1, \ col: 10, \ minwidth: 20, @@ -732,7 +732,7 @@ Prompt the user to press y/Y or n/N: > endif endfunc - call popup_dialog('Continue? y/n', *{ + call popup_dialog('Continue? y/n', ~{ \ filter: 'popup_filter_yesno', \ callback: 'MyDialogHandler', \ }) @@ -740,7 +740,7 @@ Prompt the user to press y/Y or n/N: > *popup_menu-shortcut-example* Extend popup_filter_menu() with shortcut keys: > - call popup_menu(['Save', 'Cancel', 'Discard'], *{ + call popup_menu(['Save', 'Cancel', 'Discard'], ~{ \ filter: 'MyMenuFilter', \ callback: 'MyMenuHandler', \ }) @@ -781,7 +781,7 @@ Example for using a popup window for 'ballooneval': > endif call popup_close(s:winid) endif - let s:winid = popup_beval(v:beval_text, *{mousemoved: 'word'}) + let s:winid = popup_beval(v:beval_text, ~{mousemoved: 'word'}) let s:last_text = v:beval_text return '' endfunc @@ -812,7 +812,7 @@ this example simulated with a timer callback: > endfunc func ShowPopup(id) - let s:winid = popup_beval(s:balloonText, *{mousemoved: 'word'}) + let s:winid = popup_beval(s:balloonText, ~{mousemoved: 'word'}) endfunc < diff --git a/src/eval.c b/src/eval.c index ae89f7e2bc..1d290bcbfe 100644 --- a/src/eval.c +++ b/src/eval.c @@ -4266,7 +4266,7 @@ eval6( for (;;) { op = **arg; - if ((op != '*' || (*arg)[1] == '{') && op != '/' && op != '%') + if (op != '*' && op != '/' && op != '%') break; if (evaluate) @@ -4392,7 +4392,7 @@ eval6( * (expression) nested expression * [expr, expr] List * {key: val, key: val} Dictionary - * *{key: val, key: val} Dictionary with literal keys + * ~{key: val, key: val} Dictionary with literal keys * * Also handle: * ! in front logical NOT @@ -4577,9 +4577,9 @@ eval7( break; /* - * Dictionary: *{key: val, key: val} + * Dictionary: ~{key: val, key: val} */ - case '*': if ((*arg)[1] == '{') + case '~': if ((*arg)[1] == '{') { ++*arg; ret = dict_get_tv(arg, rettv, evaluate, TRUE); diff --git a/src/testdir/dumps/Test_popupwin_07.dump b/src/testdir/dumps/Test_popupwin_07.dump index 28c13cb7f0..d5a5d05ec3 100644 --- a/src/testdir/dumps/Test_popupwin_07.dump +++ b/src/testdir/dumps/Test_popupwin_07.dump @@ -6,5 +6,5 @@ |~| @73 |~| @52|o+0#0000001#ffd7ff255|t|h|e|r| |t|a|b| @11 |~+0#4040ff13#ffffff0| @52|a+0#0000001#ffd7ff255| |c+0#ff404010&|o|m@1|e|n|t| +0#0000001&|l|i|n|e| @6 -|:+0#0000000#ffffff0|c|a|l@1| |p|o|p|u|p|_|m|o|v|e|(|p|o|p|u|p|w|i|n|,| |*|{|l|i|n|e|:| |7|,| |c|o|l|:| |5@1|}|)| @6|t+0#0000001#ffd7ff255|h|i|s| |l|i|n|e| |w|i|l@1| |n|o|t| |f|i +|:+0#0000000#ffffff0| @52|t+0#0000001#ffd7ff255|h|i|s| |l|i|n|e| |w|i|l@1| |n|o|t| |f|i | +0#0000000#ffffff0@53|t+0#0000001#ffd7ff255| |h|e|r|e| @14 diff --git a/src/testdir/dumps/Test_popupwin_mask_2.dump b/src/testdir/dumps/Test_popupwin_mask_2.dump index 3ae3c9decb..173d40a6f9 100644 --- a/src/testdir/dumps/Test_popupwin_mask_2.dump +++ b/src/testdir/dumps/Test_popupwin_mask_2.dump @@ -10,4 +10,4 @@ |1|2|3|4|5|6|7|8|9|1|0|║+0#0000001#ffd7ff255| @10|1+0#0000000#ffffff0|7|1|8|1|9|2|0|2|1|2@2|3|2|4|2|5|2|6|2|7|2|8|2|9|3|0|3|1|3|2|3@2|4|3|5|3|6|3|7|3|8|3|9|4|0|4|1|4|2 |1|2|3|4|5|6|7|8|9|1|0|╚+0#0000001#ffd7ff255|═|1+0#0000000#ffffff0|2|1|═+0#0000001#ffd7ff255@4|1+0#0000000#ffffff0|6|1|7|═+0#0000001#ffd7ff255@1|╝|9+0#0000000#ffffff0|2|0|2|1|2@2|3|2|4|2|5|2|6|2|7|2|8|2|9|3|0|3|1|3|2|3@2|4|3|5|3|6|3|7|3|8|3|9|4|0|4|1|4|2 |1|2|3|4|5|6|7|8|9|1|0|1@2|2|1|3|1|4|1|5|1|6|1|7|1|8|1|9|2|0|2|1|2@2|3|2|4|2|5|2|6|2|7|2|8|2|9|3|0|3|1|3|2|3@2|4|3|5|3|6|3|7|3|8|3|9|4|0|4|1|4|2 -|:|c|a|l@1| |p|o|p|u|p|_|m|o|v|e|(|w|i|n|i|d|b|,| |*|{|c|o|l|:| |1|2|}|)| @20|1|,|1| @10|T|o|p| +|:| @55|1|,|1| @10|T|o|p| diff --git a/src/testdir/dumps/Test_popupwin_mask_3.dump b/src/testdir/dumps/Test_popupwin_mask_3.dump index 7bbcafc272..40681fb4ca 100644 --- a/src/testdir/dumps/Test_popupwin_mask_3.dump +++ b/src/testdir/dumps/Test_popupwin_mask_3.dump @@ -10,4 +10,4 @@ |1+0#0000000#ffffff0|2|3|4|5|6|7|8|9|1|0|1@2|2|1|3|1|4|1|5|1|6|1|7|1|8|1|9|2|0|2|1|2@2|3|2|4|2|5|2|6|2|7|2|8|2|9|3|0|3|1|3|2|3@2|4|3|5|3|║+0#0000001#ffd7ff255| @10|2+0#0000000#ffffff0 |1|2|3|4|5|6|7|8|9|1|0|1@2|2|1|3|1|4|1|5|1|6|1|7|1|8|1|9|2|0|2|1|2@2|3|2|4|2|5|2|6|2|7|2|8|2|9|3|0|3|1|3|2|3@2|4|3|5|3|╚+0#0000001#ffd7ff255|═|7+0#0000000#ffffff0|3|8|═+0#0000001#ffd7ff255@4|1+0#0000000#ffffff0|4|2 |1|2|3|4|5|6|7|8|9|1|0|1@2|2|1|3|1|4|1|5|1|6|1|7|1|8|1|9|2|0|2|1|2@2|3|2|4|2|5|2|6|2|7|2|8|2|9|3|0|3|1|3|2|3@2|4|3|5|3|6|3|7|3|8|3|9|4|0|4|1|4|2 -|:|c|a|l@1| |p|o|p|u|p|_|m|o|v|e|(|w|i|n|i|d|b|,| |*|{|c|o|l|:| |6|3|}|)| @20|1|,|1| @10|T|o|p| +|:| @55|1|,|1| @10|T|o|p| diff --git a/src/testdir/dumps/Test_popupwin_mask_4.dump b/src/testdir/dumps/Test_popupwin_mask_4.dump index 9552b40072..0cf44d2c25 100644 --- a/src/testdir/dumps/Test_popupwin_mask_4.dump +++ b/src/testdir/dumps/Test_popupwin_mask_4.dump @@ -10,4 +10,4 @@ | +0#0000001#ffd7ff255@6|8+0#0000000#ffffff0|9|1|0|1@2|2|1|3|1|4|1|5|1|6|1|7|1|8|1|9|2|0|2|1|2@2|3|2|4|2|5|2|6|2|7|2|8|2|9|3|0|3|1|3|2|3@2|4|3|5|3|6|3|7|3|8|3|9|4|0|4|1|4|2 |═+0#0000001#ffd7ff255@4|6+0#0000000#ffffff0|7|8|9|═+0#0000001#ffd7ff255@1|╝|1+0#0000000#ffffff0@1|2|1|3|1|4|1|5|1|6|1|7|1|8|1|9|2|0|2|1|2@2|3|2|4|2|5|2|6|2|7|2|8|2|9|3|0|3|1|3|2|3@2|4|3|5|3|6|3|7|3|8|3|9|4|0|4|1|4|2 |1|2|3|4|5|6|7|8|9|1|0|1@2|2|1|3|1|4|1|5|1|6|1|7|1|8|1|9|2|0|2|1|2@2|3|2|4|2|5|2|6|2|7|2|8|2|9|3|0|3|1|3|2|3@2|4|3|5|3|6|3|7|3|8|3|9|4|0|4|1|4|2 -|:|c|a|l@1| |p|o|p|u|p|_|m|o|v|e|(|w|i|n|i|d|b|,| |*|{|p|o|s|:| |'|t|o|p|r|i|g|h|t|'|,| |c|o|l|:| |1|2|}|)| @3|1|,|1| @10|T|o|p| +|:| @55|1|,|1| @10|T|o|p| diff --git a/src/testdir/dumps/Test_popupwin_mask_5.dump b/src/testdir/dumps/Test_popupwin_mask_5.dump index 06334e1d32..78cc6f0858 100644 --- a/src/testdir/dumps/Test_popupwin_mask_5.dump +++ b/src/testdir/dumps/Test_popupwin_mask_5.dump @@ -10,4 +10,4 @@ |1|2|3|4|5|6|7|8|9|1|0|1@2|2|1|3|1|4|1|5|1|6|1|7|1|8|1|9|2|0|2|1|2@2|3|2|4|2|5|2|6|2|7|2|8|2|9|3|0|3|1|3|2|3@2|4|3|5|3|6|3|7|3|8|3|9|4|0|4|1|4|2 | +0&#e0e0e08@11|1+0&#ffffff0@1|2|1|3|1|4|1|5|1|6|1|7|1|8|1|9|2|0|2|1|2@2|3|2|4|2|5|2|6|═+0#0000001#ffd7ff255@13|X|4+0#0000000#ffffff0|3|5|3|6|3|7|3|8|3|9|4|0|4|1|4|2 |o+0&#e0e0e08|m|e| |5+0&#ffffff0|6|7|t+0&#e0e0e08| @3|1+0&#ffffff0@1|2|1|3|1|4|1|5|1|6|1|7|1|8|1|9|2|0|2|1|2@2|3|2|4|2|5|║+0#0000001#ffd7ff255| @4|2+0#0000000#ffffff0|9|3| +0#0000001#ffd7ff255@6|║|4+0#0000000#ffffff0|3|5|3|6|3|7|3|8|3|9|4|0|4|1|4|2 -|:|c|t+0&#e0e0e08|h|l+0&#ffffff0| |p|l+0&#e0e0e08|i|n|e| |m+0&#ffffff0|o|v|e|(|w|i|n|i|d|b|,| |*|{|p|o|s|:| |'|t|o|p|l|e|f|t|'|║+0#0000001#ffd7ff255| |j|u|s|t| +0#0000000#ffffff0|4|2|e+0#0000001#ffd7ff255| |l|i|n|e| |║|,+0#0000000#ffffff0|1| @10|T|o|p| +|:| |t+0&#e0e0e08|h| +0&#ffffff0@2|l+0&#e0e0e08|i|n|e| | +0&#ffffff0@28|║+0#0000001#ffd7ff255| |j|u|s|t| +0#0000000#ffffff0@2|e+0#0000001#ffd7ff255| |l|i|n|e| |║|,+0#0000000#ffffff0|1| @10|T|o|p| diff --git a/src/testdir/dumps/Test_popupwin_scroll_2.dump b/src/testdir/dumps/Test_popupwin_scroll_2.dump index e02fe78408..3b2145e90f 100644 --- a/src/testdir/dumps/Test_popupwin_scroll_2.dump +++ b/src/testdir/dumps/Test_popupwin_scroll_2.dump @@ -7,4 +7,4 @@ |7| @31|f+0#0000001#ffd7ff255|i|v|e| @3| +0#0000000#a8a8a8255| +0&#ffffff0@32 |8| @73 |9| @73 -|:|c|a|l@1| |p|o|p|u|p|_|s|e|t|o|p|t|i|o|n|s|(|w|i|n|i|d|,| |*|{|f|i|r|s|t|l|i|n|e|:| |2|}|)| @10|1|,|1| @10|T|o|p| +|:| @55|1|,|1| @10|T|o|p| diff --git a/src/testdir/dumps/Test_popupwin_scroll_3.dump b/src/testdir/dumps/Test_popupwin_scroll_3.dump index ca7a425497..623d217cdf 100644 --- a/src/testdir/dumps/Test_popupwin_scroll_3.dump +++ b/src/testdir/dumps/Test_popupwin_scroll_3.dump @@ -7,4 +7,4 @@ |7| @31|n+0#0000001#ffd7ff255|i|n|e| @3| +0#0000000#0000001| +0&#ffffff0@32 |8| @73 |9| @73 -|:|c|a|l@1| |p|o|p|u|p|_|s|e|t|o|p|t|i|o|n|s|(|w|i|n|i|d|,| |*|{|f|i|r|s|t|l|i|n|e|:| |6|}|)| @10|1|,|1| @10|T|o|p| +|:| @55|1|,|1| @10|T|o|p| diff --git a/src/testdir/dumps/Test_popupwin_scroll_4.dump b/src/testdir/dumps/Test_popupwin_scroll_4.dump index c243c4ca26..3f7f9617fe 100644 --- a/src/testdir/dumps/Test_popupwin_scroll_4.dump +++ b/src/testdir/dumps/Test_popupwin_scroll_4.dump @@ -7,4 +7,4 @@ |7| @73 |8| @73 |9| @73 -|:|c|a|l@1| |p|o|p|u|p|_|s|e|t|o|p|t|i|o|n|s|(|w|i|n|i|d|,| |*|{|f|i|r|s|t|l|i|n|e|:| |9|}|)| @10|1|,|1| @10|T|o|p| +|:| @55|1|,|1| @10|T|o|p| diff --git a/src/testdir/test_listdict.vim b/src/testdir/test_listdict.vim index 56c84a29de..20a31decfe 100644 --- a/src/testdir/test_listdict.vim +++ b/src/testdir/test_listdict.vim @@ -281,8 +281,11 @@ func Test_dict_func_remove_in_use() endfunc func Test_dict_literal_keys() - call assert_equal({'one': 1, 'two2': 2, '3three': 3, '44': 4}, *{one: 1, two2: 2, 3three: 3, 44: 4},) - call assert_equal('2 3', trim(execute('echo 2 *{blue: 3}.blue'))) + call assert_equal({'one': 1, 'two2': 2, '3three': 3, '44': 4}, ~{one: 1, two2: 2, 3three: 3, 44: 4},) + + " why *{} cannot be used + let blue = 'blue' + call assert_equal('6', trim(execute('echo 2 *{blue: 3}.blue'))) endfunc " Nasty: deepcopy() dict that refers to itself (fails when noref used) diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim index 93302e8e67..1ce6b804fb 100644 --- a/src/testdir/test_popupwin.vim +++ b/src/testdir/test_popupwin.vim @@ -14,23 +14,23 @@ func Test_simple_popup() hi PopupColor1 ctermbg=lightblue hi PopupColor2 ctermbg=lightcyan hi Comment ctermfg=red - call prop_type_add('comment', *{highlight: 'Comment'}) - let winid = popup_create('hello there', *{line: 3, col: 11, minwidth: 20, highlight: 'PopupColor1'}) - let winid2 = popup_create(['another one', 'another two', 'another three'], *{line: 3, col: 25, minwidth: 20}) + call prop_type_add('comment', ~{highlight: 'Comment'}) + let winid = popup_create('hello there', ~{line: 3, col: 11, minwidth: 20, highlight: 'PopupColor1'}) + let winid2 = popup_create(['another one', 'another two', 'another three'], ~{line: 3, col: 25, minwidth: 20}) call setwinvar(winid2, '&wincolor', 'PopupColor2') END call writefile(lines, 'XtestPopup') - let buf = RunVimInTerminal('-S XtestPopup', *{rows: 10}) + let buf = RunVimInTerminal('-S XtestPopup', ~{rows: 10}) call VerifyScreenDump(buf, 'Test_popupwin_01', {}) " Add a tabpage call term_sendkeys(buf, ":tabnew\<CR>") call term_sendkeys(buf, ":let popupwin = popup_create([" - \ .. "*{text: 'other tab'}," - \ .. "*{text: 'a comment line', props: [*{" + \ .. "~{text: 'other tab'}," + \ .. "~{text: 'a comment line', props: [~{" \ .. "col: 3, length: 7, minwidth: 20, type: 'comment'" \ .. "}]}," - \ .. "], *{line: 4, col: 9, minwidth: 20})\<CR>") + \ .. "], ~{line: 4, col: 9, minwidth: 20})\<CR>") call VerifyScreenDump(buf, 'Test_popupwin_02', {}) " switch back to first tabpage @@ -48,7 +48,7 @@ func Test_simple_popup() call term_sendkeys(buf, ":let &columns = cols\<CR>") " resize popup, show empty line at bottom - call term_sendkeys(buf, ":call popup_move(popupwin, *{minwidth: 15, maxwidth: 25, minheight: 3, maxheight: 5})\<CR>") + call term_sendkeys(buf, ":call popup_move(popupwin, ~{minwidth: 15, maxwidth: 25, minheight: 3, maxheight: 5})\<CR>") call term_sendkeys(buf, ":redraw\<CR>") call VerifyScreenDump(buf, 'Test_popupwin_05', {}) @@ -59,7 +59,8 @@ func Test_simple_popup() " move popup over ruler call term_sendkeys(buf, ":set cmdheight=2\<CR>") - call term_sendkeys(buf, ":call popup_move(popupwin, *{line: 7, col: 55})\<CR>") + call term_sendkeys(buf, ":call popup_move(popupwin, ~{line: 7, col: 55})\<CR>") + call term_sendkeys(buf, ":\<CR>") call VerifyScreenDump(buf, 'Test_popupwin_07', {}) " clear all popups after moving the cursor a bit, so that ruler is updated @@ -83,17 +84,17 @@ func Test_popup_with_border_and_padding() for iter in range(0, 1) let lines =<< trim END call setline(1, range(1, 100)) - call popup_create('hello border', *{line: 2, col: 3, border: []}) - call popup_create('hello padding', *{line: 2, col: 23, padding: []}) - call popup_create('hello both', *{line: 2, col: 43, border: [], padding: []}) - 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('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('hello border', ~{line: 2, col: 3, border: []}) + call popup_create('hello padding', ~{line: 2, col: 23, padding: []}) + call popup_create('hello both', ~{line: 2, col: 43, border: [], padding: []}) + 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('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]}) END call insert(lines, iter == 1 ? '' : 'set enc=latin1') call writefile(lines, 'XtestPopupBorder') - let buf = RunVimInTerminal('-S XtestPopupBorder', *{rows: 15}) + let buf = RunVimInTerminal('-S XtestPopupBorder', ~{rows: 15}) call VerifyScreenDump(buf, 'Test_popupwin_2' .. iter, {}) call StopVimInTerminal(buf) @@ -107,22 +108,22 @@ func Test_popup_with_border_and_padding() hi RightColor ctermbg=245 hi BottomColor ctermbg=240 hi LeftColor ctermbg=248 - call popup_create('hello border', *{line: 2, col: 3, border: [], borderhighlight: ['BlueColor']}) - call popup_create(['hello border', 'and more'], *{line: 2, col: 23, border: [], borderhighlight: ['TopColor', 'RightColor', 'BottomColor', 'LeftColor']}) - call popup_create(['hello border', 'lines only'], *{line: 2, col: 43, border: [], borderhighlight: ['BlueColor'], borderchars: ['x']}) - call popup_create(['hello border', 'with corners'], *{line: 2, col: 60, border: [], borderhighlight: ['BlueColor'], borderchars: ['x', '#']}) - let winid = popup_create(['hello border', 'with numbers'], *{line: 6, col: 3, border: [], borderhighlight: ['BlueColor'], borderchars: ['0', '1', '2', '3', '4', '5', '6', '7']}) - call popup_create(['hello border', 'just blanks'], *{line: 7, col: 23, border: [], borderhighlight: ['BlueColor'], borderchars: [' ']}) + call popup_create('hello border', ~{line: 2, col: 3, border: [], borderhighlight: ['BlueColor']}) + call popup_create(['hello border', 'and more'], ~{line: 2, col: 23, border: [], borderhighlight: ['TopColor', 'RightColor', 'BottomColor', 'LeftColor']}) + call popup_create(['hello border', 'lines only'], ~{line: 2, col: 43, border: [], borderhighlight: ['BlueColor'], borderchars: ['x']}) + call popup_create(['hello border', 'with corners'], ~{line: 2, col: 60, border: [], borderhighlight: ['BlueColor'], borderchars: ['x', '#']}) + let winid = popup_create(['hello border', 'with numbers'], ~{line: 6, col: 3, border: [], borderhighlight: ['BlueColor'], borderchars: ['0', '1', '2', '3', '4', '5', '6', '7']}) + call popup_create(['hello border', 'just blanks'], ~{line: 7, col: 23, border: [], borderhighlight: ['BlueColor'], borderchars: [' ']}) func MultiByte() - call popup_create(['hello'], *{line: 8, col: 43, border: [], borderchars: ['─', '│', '─', '│', '┌', '┐', '┘', '└']}) + call popup_create(['hello'], ~{line: 8, col: 43, border: [], borderchars: ['─', '│', '─', '│', '┌', '┐', '┘', '└']}) endfunc END call writefile(lines, 'XtestPopupBorder') - let buf = RunVimInTerminal('-S XtestPopupBorder', *{rows: 12}) + let buf = RunVimInTerminal('-S XtestPopupBorder', ~{rows: 12}) call VerifyScreenDump(buf, 'Test_popupwin_22', {}) " check that changing borderchars triggers a redraw - call term_sendkeys(buf, ":call popup_setoptions(winid, *{borderchars: ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']})\<CR>") + call term_sendkeys(buf, ":call popup_setoptions(winid, ~{borderchars: ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']})\<CR>") call VerifyScreenDump(buf, 'Test_popupwin_23', {}) " check multi-byte border only with 'ambiwidth' single @@ -134,7 +135,7 @@ func Test_popup_with_border_and_padding() call StopVimInTerminal(buf) call delete('XtestPopupBorder') - let with_border_or_padding = *{ + let with_border_or_padding = ~{ \ line: 2, \ core_line: 3, \ col: 3, @@ -146,13 +147,13 @@ func Test_popup_with_border_and_padding() \ firstline: 1, \ scrollbar: 0, \ visible: 1} - let winid = popup_create('hello border', *{line: 2, col: 3, border: []})", + let winid = popup_create('hello border', ~{line: 2, col: 3, border: []})", call assert_equal(with_border_or_padding, popup_getpos(winid)) let options = popup_getoptions(winid) call assert_equal([], options.border) call assert_false(has_key(options, "padding")) - let winid = popup_create('hello padding', *{line: 2, col: 3, padding: []}) + let winid = popup_create('hello padding', ~{line: 2, col: 3, padding: []}) let with_border_or_padding.width = 15 let with_border_or_padding.core_width = 13 call assert_equal(with_border_or_padding, popup_getpos(winid)) @@ -160,7 +161,7 @@ func Test_popup_with_border_and_padding() call assert_false(has_key(options, "border")) call assert_equal([], options.padding) - call popup_setoptions(winid, *{ + call popup_setoptions(winid, ~{ \ padding: [1, 2, 3, 4], \ border: [4, 0, 7, 8], \ borderhighlight: ['Top', 'Right', 'Bottom', 'Left'], @@ -172,8 +173,8 @@ func Test_popup_with_border_and_padding() call assert_equal(['Top', 'Right', 'Bottom', 'Left'], options.borderhighlight) call assert_equal(['1', '^', '2', '>', '3', 'v', '4', '<'], options.borderchars) - let winid = popup_create('hello both', *{line: 3, col: 8, border: [], padding: []}) - call assert_equal(*{ + let winid = popup_create('hello both', ~{line: 3, col: 8, border: [], padding: []}) + call assert_equal(~{ \ line: 3, \ core_line: 5, \ col: 8, @@ -202,11 +203,11 @@ func Test_popup_with_syntax_win_execute() \ '{', \ ' printf(123);', \ '}', - \], *{line: 3, col: 25, highlight: 'PopupColor'}) + \], ~{line: 3, col: 25, highlight: 'PopupColor'}) call win_execute(winid, 'set syntax=cpp') END call writefile(lines, 'XtestPopup') - let buf = RunVimInTerminal('-S XtestPopup', *{rows: 10}) + let buf = RunVimInTerminal('-S XtestPopup', ~{rows: 10}) call VerifyScreenDump(buf, 'Test_popupwin_10', {}) " clean up @@ -227,11 +228,11 @@ func Test_popup_with_syntax_setbufvar() \ '{', \ "\tprintf(567);", \ '}', - \], *{line: 3, col: 21, highlight: 'PopupColor'}) + \], ~{line: 3, col: 21, highlight: 'PopupColor'}) call setbufvar(winbufnr(winid), '&syntax', 'cpp') END call writefile(lines, 'XtestPopup') - let buf = RunVimInTerminal('-S XtestPopup', *{rows: 10}) + let buf = RunVimInTerminal('-S XtestPopup', ~{rows: 10}) call VerifyScreenDump(buf, 'Test_popupwin_11', {}) " clean up @@ -248,7 +249,7 @@ func Test_popup_with_matches() let winid = popup_create([ \ '111 222 333', \ '444 555 666', - \], *{line: 3, col: 10, border: []}) + \], ~{line: 3, col: 10, border: []}) set hlsearch /666 call matchadd('ErrorMsg', '111') @@ -257,7 +258,7 @@ func Test_popup_with_matches() call win_execute(winid, "call matchadd('ErrorMsg', '555')") END call writefile(lines, 'XtestPopupMatches') - let buf = RunVimInTerminal('-S XtestPopupMatches', *{rows: 10}) + let buf = RunVimInTerminal('-S XtestPopupMatches', ~{rows: 10}) call VerifyScreenDump(buf, 'Test_popupwin_matches', {}) " clean up @@ -273,7 +274,7 @@ func Test_popup_all_corners() call setline(1, repeat([repeat('-', 60)], 15)) set so=0 normal 2G3|r# - let winid1 = popup_create(['first', 'second'], *{ + let winid1 = popup_create(['first', 'second'], ~{ \ line: 'cursor+1', \ col: 'cursor', \ pos: 'topleft', @@ -281,7 +282,7 @@ func Test_popup_all_corners() \ padding: [], \ }) normal 25|r@ - let winid1 = popup_create(['First', 'SeconD'], *{ + let winid1 = popup_create(['First', 'SeconD'], ~{ \ line: 'cursor+1', \ col: 'cursor', \ pos: 'topright', @@ -289,7 +290,7 @@ func Test_popup_all_corners() \ padding: [], \ }) normal 9G29|r% - let winid1 = popup_create(['fiRSt', 'seCOnd'], *{ + let winid1 = popup_create(['fiRSt', 'seCOnd'], ~{ \ line: 'cursor-1', \ col: 'cursor', \ pos: 'botleft', @@ -297,7 +298,7 @@ func Test_popup_all_corners() \ padding: [], \ }) normal 51|r& - let winid1 = popup_create(['FIrsT', 'SEcoND'], *{ + let winid1 = popup_create(['FIrsT', 'SEcoND'], ~{ \ line: 'cursor-1', \ col: 'cursor', \ pos: 'botright', @@ -306,7 +307,7 @@ func Test_popup_all_corners() \ }) END call writefile(lines, 'XtestPopupCorners') - let buf = RunVimInTerminal('-S XtestPopupCorners', *{rows: 12}) + let buf = RunVimInTerminal('-S XtestPopupCorners', ~{rows: 12}) call VerifyScreenDump(buf, 'Test_popupwin_corners', {}) " clean up @@ -320,25 +321,25 @@ func Test_popup_firstline() endif let lines =<< trim END call setline(1, range(1, 20)) - call popup_create(['1111', '222222', '33333', '44', '5', '666666', '77777', '888', '9999999999999999'], *{ + call popup_create(['1111', '222222', '33333', '44', '5', '666666', '77777', '888', '9999999999999999'], ~{ \ maxheight: 4, \ firstline: 3, \ }) END call writefile(lines, 'XtestPopupFirstline') - let buf = RunVimInTerminal('-S XtestPopupFirstline', *{rows: 10}) + let buf = RunVimInTerminal('-S XtestPopupFirstline', ~{rows: 10}) call VerifyScreenDump(buf, 'Test_popupwin_firstline', {}) " clean up call StopVimInTerminal(buf) call delete('XtestPopupFirstline') - let winid = popup_create(['1111', '222222', '33333', '44444'], *{ + let winid = popup_create(['1111', '222222', '33333', '44444'], ~{ \ maxheight: 2, \ firstline: 3, \ }) call assert_equal(3, popup_getoptions(winid).firstline) - call popup_setoptions(winid, *{firstline: 1}) + call popup_setoptions(winid, ~{firstline: 1}) call assert_equal(1, popup_getoptions(winid).firstline) call popup_close(winid) @@ -351,7 +352,7 @@ func Test_popup_drag() " create a popup that covers the command line let lines =<< trim END call setline(1, range(1, 20)) - let winid = popup_create(['1111', '222222', '33333'], *{ + let winid = popup_create(['1111', '222222', '33333'], ~{ \ drag: 1, \ border: [], \ line: &lines - 4, @@ -363,7 +364,7 @@ func Test_popup_drag() map <silent> <F4> :call test_setmouse(&lines - 8, &columns / 2)<CR> END call writefile(lines, 'XtestPopupDrag') - let buf = RunVimInTerminal('-S XtestPopupDrag', *{rows: 10}) + let buf = RunVimInTerminal('-S XtestPopupDrag', ~{rows: 10}) call VerifyScreenDump(buf, 'Test_popupwin_drag_01', {}) call term_sendkeys(buf, ":call Dragit()\<CR>") @@ -381,7 +382,7 @@ func Test_popup_close_with_mouse() let lines =<< trim END call setline(1, range(1, 20)) " With border, can click on X - let winid = popup_create('foobar', *{ + let winid = popup_create('foobar', ~{ \ close: 'button', \ border: [], \ line: 1, @@ -390,18 +391,18 @@ func Test_popup_close_with_mouse() func CloseMsg(id, result) echomsg 'Popup closed with ' .. a:result endfunc - let winid = popup_create('notification', *{ + let winid = popup_create('notification', ~{ \ close: 'click', \ line: 3, \ col: 15, \ callback: 'CloseMsg', \ }) - let winid = popup_create('no border here', *{ + let winid = popup_create('no border here', ~{ \ close: 'button', \ line: 5, \ col: 3, \ }) - let winid = popup_create('only padding', *{ + let winid = popup_create('only padding', ~{ \ close: 'button', \ padding: [], \ line: 5, @@ -417,7 +418,7 @@ func Test_popup_close_with_mouse() map <silent> <F4> :call test_setmouse(3, 17)<CR> END call writefile(lines, 'XtestPopupClose') - let buf = RunVimInTerminal('-S XtestPopupClose', *{rows: 10}) + let buf = RunVimInTerminal('-S XtestPopupClose', ~{rows: 10}) call VerifyScreenDump(buf, 'Test_popupwin_close_01', {}) call term_sendkeys(buf, ":call CloseWithX()\<CR>") @@ -441,7 +442,7 @@ func Test_popup_with_mask() let winid = popup_create([ \ 'some text', \ 'another line', - \], *{ + \], ~{ \ line: 1, \ col: 10, \ wrap: 0, @@ -453,13 +454,13 @@ func Test_popup_with_mask() call popup_create([ \ 'xxxxxxxxx', \ 'yyyyyyyyy', - \], *{ + \], ~{ \ line: 3, \ col: 18, \ zindex: 20}) let winidb = popup_create([ \ 'just one line', - \], *{ + \], ~{ \ line: 7, \ col: 10, \ wrap: 0, @@ -471,23 +472,27 @@ func Test_popup_with_mask() \ mask: [[1,2,1,1], [-5,-1,4,4], [7,9,2,3], [3,5,5,5],[-7,-4,5,5]]}) END call writefile(lines, 'XtestPopupMask') - let buf = RunVimInTerminal('-S XtestPopupMask', *{rows: 13}) + let buf = RunVimInTerminal('-S XtestPopupMask', ~{rows: 13}) call VerifyScreenDump(buf, 'Test_popupwin_mask_1', {}) - call term_sendkeys(buf, ":call popup_move(winid, *{col: 11, line: 2})\<CR>") - call term_sendkeys(buf, ":call popup_move(winidb, *{col: 12})\<CR>") + call term_sendkeys(buf, ":call popup_move(winid, ~{col: 11, line: 2})\<CR>") + call term_sendkeys(buf, ":call popup_move(winidb, ~{col: 12})\<CR>") + call term_sendkeys(buf, ":\<CR>") call VerifyScreenDump(buf, 'Test_popupwin_mask_2', {}) - call term_sendkeys(buf, ":call popup_move(winid, *{col: 65, line: 2})\<CR>") - call term_sendkeys(buf, ":call popup_move(winidb, *{col: 63})\<CR>") + call term_sendkeys(buf, ":call popup_move(winid, ~{col: 65, line: 2})\<CR>") + call term_sendkeys(buf, ":call popup_move(winidb, ~{col: 63})\<CR>") + call term_sendkeys(buf, ":\<CR>") call VerifyScreenDump(buf, 'Test_popupwin_mask_3', {}) - call term_sendkeys(buf, ":call popup_move(winid, *{pos: 'topright', col: 12, line: 2})\<CR>") - call term_sendkeys(buf, ":call popup_move(winidb, *{pos: 'topright', col: 12})\<CR>") + call term_sendkeys(buf, ":call popup_move(winid, ~{pos: 'topright', col: 12, line: 2})\<CR>") + call term_sendkeys(buf, ":call popup_move(winidb, ~{pos: 'topright', col: 12})\<CR>") + call term_sendkeys(buf, ":\<CR>") call VerifyScreenDump(buf, 'Test_popupwin_mask_4', {}) - call term_sendkeys(buf, ":call popup_move(winid, *{pos: 'topright', col: 12, line: 11})\<CR>") - call term_sendkeys(buf, ":call popup_move(winidb, *{pos: 'topleft', col: 42, line: 11})\<CR>") + call term_sendkeys(buf, ":call popup_move(winid, ~{pos: 'topright', col: 12, line: 11})\<CR>") + call term_sendkeys(buf, ":call popup_move(winidb, ~{pos: 'topleft', col: 42, line: 11})\<CR>") + call term_sendkeys(buf, ":\<CR>") call VerifyScreenDump(buf, 'Test_popupwin_mask_5', {}) " clean up @@ -506,7 +511,7 @@ func Test_popup_select() let lines =<< trim END set clipboard=autoselect call setline(1, range(1, 20)) - let winid = popup_create(['the word', 'some more', 'several words here'], *{ + let winid = popup_create(['the word', 'some more', 'several words here'], ~{ \ drag: 1, \ border: [], \ line: 3, @@ -519,7 +524,7 @@ func Test_popup_select() map <silent> <F4> :call test_setmouse(6, 23)<CR> END call writefile(lines, 'XtestPopupSelect') - let buf = RunVimInTerminal('-S XtestPopupSelect', *{rows: 10}) + let buf = RunVimInTerminal('-S XtestPopupSelect', ~{rows: 10}) call term_sendkeys(buf, ":call Select1()\<CR>") call VerifyScreenDump(buf, 'Test_popupwin_select_01', {}) @@ -553,7 +558,7 @@ func Test_popup_in_tab() call assert_equal(0, bufexists(bufnr)) " global popup is visible in any tab - let winid = popup_create("text", *{tabpage: -1}) + let winid = popup_create("text", ~{tabpage: -1}) call assert_equal(1, popup_getpos(winid).visible) call assert_equal(-1, popup_getoptions(winid).tabpage) tabnew @@ -565,7 +570,7 @@ func Test_popup_in_tab() " create popup in other tab tabnew - let winid = popup_create("text", *{tabpage: 1}) + let winid = popup_create("text", ~{tabpage: 1}) call assert_equal(0, popup_getpos(winid).visible) call assert_equal(1, popup_getoptions(winid).tabpage) quit @@ -576,19 +581,19 @@ endfunc func Test_popup_valid_arguments() " Zero value is like the property wasn't there - let winid = popup_create("text", *{col: 0}) + let winid = popup_create("text", ~{col: 0}) let pos = popup_getpos(winid) call assert_inrange(&columns / 2 - 1, &columns / 2 + 1, pos.col) call popup_clear() " using cursor column has minimum value of 1 - let winid = popup_create("text", *{col: 'cursor-100'}) + let winid = popup_create("text", ~{col: 'cursor-100'}) let pos = popup_getpos(winid) call assert_equal(1, pos.col) call popup_clear() " center - let winid = popup_create("text", *{pos: 'center'}) + let winid = popup_create("text", ~{pos: 'center'}) let pos = popup_getpos(winid) let around = (&columns - pos.width) / 2 call assert_inrange(around - 1, around + 1, pos.col) @@ -603,40 +608,40 @@ func Test_popup_invalid_arguments() call assert_fails('call popup_create("text", "none")', 'E715:') call popup_clear() - call assert_fails('call popup_create("text", *{col: "xxx"})', 'E475:') + call assert_fails('call popup_create("text", ~{col: "xxx"})', 'E475:') call popup_clear() - call assert_fails('call popup_create("text", *{col: "cursor8"})', 'E15:') + call assert_fails('call popup_create("text", ~{col: "cursor8"})', 'E15:') call popup_clear() - call assert_fails('call popup_create("text", *{col: "cursor+x"})', 'E15:') + call assert_fails('call popup_create("text", ~{col: "cursor+x"})', 'E15:') call popup_clear() - call assert_fails('call popup_create("text", *{col: "cursor+8x"})', 'E15:') + call assert_fails('call popup_create("text", ~{col: "cursor+8x"})', 'E15:') call popup_clear() - call assert_fails('call popup_create("text", *{line: "xxx"})', 'E475:') + call assert_fails('call popup_create("text", ~{line: "xxx"})', 'E475:') call popup_clear() - call assert_fails('call popup_create("text", *{line: "cursor8"})', 'E15:') + call assert_fails('call popup_create("text", ~{line: "cursor8"})', 'E15:') call popup_clear() - call assert_fails('call popup_create("text", *{line: "cursor+x"})', 'E15:') + call assert_fails('call popup_create("text", ~{line: "cursor+x"})', 'E15:') call popup_clear() - call assert_fails('call popup_create("text", *{line: "cursor+8x"})', 'E15:') + call assert_fails('call popup_create("text", ~{line: "cursor+8x"})', 'E15:') call popup_clear() - call assert_fails('call popup_create("text", *{pos: "there"})', 'E475:') + call assert_fails('call popup_create("text", ~{pos: "there"})', 'E475:') call popup_clear() - call assert_fails('call popup_create("text", *{padding: "none"})', 'E714:') + call assert_fails('call popup_create("text", ~{padding: "none"})', 'E714:') call popup_clear() - call assert_fails('call popup_create("text", *{border: "none"})', 'E714:') + call assert_fails('call popup_create("text", ~{border: "none"})', 'E714:') call popup_clear() - call assert_fails('call popup_create("text", *{borderhighlight: "none"})', 'E714:') + call assert_fails('call popup_create("text", ~{borderhighlight: "none"})', 'E714:') call popup_clear() - call assert_fails('call popup_create("text", *{borderchars: "none"})', 'E714:') + call assert_fails('call popup_create("text", ~{borderchars: "none"})', 'E714:') call popup_clear() |