Patch 8.1.1705
Problem: Using ~{} for a literal dict is not nice.
Solution: Use #{} instead.
Files: runtime/doc/eval.txt runtime/doc/popup.txt, src/eval.c,
src/testdir/test_listdict.vim src/testdir/test_popupwin.vim
*** ../vim-8.1.1704/runtime/doc/eval.txt 2019-07-14 18:22:53.789089005 +0200
--- runtime/doc/eval.txt 2019-07-16 21:53:00.085639968 +0200
***************
*** 60,66 ****
value. |Dictionary|
Examples:
{'blue': "#0000ff", 'red': "#ff0000"}
! ~{blue: "#0000ff", red: "#ff0000"}
Funcref A reference to a function |Funcref|.
Example: function("strlen")
--- 60,66 ----
value. |Dictionary|
Examples:
{'blue': "#0000ff", 'red': "#ff0000"}
! #{blue: "#0000ff", red: "#ff0000"}
Funcref A reference to a function |Funcref|.
Example: function("strlen")
***************
*** 482,492 ****
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
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}
! 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
nested Dictionary: >
--- 482,492 ----
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
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}
! Note that 333 here is the string "333". Empty keys are not possible with #{}.
A value can be any expression. Using a Dictionary for a value creates a
nested Dictionary: >
*** ../vim-8.1.1704/runtime/doc/popup.txt 2019-07-14 18:22:53.789089005 +0200
--- runtime/doc/popup.txt 2019-07-16 21:53:20.965547639 +0200
***************
*** 178,184 ****
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}, ~{
\ pos: 'botleft',
\ line: 'cursor-1',
\ col: 'cursor',
--- 178,184 ----
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}, #{
\ pos: 'botleft',
\ line: 'cursor-1',
\ col: 'cursor',
***************
*** 191,197 ****
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}, ~{
\ pos: 'botleft',
\ line: pos.row - 1,
\ col: pos.col,
--- 191,197 ----
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}, #{
\ pos: 'botleft',
\ line: pos.row - 1,
\ col: pos.col,
***************
*** 240,246 ****
popup_dialog({what}, {options}) *popup_dialog()*
Just like |popup_create()| but with these default options: >
! call popup_create({what}, ~{
\ pos: 'center',
\ zindex: 200,
\ drag: 1,
--- 240,246 ----
popup_dialog({what}, {options}) *popup_dialog()*
Just like |popup_create()| but with these default options: >
! call popup_create({what}, #{
\ pos: 'center',
\ zindex: 200,
\ drag: 1,
***************
*** 249,255 ****
\})
< 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)?', ~{
\ filter: 'popup_filter_yesno',
\ callback: 'QuitCallback',
\ })
--- 249,255 ----
\})
< 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)?', #{
\ filter: 'popup_filter_yesno',
\ callback: 'QuitCallback',
\ })
***************
*** 356,362 ****
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}, ~{
\ pos: 'center',
\ zindex: 200,
\ drag: 1,
--- 356,362 ----
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}, #{
\ pos: 'center',
\ zindex: 200,
\ drag: 1,
***************
*** 391,397 ****
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}, ~{
\ line: 1,
\ col: 10,
\ minwidth: 20,
--- 391,397 ----
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}, #{
\ line: 1,
\ col: 10,
\ minwidth: 20,
***************
*** 732,738 ****
endif
endfunc
! call popup_dialog('Continue? y/n', ~{
\ filter: 'popup_filter_yesno',
\ callback: 'MyDialogHandler',
\ })
--- 732,738 ----
endif
endfunc
! call popup_dialog('Continue? y/n', #{
\ filter: 'popup_filter_yesno',
\ callback: 'MyDialogHandler',
\ })
***************
*** 740,746 ****
*popup_menu-shortcut-example*
Extend popup_filter_menu() with shortcut keys: >
! call popup_menu(['Save', 'Cancel', 'Discard'], ~{
\ filter: 'MyMenuFilter',
\ callback: 'MyMenuHandler',
\ })
--- 740,746 ----
*popup_menu-shortcut-example*
Extend popup_filter_menu() with shortcut keys: >
! call popup_menu(['Save', 'Cancel', 'Discard'], #{
\ filter: 'MyMenuFilter',
\ callback: 'MyMenuHandler',
\ })
***************
*** 781,787 ****
endif
call popup_close(s:winid)
endif
! let s:winid = popup_beval(v:beval_text, ~{mousemoved: 'word'})
let s:last_text = v:beval_text
return ''
endfunc
--- 781,787 ----
endif
call popup_close(s:winid)
endif
! let s:winid = popup_beval(v:beval_text, #{mousemoved: 'word'})
let s:last_text = v:beval_text
return ''
endfunc
***************
*** 812,818 ****
endfunc
func ShowPopup(id)
! let s:winid = popup_beval(s:balloonText, ~{mousemoved: 'word'})
endfunc
<
--- 812,818 ----
endfunc
func ShowPopup(id)
! let s:winid = popup_beval(s:balloonText, #{mousemoved: 'word'})
endfunc
<
*** ../vim-8.1.1704/src/eval.c 2019-07-14 18:22:53.793088979 +0200
--- src/eval.c 2019-07-16 21:54:36.057215599 +0200
***************
*** 4392,4398 ****
* (expression) nested expression
* [expr, expr] List
* {key: val, key: val} Dictionary
! * ~{key: val, key: val} Dictionary with literal keys
*
* Also handle:
* ! in front logical NOT
--- 4392,4398 ----
* (expression) nested expression
* [expr, expr] List
* {key: val, key: val} Dictionary
! * #{key: val, key: val} Dictionary with literal keys
*
* Also handle:
* ! in front logical NOT
***************
*** 4577,4585 ****
break;
/*
! * Dictionary: ~{key: val, key: val}
*/
! case '~': if ((*arg)[1] == '{')
{
++*arg;
ret = dict_get_tv(arg, rettv, evaluate, TRUE);
--- 4577,4585 ----
break;
/*
! * Dictionary: #{key: val, key: val}
*/
! case '#': if ((*arg)[1] == '{')
{
++*arg;
ret = dict_get_tv(arg, rettv, evaluate, TRUE);
***************
*** 7963,7970 ****
*varname = name + 2;
if (*name == 'g') /* global variable */
return &globvarht;
! /* There must be no ':' or '#' in the rest of the name, unless g: is used
! */
if (vim_strchr(name + 2, ':') != NULL
|| vim_strchr(name + 2, AUTOLOAD_CHAR) != NULL)
return NULL;
--- 7963,7969 ----
*varname = name + 2;
if (*name == 'g') /* global variable */
return &globvarht;
! // There must be no ':' or '#' in the rest of the name, unless g: is used
if (vim_strchr(name + 2, ':') != NULL
|| vim_strchr(name + 2, AUTOLOAD_CHAR) != NULL)
return NULL;
*** ../vim-8.1.1704/src/testdir/test_listdict.vim 2019-07-14 18:22:53.793088979 +0200
--- src/testdir/test_listdict.vim 2019-07-16 21:55:00.153109087 +0200
***************
*** 281,287 ****
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},)
" why *{} cannot be used
let blue = 'blue'
--- 281,287 ----
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},)
" why *{} cannot be used
let blue = 'blue'
*** ../vim-8.1.1704/src/testdir/test_popupwin.vim 2019-07-14 18:22:53.793088979 +0200
--- src/testdir/test_popupwin.vim 2019-07-16 21:56:41.160662765 +0200
***************
*** 14,36 ****
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 setwinvar(winid2, '&wincolor', 'PopupColor2')
END
call writefile(lines, 'XtestPopup')
! 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: [~{"
\ .. "col: 3, length: 7, minwidth: 20, type: 'comment'"
\ .. "}]},"
! \ .. "], ~{line: 4, col: 9, minwidth: 20})\<CR>")
call VerifyScreenDump(buf, 'Test_popupwin_02', {})
" switch back to first tabpage
--- 14,36 ----
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 setwinvar(winid2, '&wincolor', 'PopupColor2')
END
call writefile(lines, 'XtestPopup')
! 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: [#{"
\ .. "col: 3, length: 7, minwidth: 20, type: 'comment'"
\ .. "}]},"
! \ .. "], #{line: 4, col: 9, minwidth: 20})\<CR>")
call VerifyScreenDump(buf, 'Test_popupwin_02', {})
" switch back to first tabpage
***************
*** 48,54 ****
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, ":redraw\<CR>")
call VerifyScreenDump(buf, 'Test_popupwin_05', {})
--- 48,54 ----
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, ":redraw\<CR>")
call VerifyScreenDump(buf, 'Test_popupwin_05', {})
***************
*** 59,65 ****
" 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, ":\<CR>")
call VerifyScreenDump(buf, 'Test_popupwin_07', {})
--- 59,65 ----
" 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, ":\<CR>")
call VerifyScreenDump(buf, 'Test_popupwin_07', {})
***************
*** 84,100 ****
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]})
END
call insert(lines, iter == 1 ? '' : 'set enc=latin1')
call writefile(lines, 'XtestPopupBorder')
! let buf = RunVimInTerminal('-S XtestPopupBorder', ~{rows: 15})
call VerifyScreenDump(buf, 'Test_popupwin_2' .. iter, {})
call StopVimInTerminal(buf)
--- 84,100 ----
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]})
END
call insert(lines, iter == 1 ? '' : 'set enc=latin1')
call writefile(lines, 'XtestPopupBorder')
! let buf = RunVimInTerminal('-S XtestPopupBorder', #{rows: 15})
call VerifyScreenDump(buf, 'Test_popupwin_2' .. iter, {})
call StopVimInTerminal(buf)
***************
*** 108,129 ****
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: [' ']})
func MultiByte()
! call popup_create(['hello'], ~{line: 8, col: 43, border: [], borderchars: ['─', '│', '─', '│', '┌', '┐', '┘', '└']})
endfunc
END
call writefile(lines, 'XtestPopupBorder')
! 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 VerifyScreenDump(buf, 'Test_popupwin_23', {})
" check multi-byte border only with 'ambiwidth' single
--- 108,129 ----
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: [' ']})
func MultiByte()
! call popup_create(['hello'], #{line: 8, col: 43, border: [], borderchars: ['─', '│', '─', '│', '┌', '┐', '┘', '└']})
endfunc
END
call writefile(lines, 'XtestPopupBorder')
! 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 VerifyScreenDump(buf, 'Test_popupwin_23', {})
" check multi-byte border only with 'ambiwidth' single
***************
*** 135,141 ****
call StopVimInTerminal(buf)
call delete('XtestPopupBorder')
! let with_border_or_padding = ~{
\ line: 2,
\ core_line: 3,
\ col: 3,
--- 135,141 ----
call StopVimInTerminal(buf)
call delete('XtestPopupBorder')
! let with_border_or_padding = #{
\ line: 2,
\ core_line: 3,
\ col: 3,
***************
*** 147,159 ****
\ firstline: 1,
\ scrollbar: 0,
\ visible: 1}
! 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 with_border_or_padding.width = 15
let with_border_or_padding.core_width = 13
call assert_equal(with_border_or_padding, popup_getpos(winid))
--- 147,159 ----
\ firstline: 1,
\ scrollbar: 0,
\ visible: 1}
! 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 with_border_or_padding.width = 15
let with_border_or_padding.core_width = 13
call assert_equal(with_border_or_padding, popup_getpos(winid))
***************
*** 161,167 ****
call assert_false(has_key(options, "border"))
call assert_equal([], options.padding)
! call popup_setoptions(winid, ~{
\ padding: [1, 2, 3, 4],
\ border: [4, 0, 7, 8],
\ borderhighlight: ['Top', 'Right', 'Bottom', 'Left'],
--- 161,167 ----
call assert_false(has_key(options, "border"))
call assert_equal([], options.padding)
! call popup_setoptions(winid, #{
\ padding: [1, 2, 3, 4],
\ border: [4, 0, 7, 8],
\ borderhighlight: ['Top', 'Right', 'Bottom', 'Left'],
***************
*** 173,180 ****
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(~{
\ line: 3,
\ core_line: 5,
\ col: 8,
--- 173,180 ----
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(#{
\ line: 3,
\ core_line: 5,
\ col: 8,
***************
*** 203,213 ****
\ '{',
\ ' printf(123);',
\ '}',
! \], ~{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})
call VerifyScreenDump(buf, 'Test_popupwin_10', {})
" clean up
--- 203,213 ----
\ '{',
\ ' printf(123);',
\ '}',
! \], #{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})
call VerifyScreenDump(buf, 'Test_popupwin_10', {})
" clean up
***************
*** 228,238 ****
\ '{',
\ "\tprintf(567);",
\ '}',
! \], ~{line: 3, col: 21, highlight: 'PopupColor'})
call setbufvar(winbufnr(winid), '&syntax', 'cpp')
END
call writefile(lines, 'XtestPopup')
! let buf = RunVimInTerminal('-S XtestPopup', ~{rows: 10})
call VerifyScreenDump(buf, 'Test_popupwin_11', {})
" clean up
--- 228,238 ----
\ '{',
\ "\tprintf(567);",
\ '}',
! \], #{line: 3, col: 21, highlight: 'PopupColor'})
call setbufvar(winbufnr(winid), '&syntax', 'cpp')
END
call writefile(lines, 'XtestPopup')
! let buf = RunVimInTerminal('-S XtestPopup', #{rows: 10})
call VerifyScreenDump(buf, 'Test_popupwin_11', {})
" clean up
***************
*** 249,255 ****
let winid = popup_create([
\ '111 222 333',
\ '444 555 666',
! \], ~{line: 3, col: 10, border: []})
set hlsearch
/666
call matchadd('ErrorMsg', '111')
--- 249,255 ----
let winid = popup_create([
\ '111 222 333',
\ '444 555 666',
! \], #{line: 3, col: 10, border: []})
set hlsearch
/666
call matchadd('ErrorMsg', '111')
***************
*** 258,264 ****
call win_execute(winid, "call matchadd('ErrorMsg', '555')")
END
call writefile(lines, 'XtestPopupMatches')
! let buf = RunVimInTerminal('-S XtestPopupMatches', ~{rows: 10})
call VerifyScreenDump(buf, 'Test_popupwin_matches', {})
" clean up
--- 258,264 ----
call win_execute(winid, "call matchadd('ErrorMsg', '555')")
END
call writefile(lines, 'XtestPopupMatches')
! let buf = RunVimInTerminal('-S XtestPopupMatches', #{rows: 10})
call VerifyScreenDump(buf, 'Test_popupwin_matches', {})
" clean up
***************
*** 274,280 ****
call setline(1, repeat([repeat('-', 60)], 15))
set so=0
normal 2G3|r#
! let winid1 = popup_create(['first', 'second'], ~{
\ line: 'cursor+1',
\ col: 'cursor',
\ pos: 'topleft',
--- 274,280 ----
call setline(1, repeat([repeat('-', 60)], 15))
set so=0
normal 2G3|r#
! let winid1 = popup_create(['first', 'second'], #{
\ line: 'cursor+1',
\ col: 'cursor',
\ pos: 'topleft',
***************
*** 282,288 ****
\ padding: [],
\ })
normal 25|r@
! let winid1 = popup_create(['First', 'SeconD'], ~{
\ line: 'cursor+1',
\ col: 'cursor',
\ pos: 'topright',
--- 282,288 ----
\ padding: [],
\ })
normal 25|r@
! let winid1 = popup_create(['First', 'SeconD'], #{
\ line: 'cursor+1',
\ col: 'cursor',
\ pos: 'topright',
***************
*** 290,296 ****
\ padding: [],
\ })
normal 9G29|r%
! let winid1 = popup_create(['fiRSt', 'seCOnd'], ~{
\ line: 'cursor-1',
\ col: 'cursor',
\ pos: 'botleft',
--- 290,296 ----
\ padding: [],
\ })
normal 9G29|r%
! let winid1 = popup_create(['fiRSt', 'seCOnd'], #{
\ line: 'cursor-1',
\ col: 'cursor',
\ pos: 'botleft',
***************
*** 298,304 ****
\ padding: [],
\ })
normal 51|r&
! let winid1 = popup_create(['FIrsT', 'SEcoND'], ~{
\ line: 'cursor-1',
\ col: 'cursor',
\ pos: 'botright',
--- 298,304 ----
\ padding: [],
\ })
normal 51|r&
! let winid1 = popup_create(['FIrsT', 'SEcoND'], #{
\ line: 'cursor-1',
\ col: 'cursor',
\ pos: 'botright',
***************
*** 307,313 ****
\ })
END
call writefile(lines, 'XtestPopupCorners')
! let buf = RunVimInTerminal('-S XtestPopupCorners', ~{rows: 12})
call VerifyScreenDump(buf, 'Test_popupwin_corners', {})
" clean up
--- 307,313 ----
\ })
END
call writefile(lines, 'XtestPopupCorners')
! let buf = RunVimInTerminal('-S XtestPopupCorners', #{rows: 12})
call VerifyScreenDump(buf, 'Test_popupwin_corners', {})
" clean up
***************
*** 321,345 ****
endif
let lines =<< trim END
call setline(1, range(1, 20))
! 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})
call VerifyScreenDump(buf, 'Test_popupwin_firstline', {})
" clean up
call StopVimInTerminal(buf)
call delete('XtestPopupFirstline')
! 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 assert_equal(1, popup_getoptions(winid).firstline)
call popup_close(winid)
--- 321,345 ----
endif
let lines =<< trim END
call setline(1, range(1, 20))
! 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})
call VerifyScreenDump(buf, 'Test_popupwin_firstline', {})
" clean up
call StopVimInTerminal(buf)
call delete('XtestPopupFirstline')
! 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 assert_equal(1, popup_getoptions(winid).firstline)
call popup_close(winid)
***************
*** 352,358 ****
" 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'], ~{
\ drag: 1,
\ border: [],
\ line: &lines - 4,
--- 352,358 ----
" 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'], #{
\ drag: 1,
\ border: [],
\ line: &lines - 4,
***************
*** 364,370 ****
map <silent> <F4> :call test_setmouse(&lines - 8, &columns / 2)<CR>
END
call writefile(lines, 'XtestPopupDrag')
! let buf = RunVimInTerminal('-S XtestPopupDrag', ~{rows: 10})
call VerifyScreenDump(buf, 'Test_popupwin_drag_01', {})
call term_sendkeys(buf, ":call Dragit()\<CR>")
--- 364,370 ----
map <silent> <F4> :call test_setmouse(&lines - 8, &columns / 2)<CR>
END
call writefile(lines, 'XtestPopupDrag')
! let buf = RunVimInTerminal('-S XtestPopupDrag', #{rows: 10})
call VerifyScreenDump(buf, 'Test_popupwin_drag_01', {})
call term_sendkeys(buf, ":call Dragit()\<CR>")
***************
*** 382,388 ****
let lines =<< trim END
call setline(1, range(1, 20))
" With border, can click on X
! let winid = popup_create('foobar', ~{
\ close: 'button',
\ border: [],
\ line: 1,
--- 382,388 ----
let lines =<< trim END
call setline(1, range(1, 20))
" With border, can click on X
! let winid = popup_create('foobar', #{
\ close: 'button',
\ border: [],
\ line: 1,
***************
*** 391,408 ****
func CloseMsg(id, result)
echomsg 'Popup closed with ' .. a:result
endfunc
! let winid = popup_create('notification', ~{
\ close: 'click',
\ line: 3,
\ col: 15,
\ callback: 'CloseMsg',
\ })
! let winid = popup_create('no border here', ~{
\ close: 'button',
\ line: 5,
\ col: 3,
\ })
! let winid = popup_create('only padding', ~{
\ close: 'button',
\ padding: [],
\ line: 5,
--- 391,408 ----
func CloseMsg(id, result)
echomsg 'Popup closed with ' .. a:result
endfunc
! let winid = popup_create('notification', #{
\ close: 'click',
\ line: 3,
\ col: 15,
\ callback: 'CloseMsg',
\ })
! let winid = popup_create('no border here', #{
\ close: 'button',
\ line: 5,
\ col: 3,
\ })
! let winid = popup_create('only padding', #{
\ close: 'button',
\ padding: [],
\ line: 5,
***************
*** 418,424 ****
map <silent> <F4> :call test_setmouse(3, 17)<CR>
END
call writefile(lines, 'XtestPopupClose')
! let buf = RunVimInTerminal('-S XtestPopupClose', ~{rows: 10})
call VerifyScreenDump(buf, 'Test_popupwin_close_01', {})
call term_sendkeys(buf, ":call CloseWithX()\<CR>")
--- 418,424 ----
map <silent> <F4> :call test_setmouse(3, 17)<CR>
END
call writefile(lines, 'XtestPopupClose')
! let buf = RunVimInTerminal('-S XtestPopupClose', #{rows: 10})
call VerifyScreenDump(buf, 'Test_popupwin_close_01', {})
call term_sendkeys(buf, ":call CloseWithX()\<CR>")
***************
*** 442,448 ****
let winid = popup_create([
\ 'some text',
\ 'another line',
! \], ~{
\ line: 1,
\ col: 10,
\ wrap: 0,
--- 442,448 ----
let winid = popup_create([
\ 'some text',
\ 'another line',
! \], #{
\ line: 1,
\ col: 10,
\ wrap: 0,
***************
*** 454,466 ****
call popup_create([
\ 'xxxxxxxxx',
\ 'yyyyyyyyy',
! \], ~{
\ line: 3,
\ col: 18,
\ zindex: 20})
let winidb = popup_create([
\ 'just one line',
! \], ~{
\ line: 7,
\ col: 10,
\ wrap: 0,
--- 454,466 ----
call popup_create([
\ 'xxxxxxxxx',
\ 'yyyyyyyyy',
! \], #{
\ line: 3,
\ col: 18,
\ zindex: 20})
let winidb = popup_create([
\ 'just one line',
! \], #{
\ line: 7,
\ col: 10,
\ wrap: 0,
***************
*** 472,497 ****
\ 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})
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, ":\<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, ":\<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, ":\<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, ":\<CR>")
call VerifyScreenDump(buf, 'Test_popupwin_mask_5', {})
--- 472,497 ----
\ 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})
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, ":\<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, ":\<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, ":\<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, ":\<CR>")
call VerifyScreenDump(buf, 'Test_popupwin_mask_5', {})
***************
*** 511,517 ****
let lines =<< trim END
set clipboard=autoselect
call setline(1, range(1, 20))
! let winid = popup_create(['the word', 'some more', 'several words here'], ~{
\ drag: 1,
\ border: [],
\ line: 3,
--- 511,517 ----
let lines =<< trim END
set clipboard=autoselect
call setline(1, range(1, 20))
! let winid = popup_create(['the word', 'some more', 'several words here'], #{
\ drag: 1,
\ border: [],
\ line: 3,
***************
*** 524,530 ****
map <silent> <F4> :call test_setmouse(6, 23)<CR>
END
call writefile(lines, 'XtestPopupSelect')
! let buf = RunVimInTerminal('-S XtestPopupSelect', ~{rows: 10})
call term_sendkeys(buf, ":call Select1()\<CR>")
call VerifyScreenDump(buf, 'Test_popupwin_select_01', {})
--- 524,530 ----
map <silent> <F4> :call test_setmouse(6, 23)<CR>
END
call writefile(lines, 'XtestPopupSelect')
! let buf = RunVimInTerminal('-S XtestPopupSelect', #{rows: 10})
call term_sendkeys(buf, ":call Select1()\<CR>")
call VerifyScreenDump(buf, 'Test_popupwin_select_01', {})
***************
*** 558,564 ****
call assert_equal(0, bufexists(bufnr))
" global popup is visible in any tab
! let winid = popup_create("text", ~{tabpage: -1})
call assert_equal(1, popup_getpos(winid).visible)
call assert_equal(-1, popup_getoptions(winid).tabpage)
tabnew
--- 558,564 ----
call assert_equal(0, bufexists(bufnr))
" global popup is visible in any tab
! let winid = popup_create("text", #{tabpage: -1})
call assert_equal(1, popup_getpos(winid).visible)
call assert_equal(-1, popup_getoptions(winid).tabpage)
tabnew
***************
*** 570,576 ****
" create popup in other tab
tabnew
! let winid = popup_create("text", ~{tabpage: 1})
call assert_equal(0, popup_getpos(winid).visible)
call assert_equal(1, popup_getoptions(winid).tabpage)
quit
--- 570,576 ----
" create popup in other tab
tabnew
! let winid = popup_create("text", #{tabpage: 1})
call assert_equal(0, popup_getpos(winid).visible)
call assert_equal(1, popup_getoptions(winid).tabpage)
quit
***************
*** 581,599 ****
func Test_popup_valid_arguments()
" Zero value is like the property wasn't there
! 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 pos = popup_getpos(winid)
call assert_equal(1, pos.col)
call popup_clear()
" 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)
--- 581,599 ----
func Test_popup_valid_arguments()
" Zero value is like the property wasn't there
! 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 pos = popup_getpos(winid)
call assert_equal(1, pos.col)
call popup_clear()
" 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)
***************
*** 608,647 ****
call assert_fails('call popup_create("text", "none")', 'E715:')
call popup_clear()
! call assert_fails('call popup_create("text", ~{col: "xxx"})', 'E475:')
call popup_clear()
! 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 popup_clear()
! 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 popup_clear()
! 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 popup_clear()
! 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 popup_clear()
! call assert_fails('call popup_create("text", ~{padding: "none"})', 'E714:')
call popup_clear()
! call assert_fails('call popup_create("text", ~{border: "none"})', 'E714:')
call popup_clear()
! call assert_fails('call popup_create("text", ~{borderhighlight: "none"})', 'E714:')
call popup_clear()
! call assert_fails('call popup_create("text", ~{borderchars: "none"})', 'E714:')
call popup_clear()
! call assert_fails('call popup_create([~{text: "text"}, 666], {})', 'E715:')
call popup_clear()
! call assert_fails('call popup_create([~{text: "text", props: "none"}], {})', 'E714:')
call popup_clear()
! call assert_fails('call popup_create([~{text: "text", props: ["none"]}], {})', 'E715:')
call popup_clear()
endfunc
--- 608,647 ----
call assert_fails('call popup_create("text", "none")', 'E715:')
call popup_clear()
! call assert_fails('call popup_create("text", #{col: "xxx"})', 'E475:')
call popup_clear()
! 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 popup_clear()
! 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 popup_clear()
! 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 popup_clear()
! 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 popup_clear()
! call assert_fails('call popup_create("text", #{padding: "none"})', 'E714:')
call popup_clear()
! call assert_fails('call popup_create("text", #{border: "none"})', 'E714:')
call popup_clear()
! call assert_fails('call popup_create("text", #{borderhighlight: "none"})', 'E714:')
call popup_clear()
! call assert_fails('call popup_create("text", #{borderchars: "none"})', 'E714:')
call popup_clear()
! call assert_fails('call popup_create([#{text: "text"}, 666], {})', 'E715:')
call popup_clear()
! call assert_fails('call popup_create([#{text: "text", props: "none"}], {})', 'E714:')
call popup_clear()
! call assert_fails('call popup_create([#{text: "text", props: ["none"]}], {})', 'E715:')
call popup_clear()
endfunc
***************
*** 681,690 ****
call setline(1, range(1, 100))
let winid = popup_create(
\ 'a long line that wont fit',
! \ ~{line: 3, col: 20, maxwidth: 10, wrap: 1})
END
call writefile(lines, 'XtestPopup')
! let buf = RunVimInTerminal('-S XtestPopup', ~{rows: 10})
call VerifyScreenDump(buf, 'Test_popupwin_wrap', {})
" clean up
--- 681,690 ----
call setline(1, range(1, 100))
let winid = popup_create(
\ 'a long line that wont fit',
! \ #{line: 3, col: 20, maxwidth: 10, wrap: 1})
END
call writefile(lines, 'XtestPopup')
! let buf = RunVimInTerminal('-S XtestPopup', #{rows: 10})
call VerifyScreenDump(buf, 'Test_popupwin_wrap', {})
" clean up
***************
*** 700,709 ****
call setline(1, range(1, 100))
let winid = popup_create(
\ 'a long line that wont fit',
! \ ~{line: 3, col: 20, maxwidth: 10, wrap: 0})
END
call writefile(lines, 'XtestPopup')
! let buf = RunVimInTerminal('-S XtestPopup', ~{rows: 10})
call VerifyScreenDump(buf, 'Test_popupwin_nowrap', {})
" clean up
--- 700,709 ----
call setline(1, range(1, 100))
let winid = popup_create(
\ 'a long line that wont fit',
! \ #{line: 3, col: 20, maxwidth: 10, wrap: 0})
END
call writefile(lines, 'XtestPopup')
! let buf = RunVimInTerminal('-S XtestPopup', #{rows: 10})
call VerifyScreenDump(buf, 'Test_popupwin_nowrap', {})
" clean up
***************
*** 718,724 ****
topleft vnew
call setline(1, 'hello')
! let winid = popup_create('world', ~{
\ line: 1,
\ col: 1,
\ minwidth: 20,
--- 718,724 ----
topleft vnew
call setline(1, 'hello')
! let winid = popup_create('world', #{
\ line: 1,
\ col: 1,
\ minwidth: 20,
***************
*** 738,744 ****
let line = join(map(range(1, 5), 'screenstring(1, v:val)'), '')
call assert_equal('hello', line)
! call popup_create('on the command line', ~{
\ line: &lines,
\ col: 10,
\ minwidth: 20,
--- 738,744 ----
let line = join(map(range(1, 5), 'screenstring(1, v:val)'), '')
call assert_equal('hello', line)
! call popup_create('on the command line', #{
\ line: &lines,
\ col: 10,
\ minwidth: 20,
***************
*** 760,766 ****
topleft vnew
call setline(1, 'hello')
! let winid = popup_create('world', ~{
\ line: 1,
\ col: 1,
\ minwidth: 20,
--- 760,766 ----
topleft vnew
call setline(1, 'hello')
! let winid = popup_create('world', #{
\ line: 1,
\ col: 1,
\ minwidth: 20,
***************
*** 806,812 ****
topleft vnew
call setline(1, 'hello')
! let winid = popup_create('world', ~{
\ line: 1,
\ col: 1,
\ minwidth: 20,
--- 806,812 ----
topleft vnew
call setline(1, 'hello')
! let winid = popup_create('world', #{
\ line: 1,
\ col: 1,
\ minwidth: 20,
***************
*** 815,828 ****
let line = join(map(range(1, 6), 'screenstring(1, v:val)'), '')
call assert_equal('world ', line)
! call popup_move(winid, ~{line: 2, col: 2})
redraw
let line = join(map(range(1, 6), 'screenstring(1, v:val)'), '')
call assert_equal('hello ', line)
let line = join(map(range(1, 6), 'screenstring(2, v:val)'), '')
call assert_equal('~world', line)
! call popup_move(winid, ~{line: 1})
redraw
let line = join(map(range(1, 6), 'screenstring(1, v:val)'), '')
call assert_equal('hworld', line)
--- 815,828 ----
let line = join(map(range(1, 6), 'screenstring(1, v:val)'), '')
call assert_equal('world ', line)
! call popup_move(winid, #{line: 2, col: 2})
redraw
let line = join(map(range(1, 6), 'screenstring(1, v:val)'), '')
call assert_equal('hello ', line)
let line = join(map(range(1, 6), 'screenstring(2, v:val)'), '')
call assert_equal('~world', line)
! call popup_move(winid, #{line: 1})
redraw
let line = join(map(range(1, 6), 'screenstring(1, v:val)'), '')
call assert_equal('hworld', line)
***************
*** 833,839 ****
endfunc
func Test_popup_getpos()
! let winid = popup_create('hello', ~{
\ line: 2,
\ col: 3,
\ minwidth: 10,
--- 833,839 ----
endfunc
func Test_popup_getpos()
! let winid = popup_create('hello', #{
\ line: 2,
\ col: 3,
\ minwidth: 10,
***************
*** 860,866 ****
\ ]
for test in tests
! let winid = popup_create(test[0], ~{line: 2, col: 3})
redraw
let position = popup_getpos(winid)
call assert_equal(test[1], position.width)
--- 860,866 ----
\ ]
for test in tests
! let winid = popup_create(test[0], #{line: 2, col: 3})
redraw
let position = popup_getpos(winid)
call assert_equal(test[1], position.width)
***************
*** 876,882 ****
\ ]
for test in tests
let winid = popup_create(test[0],
! \ ~{line: 2, col: 3, maxwidth: 12})
redraw
let position = popup_getpos(winid)
call assert_equal(test[1], position.width)
--- 876,882 ----
\ ]
for test in tests
let winid = popup_create(test[0],
! \ #{line: 2, col: 3, maxwidth: 12})
redraw
let position = popup_getpos(winid)
call assert_equal(test[1], position.width)
***************
*** 888,894 ****
endfunc
func Test_popup_getoptions()
! let winid = popup_create('hello', ~{
\ line: 2,
\ col: 3,
\ minwidth: 10,
--- 888,894 ----
endfunc
func Test_popup_getoptions()
! let winid = popup_create('hello', #{
\ line: 2,
\ col: 3,
\ minwidth: 10,
***************
*** 981,987 ****
call cursor(1, 1)
redraw
! let winid = popup_create('vim', ~{
\ line: 'cursor+2',
\ col: 'cursor+1',
\})
--- 981,987 ----
call cursor(1, 1)
redraw
! let winid = popup_create('vim', #{
\ line: 'cursor+2',
\ col: 'cursor+1',
\})
***************
*** 992,998 ****
call cursor(3, 3)
redraw
! let winid = popup_create('vim', ~{
\ line: 'cursor-2',
\ col: 'cursor-1',
\})
--- 992,998 ----
call cursor(3, 3)
redraw
! let winid = popup_create('vim', #{
\ line: 'cursor-2',
\ col: 'cursor-1',
\})
***************
*** 1061,1067 ****
endfunc
END
call writefile(lines, 'XtestPopupBeval')
! let buf = RunVimInTerminal('-S XtestPopupBeval', ~{rows: 10})
call term_wait(buf, 100)
call term_sendkeys(buf, 'j')
call term_sendkeys(buf, ":call Hover()\<CR>")
--- 1061,1067 ----
endfunc
END
call writefile(lines, 'XtestPopupBeval')
! let buf = RunVimInTerminal('-S XtestPopupBeval', #{rows: 10})
call term_wait(buf, 100)
call term_sendkeys(buf, 'j')
call term_sendkeys(buf, ":call Hover()\<CR>")
***************
*** 1098,1104 ****
return 0
endfunc
! let winid = popup_create('something', ~{filter: 'MyPopupFilter'})
redraw
" e is consumed by the filter
--- 1098,1104 ----
return 0
endfunc
! let winid = popup_create('something', #{filter: 'MyPopupFilter'})
redraw
" e is consumed by the filter
***************
*** 1123,1129 ****
func ShowDialog(key, result)
let s:cb_res = 999
! let winid = popup_dialog('do you want to quit (Yes/no)?', ~{
\ filter: 'popup_filter_yesno',
\ callback: 'QuitCallback',
\ })
--- 1123,1129 ----
func ShowDialog(key, result)
let s:cb_res = 999
! let winid = popup_dialog('do you want to quit (Yes/no)?', #{
\ filter: 'popup_filter_yesno',
\ callback: 'QuitCallback',
\ })
***************
*** 1153,1159 ****
func ShowMenu(key, result)
let s:cb_res = 999
! let winid = popup_menu(['one', 'two', 'something else'], ~{
\ callback: 'QuitCallback',
\ })
redraw
--- 1153,1159 ----
func ShowMenu(key, result)
let s:cb_res = 999
! let winid = popup_menu(['one', 'two', 'something else'], #{
\ callback: 'QuitCallback',
\ })
redraw
***************
*** 1189,1201 ****
let lines =<< trim END
call setline(1, range(1, 20))
hi PopupSelected ctermbg=lightblue
! call popup_menu(['one', 'two', 'another'], ~{callback: 'MenuDone', title: ' make a choice from the list '})
func MenuDone(id, res)
echomsg "selected " .. a:res
endfunc
END
call writefile(lines, 'XtestPopupMenu')
! let buf = RunVimInTerminal('-S XtestPopupMenu', ~{rows: 10})
call VerifyScreenDump(buf, 'Test_popupwin_menu_01', {})
call term_sendkeys(buf, "jj")
--- 1189,1201 ----
let lines =<< trim END
call setline(1, range(1, 20))
hi PopupSelected ctermbg=lightblue
! call popup_menu(['one', 'two', 'another'], #{callback: 'MenuDone', title: ' make a choice from the list '})
func MenuDone(id, res)
echomsg "selected " .. a:res
endfunc
END
call writefile(lines, 'XtestPopupMenu')
! let buf = RunVimInTerminal('-S XtestPopupMenu', #{rows: 10})
call VerifyScreenDump(buf, 'Test_popupwin_menu_01', {})
call term_sendkeys(buf, "jj")
***************
*** 1218,1236 ****
" put the title on.
let lines =<< trim END
call setline(1, range(1, 20))
! call popup_create(['one', 'two', 'another'], ~{title: 'Title String'})
END
call writefile(lines, 'XtestPopupTitle')
! let buf = RunVimInTerminal('-S XtestPopupTitle', ~{rows: 10})
call VerifyScreenDump(buf, 'Test_popupwin_title', {})
" clean up
call StopVimInTerminal(buf)
call delete('XtestPopupTitle')
! let winid = popup_create('something', ~{title: 'Some Title'})
call assert_equal('Some Title', popup_getoptions(winid).title)
! call popup_setoptions(winid, ~{title: 'Another Title'})
call assert_equal('Another Title', popup_getoptions(winid).title)
call popup_clear()
--- 1218,1236 ----
" put the title on.
let lines =<< trim END
call setline(1, range(1, 20))
! call popup_create(['one', 'two', 'another'], #{title: 'Title String'})
END
call writefile(lines, 'XtestPopupTitle')
! let buf = RunVimInTerminal('-S XtestPopupTitle', #{rows: 10})
call VerifyScreenDump(buf, 'Test_popupwin_title', {})
" clean up
call StopVimInTerminal(buf)
call delete('XtestPopupTitle')
! let winid = popup_create('something', #{title: 'Some Title'})
call assert_equal('Some Title', popup_getoptions(winid).title)
! call popup_setoptions(winid, #{title: 'Another Title'})
call assert_equal('Another Title', popup_getoptions(winid).title)
call popup_clear()
***************
*** 1240,1259 ****
func PopupDone(id, result)
let g:result = a:result
endfunc
! let winid = popup_create('something', ~{callback: 'PopupDone'})
redraw
call popup_close(winid, 'done')
call assert_equal('done', g:result)
endfunc
func Test_popup_empty()
! let winid = popup_create('', ~{padding: [2,2,2,2]})
redraw
let pos = popup_getpos(winid)
call assert_equal(5, pos.width)
call assert_equal(5, pos.height)
! let winid = popup_create([], ~{border: []})
redraw
let pos = popup_getpos(winid)
call assert_equal(3, pos.width)
--- 1240,1259 ----
func PopupDone(id, result)
let g:result = a:result
endfunc
! let winid = popup_create('something', #{callback: 'PopupDone'})
redraw
call popup_close(winid, 'done')
call assert_equal('done', g:result)
endfunc
func Test_popup_empty()
! let winid = popup_create('', #{padding: [2,2,2,2]})
redraw
let pos = popup_getpos(winid)
call assert_equal(5, pos.width)
call assert_equal(5, pos.height)
! let winid = popup_create([], #{border: []})
redraw
let pos = popup_getpos(winid)
call assert_equal(3, pos.width)
***************
*** 1282,1294 ****
let info_window1 = getwininfo()[0]
let line = info_window1['height']
let col = info_window1['width']
! call popup_create(['line1', 'line2', 'line3', 'line4'], ~{
\ line : line,
\ col : col,
\ })
END
call writefile(lines, 'XtestPopupBehind')
! let buf = RunVimInTerminal('-S XtestPopupBehind', ~{rows: 10})
call term_sendkeys(buf, "\<C-W>w")
call VerifyScreenDump(buf, 'Test_popupwin_behind', {})
--- 1282,1294 ----
let info_window1 = getwininfo()[0]
let line = info_window1['height']
let col = info_window1['width']
! call popup_create(['line1', 'line2', 'line3', 'line4'], #{
\ line : line,
\ col : col,
\ })
END
call writefile(lines, 'XtestPopupBehind')
! let buf = RunVimInTerminal('-S XtestPopupBehind', #{rows: 10})
call term_sendkeys(buf, "\<C-W>w")
call VerifyScreenDump(buf, 'Test_popupwin_behind', {})
***************
*** 1345,1353 ****
" - expected width
" - expected height
let tests = [
! \ ~{
\ comment: 'left-aligned with wrapping',
! \ options: ~{
\ wrap: 1,
\ pos: 'botleft',
\ },
--- 1345,1353 ----
" - expected width
" - expected height
let tests = [
! \ #{
\ comment: 'left-aligned with wrapping',
! \ options: #{
\ wrap: 1,
\ pos: 'botleft',
\ },
***************
*** 1359,1367 ****
\ [ 'eeee', 5, &columns - 3, 5, &columns - 3, 4, 1 ],
\ ],
\ },
! \ ~{
\ comment: 'left aligned without wrapping',
! \ options: ~{
\ wrap: 0,
\ pos: 'botleft',
\ },
--- 1359,1367 ----
\ [ 'eeee', 5, &columns - 3, 5, &columns - 3, 4, 1 ],
\ ],
\ },
! \ #{
\ comment: 'left aligned without wrapping',
! \ options: #{
\ wrap: 0,
\ pos: 'botleft',
\ },
***************
*** 1373,1381 ****
\ [ 'eeee', 5, &columns - 3, 5, &columns - 3, 4, 1 ],
\ ],
\ },
! \ ~{
\ comment: 'left aligned with fixed position',
! \ options: ~{
\ wrap: 0,
\ fixed: 1,
\ pos: 'botleft',
--- 1373,1381 ----
\ [ 'eeee', 5, &columns - 3, 5, &columns - 3, 4, 1 ],
\ ],
\ },
! \ #{
\ comment: 'left aligned with fixed position',
! \ options: #{
\ wrap: 0,
\ fixed: 1,
\ pos: 'botleft',
***************
*** 1393,1399 ****
for test_group in tests
for test in test_group.tests
let [ text, line, col, e_line, e_col, e_width, e_height ] = test
! let options = ~{
\ line: line,
\ col: col,
\ }
--- 1393,1399 ----
for test_group in tests
for test in test_group.tests
let [ text, line, col, e_line, e_col, e_width, e_height ] = test
! let options = #{
\ line: line,
\ col: col,
\ }
***************
*** 1401,1407 ****
let p = popup_create( text, options )
! let msg = string(extend(options, ~{text: text}))
call s:VerifyPosition(p, msg, e_line, e_col, e_width, e_height)
call popup_close(p)
endfor
--- 1401,1407 ----
let p = popup_create( text, options )
! let msg = string(extend(options, #{text: text}))
call s:VerifyPosition(p, msg, e_line, e_col, e_width, e_height)
call popup_close(p)
endfor
***************
*** 1415,1421 ****
" width of screen
let X = join(map(range(&columns), {->'X'}), '')
! let p = popup_create( X, ~{line: 1, col: 1, wrap: 0})
call s:VerifyPosition( p, 'full width topleft', 1, 1, &columns, 1 )
redraw
--- 1415,1421 ----
" width of screen
let X = join(map(range(&columns), {->'X'}), '')
! let p = popup_create( X, #{line: 1, col: 1, wrap: 0})
call s:VerifyPosition( p, 'full width topleft', 1, 1, &columns, 1 )
redraw
***************
*** 1426,1432 ****
redraw
" Same if placed on the right hand side
! let p = popup_create( X, ~{line: 1, col: &columns, wrap: 0})
call s:VerifyPosition( p, 'full width topright', 1, 1, &columns, 1 )
redraw
--- 1426,1432 ----
redraw
" Same if placed on the right hand side
! let p = popup_create( X, #{line: 1, col: &columns, wrap: 0})
call s:VerifyPosition( p, 'full width topright', 1, 1, &columns, 1 )
redraw
***************
*** 1439,1445 ****
" Extend so > window width
let X .= 'x'
! let p = popup_create( X, ~{line: 1, col: 1, wrap: 0})
call s:VerifyPosition( p, 'full width + 1 topleft', 1, 1, &columns, 1 )
redraw
--- 1439,1445 ----
" Extend so > window width
let X .= 'x'
! let p = popup_create( X, #{line: 1, col: 1, wrap: 0})
call s:VerifyPosition( p, 'full width + 1 topleft', 1, 1, &columns, 1 )
redraw
***************
*** 1450,1456 ****
redraw
" Shifted then truncated (the x is not visible)
! let p = popup_create( X, ~{line: 1, col: &columns - 3, wrap: 0})
call s:VerifyPosition( p, 'full width + 1 topright', 1, 1, &columns, 1 )
redraw
--- 1450,1456 ----
redraw
" Shifted then truncated (the x is not visible)
! let p = popup_create( X, #{line: 1, col: &columns - 3, wrap: 0})
call s:VerifyPosition( p, 'full width + 1 topright', 1, 1, &columns, 1 )
redraw
***************
*** 1462,1468 ****
" Not shifted, just truncated
let p = popup_create( X,
! \ ~{line: 1, col: 2, wrap: 0, fixed: 1})
call s:VerifyPosition( p, 'full width + 1 fixed', 1, 2, &columns - 1, 1)
redraw
--- 1462,1468 ----
" Not shifted, just truncated
let p = popup_create( X,
! \ #{line: 1, col: 2, wrap: 0, fixed: 1})
call s:VerifyPosition( p, 'full width + 1 fixed', 1, 2, &columns - 1, 1)
redraw
***************
*** 1483,1489 ****
call setline(1, ['one word to move around', 'a WORD.and->some thing'])
exe "normal gg0/word\<CR>"
! let winid = popup_atcursor('text', ~{moved: 'any'})
redraw
call assert_equal(1, popup_getpos(winid).visible)
call assert_equal([1, 4, 4], popup_getoptions(winid).moved)
--- 1483,1489 ----
call setline(1, ['one word to move around', 'a WORD.and->some thing'])
exe "normal gg0/word\<CR>"
! let winid = popup_atcursor('text', #{moved: 'any'})
redraw
call assert_equal(1, popup_getpos(winid).visible)
call assert_equal([1, 4, 4], popup_getoptions(winid).moved)
***************
*** 1493,1499 ****
call popup_clear()
exe "normal gg0/word\<CR>"
! let winid = popup_atcursor('text', ~{moved: 'word'})
redraw
call assert_equal(1, popup_getpos(winid).visible)
call assert_equal([1, 4, 7], popup_getoptions(winid).moved)
--- 1493,1499 ----
call popup_clear()
exe "normal gg0/word\<CR>"
! let winid = popup_atcursor('text', #{moved: 'word'})
redraw
call assert_equal(1, popup_getpos(winid).visible)
call assert_equal([1, 4, 7], popup_getoptions(winid).moved)
***************
*** 1502,1508 ****
call popup_clear()
exe "normal gg0/word\<CR>"
! let winid = popup_atcursor('text', ~{moved: 'word'})
redraw
call assert_equal(1, popup_getpos(winid).visible)
call assert_equal([1, 4, 7], popup_getoptions(winid).moved)
--- 1502,1508 ----
call popup_clear()
exe "normal gg0/word\<CR>"
! let winid = popup_atcursor('text', #{moved: 'word'})
redraw
call assert_equal(1, popup_getpos(winid).visible)
call assert_equal([1, 4, 7], popup_getoptions(winid).moved)
***************
*** 1529,1535 ****
call popup_clear()
exe "normal gg0/word\<CR>"
! let winid = popup_atcursor('text', ~{moved: [5, 10]})
redraw
call assert_equal(1, popup_getpos(winid).visible)
call feedkeys("eli\<Esc>", 'xt')
--- 1529,1535 ----
call popup_clear()
exe "normal gg0/word\<CR>"
! let winid = popup_atcursor('text', #{moved: [5, 10]})
redraw
call assert_equal(1, popup_getpos(winid).visible)
call feedkeys("eli\<Esc>", 'xt')
***************
*** 1556,1562 ****
\ "hi Notification ctermbg=lightblue",
\ "call popup_notification('first notification', {})",
\], 'XtestNotifications')
! let buf = RunVimInTerminal('-S XtestNotifications', ~{rows: 10})
call VerifyScreenDump(buf, 'Test_popupwin_notify_01', {})
" second one goes below the first one
--- 1556,1562 ----
\ "hi Notification ctermbg=lightblue",
\ "call popup_notification('first notification', {})",
\], 'XtestNotifications')
! let buf = RunVimInTerminal('-S XtestNotifications', #{rows: 10})
call VerifyScreenDump(buf, 'Test_popupwin_notify_01', {})
" second one goes below the first one
***************
*** 1579,1585 ****
hi ScrollThumb ctermbg=blue
hi ScrollBar ctermbg=red
let winid = popup_create(['one', 'two', 'three', 'four', 'five',
! \ 'six', 'seven', 'eight', 'nine'], ~{
\ minwidth: 8,
\ maxheight: 4,
\ })
--- 1579,1585 ----
hi ScrollThumb ctermbg=blue
hi ScrollBar ctermbg=red
let winid = popup_create(['one', 'two', 'three', 'four', 'five',
! \ 'six', 'seven', 'eight', 'nine'], #{
\ minwidth: 8,
\ maxheight: 4,
\ })
***************
*** 1593,1599 ****
call feedkeys("\<F4>\<LeftMouse>", "xt")
endfunc
func ClickBot()
! call popup_setoptions(g:winid, ~{border: [], close: 'button'})
call feedkeys("\<F5>\<LeftMouse>", "xt")
endfunc
map <silent> <F3> :call test_setmouse(5, 36)<CR>
--- 1593,1599 ----
call feedkeys("\<F4>\<LeftMouse>", "xt")
endfunc
func ClickBot()
! call popup_setoptions(g:winid, #{border: [], close: 'button'})
call feedkeys("\<F5>\<LeftMouse>", "xt")
endfunc
map <silent> <F3> :call test_setmouse(5, 36)<CR>
***************
*** 1601,1622 ****
map <silent> <F5> :call test_setmouse(7, 42)<CR>
END
call writefile(lines, 'XtestPopupScroll')
! let buf = RunVimInTerminal('-S XtestPopupScroll', ~{rows: 10})
call VerifyScreenDump(buf, 'Test_popupwin_scroll_1', {})
! call term_sendkeys(buf, ":call popup_setoptions(winid, ~{firstline: 2})\<CR>")
call term_sendkeys(buf, ":\<CR>")
call VerifyScreenDump(buf, 'Test_popupwin_scroll_2', {})
! call term_sendkeys(buf, ":call popup_setoptions(winid, ~{firstline: 6})\<CR>")
call term_sendkeys(buf, ":\<CR>")
call VerifyScreenDump(buf, 'Test_popupwin_scroll_3', {})
! call term_sendkeys(buf, ":call popup_setoptions(winid, ~{firstline: 9})\<CR>")
call term_sendkeys(buf, ":\<CR>")
call VerifyScreenDump(buf, 'Test_popupwin_scroll_4', {})
! call term_sendkeys(buf, ":call popup_setoptions(winid, ~{scrollbarhighlight: 'ScrollBar', thumbhighlight: 'ScrollThumb'})\<CR>")
call term_sendkeys(buf, ":call ScrollUp()\<CR>")
call VerifyScreenDump(buf, 'Test_popupwin_scroll_5', {})
--- 1601,1622 ----
map <silent> <F5> :call test_setmouse(7, 42)<CR>
END
call writefile(lines, 'XtestPopupScroll')
! let buf = RunVimInTerminal('-S XtestPopupScroll', #{rows: 10})
call VerifyScreenDump(buf, 'Test_popupwin_scroll_1', {})
! call term_sendkeys(buf, ":call popup_setoptions(winid, #{firstline: 2})\<CR>")
call term_sendkeys(buf, ":\<CR>")
call VerifyScreenDump(buf, 'Test_popupwin_scroll_2', {})
! call term_sendkeys(buf, ":call popup_setoptions(winid, #{firstline: 6})\<CR>")
call term_sendkeys(buf, ":\<CR>")
call VerifyScreenDump(buf, 'Test_popupwin_scroll_3', {})
! call term_sendkeys(buf, ":call popup_setoptions(winid, #{firstline: 9})\<CR>")
call term_sendkeys(buf, ":\<CR>")
call VerifyScreenDump(buf, 'Test_popupwin_scroll_4', {})
! call term_sendkeys(buf, ":call popup_setoptions(winid, #{scrollbarhighlight: 'ScrollBar', thumbhighlight: 'ScrollThumb'})\<CR>")
call term_sendkeys(buf, ":call ScrollUp()\<CR>")
call VerifyScreenDump(buf, 'Test_popupwin_scroll_5', {})
***************
*** 1645,1651 ****
func Test_popup_fitting_scrollbar()
" this was causing a crash, divide by zero
let winid = popup_create([
! \ 'one', 'two', 'longer line that wraps', 'four', 'five'], ~{
\ scrollbar: 1,
\ maxwidth: 10,
\ maxheight: 5,
--- 1645,1651 ----
func Test_popup_fitting_scrollbar()
" this was causing a crash, divide by zero
let winid = popup_create([
! \ 'one', 'two', 'longer line that wraps', 'four', 'five'], #{
\ scrollbar: 1,
\ maxwidth: 10,
\ maxheight: 5,
***************
*** 1660,1672 ****
endif
let lines =<< trim END
! let opts = ~{wrap: 0}
let p = popup_create('test', opts)
call popup_settext(p, 'this is a text')
END
call writefile( lines, 'XtestPopupSetText' )
! let buf = RunVimInTerminal('-S XtestPopupSetText', ~{rows: 10})
call VerifyScreenDump(buf, 'Test_popup_settext_01', {})
" Setting to empty string clears it
--- 1660,1672 ----
endif
let lines =<< trim END
! let opts = #{wrap: 0}
let p = popup_create('test', opts)
call popup_settext(p, 'this is a text')
END
call writefile( lines, 'XtestPopupSetText' )
! let buf = RunVimInTerminal('-S XtestPopupSetText', #{rows: 10})
call VerifyScreenDump(buf, 'Test_popup_settext_01', {})
" Setting to empty string clears it
***************
*** 1690,1696 ****
call VerifyScreenDump(buf, 'Test_popup_settext_05', {})
" Dicts
! call term_sendkeys(buf, ":call popup_settext(p, [~{text: 'aaaa'}, ~{text: 'bbbb'}, ~{text: 'cccc'}])\<CR>")
call VerifyScreenDump(buf, 'Test_popup_settext_06', {})
" clean up
--- 1690,1696 ----
call VerifyScreenDump(buf, 'Test_popup_settext_05', {})
" Dicts
! call term_sendkeys(buf, ":call popup_settext(p, [#{text: 'aaaa'}, #{text: 'bbbb'}, #{text: 'cccc'}])\<CR>")
call VerifyScreenDump(buf, 'Test_popup_settext_06', {})
" clean up
***************
*** 1701,1712 ****
func Test_popup_hidden()
new
! let winid = popup_atcursor('text', ~{hidden: 1})
redraw
call assert_equal(0, popup_getpos(winid).visible)
call popup_close(winid)
! let winid = popup_create('text', ~{hidden: 1})
redraw
call assert_equal(0, popup_getpos(winid).visible)
call popup_close(winid)
--- 1701,1712 ----
func Test_popup_hidden()
new
! let winid = popup_atcursor('text', #{hidden: 1})
redraw
call assert_equal(0, popup_getpos(winid).visible)
call popup_close(winid)
! let winid = popup_create('text', #{hidden: 1})
redraw
call assert_equal(0, popup_getpos(winid).visible)
call popup_close(winid)
***************
*** 1715,1721 ****
let s:cb_winid = a:id
let s:cb_res = a:res
endfunc
! let winid = popup_dialog('make a choice', ~{hidden: 1,
\ filter: 'popup_filter_yesno',
\ callback: 'QuitCallback',
\ })
--- 1715,1721 ----
let s:cb_winid = a:id
let s:cb_res = a:res
endfunc
! let winid = popup_dialog('make a choice', #{hidden: 1,
\ filter: 'popup_filter_yesno',
\ callback: 'QuitCallback',
\ })
***************
*** 1736,1748 ****
" Test options not checked elsewhere
func Test_set_get_options()
! let winid = popup_create('some text', ~{highlight: 'Beautiful'})
let options = popup_getoptions(winid)
call assert_equal(1, options.wrap)
call assert_equal(0, options.drag)
call assert_equal('Beautiful', options.highlight)
! call popup_setoptions(winid, ~{wrap: 0, drag: 1, highlight: 'Another'})
let options = popup_getoptions(winid)
call assert_equal(0, options.wrap)
call assert_equal(1, options.drag)
--- 1736,1748 ----
" Test options not checked elsewhere
func Test_set_get_options()
! let winid = popup_create('some text', #{highlight: 'Beautiful'})
let options = popup_getoptions(winid)
call assert_equal(1, options.wrap)
call assert_equal(0, options.drag)
call assert_equal('Beautiful', options.highlight)
! call popup_setoptions(winid, #{wrap: 0, drag: 1, highlight: 'Another'})
let options = popup_getoptions(winid)
call assert_equal(0, options.wrap)
call assert_equal(1, options.drag)
***************
*** 1756,1762 ****
" NOP
endfunc
! let winid = popup_create('something', ~{filter: function('MyPopupFilter', [{}])})
call test_garbagecollect_now()
redraw
" Must not crach caused by invalid memory access
--- 1756,1762 ----
" NOP
endfunc
! let winid = popup_create('something', #{filter: function('MyPopupFilter', [{}])})
call test_garbagecollect_now()
redraw
" Must not crach caused by invalid memory access
***************
*** 1789,1800 ****
endfunc
func Test_popupwin_width()
! let winid = popup_create(repeat(['short', 'long long long line', 'medium width'], 50), ~{
\ maxwidth: 40,
\ maxheight: 10,
\ })
for top in range(1, 20)
! call popup_setoptions(winid, ~{firstline: top})
redraw
call assert_equal(19, popup_getpos(winid).width)
endfor
--- 1789,1800 ----
endfunc
func Test_popupwin_width()
! let winid = popup_create(repeat(['short', 'long long long line', 'medium width'], 50), #{
\ maxwidth: 40,
\ maxheight: 10,
\ })
for top in range(1, 20)
! call popup_setoptions(winid, #{firstline: top})
redraw
call assert_equal(19, popup_getpos(winid).width)
endfor
***************
*** 1838,1844 ****
hi ScrollThumb ctermbg=blue
hi ScrollBar ctermbg=red
func PopupMenu(lines, line, col, scrollbar = 0)
! return popup_menu(a:lines, ~{
\ maxwidth: 10,
\ maxheight: 3,
\ pos : 'topleft',
--- 1838,1844 ----
hi ScrollThumb ctermbg=blue
hi ScrollBar ctermbg=red
func PopupMenu(lines, line, col, scrollbar = 0)
! return popup_menu(a:lines, #{
\ maxwidth: 10,
\ maxheight: 3,
\ pos : 'topleft',
***************
*** 1854,1860 ****
call PopupMenu(repeat(['123456789|' .. ' '], 5), 1, 33, 1)
END
call writefile(lines, 'XtestPopupMenuMaxWidth')
! let buf = RunVimInTerminal('-S XtestPopupMenuMaxWidth', ~{rows: 13})
call VerifyScreenDump(buf, 'Test_popupwin_menu_maxwidth_1', {})
" close the menu popupwin.
--- 1854,1860 ----
call PopupMenu(repeat(['123456789|' .. ' '], 5), 1, 33, 1)
END
call writefile(lines, 'XtestPopupMenuMaxWidth')
! let buf = RunVimInTerminal('-S XtestPopupMenuMaxWidth', #{rows: 13})
call VerifyScreenDump(buf, 'Test_popupwin_menu_maxwidth_1', {})
" close the menu popupwin.
***************
*** 1879,1891 ****
hi ScrollThumb ctermbg=blue
hi ScrollBar ctermbg=red
call popup_menu(['one', 'two', 'three', 'four', 'five',
! \ 'six', 'seven', 'eight', 'nine'], ~{
\ minwidth: 8,
\ maxheight: 3,
\ })
END
call writefile(lines, 'XtestPopupMenuScroll')
! let buf = RunVimInTerminal('-S XtestPopupMenuScroll', ~{rows: 10})
call term_sendkeys(buf, "j")
call VerifyScreenDump(buf, 'Test_popupwin_menu_scroll_1', {})
--- 1879,1891 ----
hi ScrollThumb ctermbg=blue
hi ScrollBar ctermbg=red
call popup_menu(['one', 'two', 'three', 'four', 'five',
! \ 'six', 'seven', 'eight', 'nine'], #{
\ minwidth: 8,
\ maxheight: 3,
\ })
END
call writefile(lines, 'XtestPopupMenuScroll')
! let buf = RunVimInTerminal('-S XtestPopupMenuScroll', #{rows: 10})
call term_sendkeys(buf, "j")
call VerifyScreenDump(buf, 'Test_popupwin_menu_scroll_1', {})
*** ../vim-8.1.1704/src/version.c 2019-07-16 21:38:48.101430996 +0200
--- src/version.c 2019-07-16 21:52:02.457894931 +0200
***************
*** 779,780 ****
--- 779,782 ----
{ /* Add new patch number below this line */
+ /**/
+ 1705,
/**/
--
BEDEVERE: How do you know so much about swallows?
ARTHUR: Well you have to know these things when you're a king, you know.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language --
http://www.Zimbu.org ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///