0
0
mirror of https://github.com/vim/vim.git synced 2025-10-21 08:24:06 -04:00

patch 8.1.1513: all popup functionality is in functions, except :popupclear

Problem:    All popup functionality is in functions, except :popupclear.
Solution:   Add popup_clear() for consistency.  Also rename sound_stopall() to
            sound_clear().
This commit is contained in:
Bram Moolenaar
2019-06-10 13:11:22 +02:00
parent 38ea784fec
commit 3ff5f0f05d
12 changed files with 189 additions and 167 deletions

View File

@@ -1,4 +1,4 @@
*eval.txt* For Vim version 8.1. Last change: 2019 Jun 06 *eval.txt* For Vim version 8.1. Last change: 2019 Jun 10
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@@ -2623,12 +2623,12 @@ sin({expr}) Float sine of {expr}
sinh({expr}) Float hyperbolic sine of {expr} sinh({expr}) Float hyperbolic sine of {expr}
sort({list} [, {func} [, {dict}]]) sort({list} [, {func} [, {dict}]])
List sort {list}, using {func} to compare List sort {list}, using {func} to compare
sound_clear() none stop playing all sounds
sound_playevent({name} [, {callback}]) sound_playevent({name} [, {callback}])
Number play an event sound Number play an event sound
sound_playfile({name} [, {callback}]) sound_playfile({path} [, {callback}])
Number play a sound file Number play sound file {path}
sound_stop({id}) none stop playing sound {id} sound_stop({id}) none stop playing sound {id}
sound_stopall() none stop playing all sounds
soundfold({word}) String sound-fold {word} soundfold({word}) String sound-fold {word}
spellbadword() String badly spelled word at cursor spellbadword() String badly spelled word at cursor
spellsuggest({word} [, {max} [, {capital}]]) spellsuggest({word} [, {max} [, {capital}]])
@@ -7360,7 +7360,7 @@ prop_remove({props} [, {lnum} [, {lnum-end}]])
not just the first one not just the first one
A property matches when either "id" or "type" matches. A property matches when either "id" or "type" matches.
If buffer "bufnr" does not exist you get an error message. If buffer "bufnr" does not exist you get an error message.
If buffer 'bufnr" is not loaded then nothing happens. If buffer "bufnr" is not loaded then nothing happens.
Returns the number of properties that were removed. Returns the number of properties that were removed.
@@ -8852,6 +8852,10 @@ sort({list} [, {func} [, {dict}]]) *sort()* *E702*
return a:i1 - a:i2 return a:i1 - a:i2
endfunc endfunc
< <
sound_clear() *sound_clear()*
Stop playing all sounds.
{only available when compiled with the +sound feature}
*sound_playevent()* *sound_playevent()*
sound_playevent({name} [, {callback}]) sound_playevent({name} [, {callback}])
Play a sound identified by {name}. Which event names are Play a sound identified by {name}. Which event names are
@@ -8877,22 +8881,17 @@ sound_playevent({name} [, {callback}])
{only available when compiled with the +sound feature} {only available when compiled with the +sound feature}
*sound_playfile()* *sound_playfile()*
sound_playfile({name} [, {callback}]) sound_playfile({path} [, {callback}])
Like `sound_playevent()` but play sound file {name}. {name} Like `sound_playevent()` but play sound file {path}. {path}
must be a full path. On Ubuntu you may find files to play must be a full path. On Ubuntu you may find files to play
with this command: > with this command: >
:!find /usr/share/sounds -type f | grep -v index.theme :!find /usr/share/sounds -type f | grep -v index.theme
< {only available when compiled with the +sound feature} < {only available when compiled with the +sound feature}
sound_stop({id}) *sound_stop()* sound_stop({id}) *sound_stop()*
Stop playing sound {id}. {id} must be previously returned by Stop playing sound {id}. {id} must be previously returned by
`sound_playevent()` or `sound_playfile()`. `sound_playevent()` or `sound_playfile()`.
{only available when compiled with the +sound feature}
sound_stopall() *sound_stopall()*
Stop playing all sounds.
{only available when compiled with the +sound feature} {only available when compiled with the +sound feature}
*soundfold()* *soundfold()*
@@ -13083,19 +13082,22 @@ Sometimes old syntax of functionality gets in the way of making Vim better.
When support is taken away this will break older Vim scripts. To make this When support is taken away this will break older Vim scripts. To make this
explicit the |:scriptversion| command can be used. When a Vim script is not explicit the |:scriptversion| command can be used. When a Vim script is not
compatible with older versions of Vim this will give an explicit error, compatible with older versions of Vim this will give an explicit error,
instead of failing in mysterious ways. > instead of failing in mysterious ways.
*scriptversion-1* >
:scriptversion 1 :scriptversion 1
< This is the original Vim script, same as not using a |:scriptversion| < This is the original Vim script, same as not using a |:scriptversion|
command. Can be used to go back to old syntax for a range of lines. command. Can be used to go back to old syntax for a range of lines.
Test for support with: > Test for support with: >
has('vimscript-1') has('vimscript-1')
< *scriptversion-2* >
:scriptversion 2 :scriptversion 2
< String concatenation with "." is not supported, use ".." instead. < String concatenation with "." is not supported, use ".." instead.
This avoids the ambiguity using "." for Dict member access and This avoids the ambiguity using "." for Dict member access and
floating point numbers. Now ".5" means the number 0.5. floating point numbers. Now ".5" means the number 0.5.
>
*scriptversion-3* >
:scriptversion 3 :scriptversion 3
< All |vim-variable|s must be prefixed by "v:". E.g. "version" doesn't < All |vim-variable|s must be prefixed by "v:". E.g. "version" doesn't
work as |v:version| anymore, it can be used as a normal variable. work as |v:version| anymore, it can be used as a normal variable.

View File

@@ -1,4 +1,4 @@
*popup.txt* For Vim version 8.1. Last change: 2019 Jun 02 *popup.txt* For Vim version 8.1. Last change: 2019 Jun 09
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@@ -89,15 +89,18 @@ Probably 2. is the best choice.
IMPLEMENTATION: IMPLEMENTATION:
- Code is in popupwin.c - buffers remain after popup was deleted.
- do not redraw whole window when popup was changed, mark affected lines for
redraw.
- Why does 'nrformats' leak from the popup window buffer??? - Why does 'nrformats' leak from the popup window buffer???
- Make redrawing more efficient and avoid flicker. - Add 'balloonpopup': instead of showing text, let the callback open a balloon
First draw popups, creating a mask, use the mask in screen_line() when and return the window ID. The popup will then be closed when the mouse
drawing other windows and stuff. Mask contains zindex of popups. moves, except when it moves inside the popup.
Keep mask until next update_screen(), use when drawing status lines. - For the "moved" property also include mouse movement?
Remove update_popup() calls after draw_tabline()/updating statusline - Make redrawing more efficient and avoid flicker:
Fix redrawing problem with completion. - put popup menu also put in popup_mask?
Fix redrawing problem when scrolling non-current window - Use changes in popup_mask to decide what windows and range of lines to
redraw?
- Disable commands, feedkeys(), CTRL-W, etc. in a popup window. - Disable commands, feedkeys(), CTRL-W, etc. in a popup window.
Use NOT_IN_POPUP_WINDOW for more commands. Use NOT_IN_POPUP_WINDOW for more commands.
- Invoke filter with character before mapping? - Invoke filter with character before mapping?
@@ -115,6 +118,33 @@ THIS IS UNDER DESIGN - ANYTHING MAY STILL CHANGE
[functions to be moved to eval.txt later, keep overview of functions here] [functions to be moved to eval.txt later, keep overview of functions here]
popup_atcursor({text}, {options}) *popup_atcursor()*
Show the {text} above the cursor, and close it when the cursor
moves. This works like: >
call popup_create({text}, {
\ 'pos': 'botleft',
\ 'line': 'cursor-1',
\ 'col': 'cursor',
\ 'moved': 'WORD',
\ })
< Use {options} to change the properties.
*popup_clear()*
popup_clear() Emergency solution to a misbehaving plugin: close all popup
windows.
popup_close({id} [, {result}]) *popup_close()*
Close popup {id}. The window and the associated buffer will
be deleted.
If the popup has a callback it will be called just before the
popup window is deleted. If the optional {result} is present
it will be passed as the second argument of the callback.
Otherwise zero is passed to the callback.
popup_create({text}, {options}) *popup_create()* popup_create({text}, {options}) *popup_create()*
Open a popup window showing {text}, which is either: Open a popup window showing {text}, which is either:
- a string - a string
@@ -133,16 +163,6 @@ popup_create({text}, {options}) *popup_create()*
< In case of failure zero is returned. < In case of failure zero is returned.
popup_close({id} [, {result}]) *popup_close()*
Close popup {id}. The window and the associated buffer will
be deleted.
If the popup has a callback it will be called just before the
popup window is deleted. If the optional {result} is present
it will be passed as the second argument of the callback.
Otherwise zero is passed to the callback.
popup_dialog({text}, {options}) *popup_dialog()* popup_dialog({text}, {options}) *popup_dialog()*
{not implemented yet} {not implemented yet}
Just like |popup_create()| but with these default options: > Just like |popup_create()| but with these default options: >
@@ -155,70 +175,6 @@ popup_dialog({text}, {options}) *popup_dialog()*
< Use {options} to change the properties. < Use {options} to change the properties.
popup_notification({text}, {options}) *popup_notification()*
{not implemented yet}
Show the {text} for 3 seconds at the top of the Vim window.
This works like: >
call popup_create({text}, {
\ 'line': 1,
\ 'col': 10,
\ 'time': 3000,
\ 'tab': -1,
\ 'zindex': 200,
\ 'highlight': 'WarningMsg',
\ 'border': [],
\ })
< Use {options} to change the properties.
popup_atcursor({text}, {options}) *popup_atcursor()*
Show the {text} above the cursor, and close it when the cursor
moves. This works like: >
call popup_create({text}, {
\ 'pos': 'botleft',
\ 'line': 'cursor-1',
\ 'col': 'cursor',
\ 'moved': 'WORD',
\ })
< Use {options} to change the properties.
popup_menu({text}, {options}) *popup_menu()*
{not implemented yet}
Show the {text} near the cursor, handle selecting one of the
items with cursorkeys, and close it an item is selected with
Space or Enter. {text} should have multiple lines to make this
useful. This works like: >
call popup_create({text}, {
\ 'pos': 'center',
\ 'zindex': 200,
\ 'wrap': 0,
\ 'border': [],
\ 'filter': 'popup_filter_menu',
\ })
< Use {options} to change the properties. Should at least set
"callback" to a function that handles the selected item.
popup_hide({id}) *popup_hide()*
If {id} is a displayed popup, hide it now. If the popup has a
filter it will not be invoked for so long as the popup is
hidden.
If window {id} does not exist nothing happens. If window {id}
exists but is not a popup window an error is given. *E993*
popup_show({id}) *popup_show()*
If {id} is a hidden popup, show it now.
For {id} see `popup_hide()`.
popup_move({id}, {options}) *popup_move()*
Move popup {id} to the position speficied with {options}.
{options} may contain the items from |popup_create()| that
specify the popup position: "line", "col", "pos", "maxheight",
"minheight", "maxwidth" and "minwidth".
For {id} see `popup_hide()`.
popup_filter_menu({id}, {key}) *popup_filter_menu()* popup_filter_menu({id}, {key}) *popup_filter_menu()*
{not implemented yet} {not implemented yet}
Filter that can be used for a popup. It handles the cursor Filter that can be used for a popup. It handles the cursor
@@ -237,11 +193,6 @@ popup_filter_yesno({id}, {key}) *popup_filter_yesno()*
pressing 'n'. pressing 'n'.
popup_setoptions({id}, {options}) *popup_setoptions()*
{not implemented yet}
Override options in popup {id} with entries in {options}.
popup_getoptions({id}) *popup_getoptions()* popup_getoptions({id}) *popup_getoptions()*
Return the {options} for popup {id} in a Dict. Return the {options} for popup {id} in a Dict.
A zero value means the option was not set. For "zindex" the A zero value means the option was not set. For "zindex" the
@@ -253,6 +204,7 @@ popup_getoptions({id}) *popup_getoptions()*
< If popup window {id} is not found an empty Dict is returned. < If popup window {id} is not found an empty Dict is returned.
popup_getpos({id}) *popup_getpos()* popup_getpos({id}) *popup_getpos()*
Return the position and size of popup {id}. Returns a Dict Return the position and size of popup {id}. Returns a Dict
with these entries: with these entries:
@@ -274,9 +226,64 @@ popup_getpos({id}) *popup_getpos()*
If popup window {id} is not found an empty Dict is returned. If popup window {id} is not found an empty Dict is returned.
*:popupclear* *:popupc* popup_hide({id}) *popup_hide()*
:popupc[lear] Emergency solution to a misbehaving plugin: close all popup If {id} is a displayed popup, hide it now. If the popup has a
windows. filter it will not be invoked for so long as the popup is
hidden.
If window {id} does not exist nothing happens. If window {id}
exists but is not a popup window an error is given. *E993*
popup_menu({text}, {options}) *popup_menu()*
{not implemented yet}
Show the {text} near the cursor, handle selecting one of the
items with cursorkeys, and close it an item is selected with
Space or Enter. {text} should have multiple lines to make this
useful. This works like: >
call popup_create({text}, {
\ 'pos': 'center',
\ 'zindex': 200,
\ 'wrap': 0,
\ 'border': [],
\ 'filter': 'popup_filter_menu',
\ })
< Use {options} to change the properties. Should at least set
"callback" to a function that handles the selected item.
popup_move({id}, {options}) *popup_move()*
Move popup {id} to the position speficied with {options}.
{options} may contain the items from |popup_create()| that
specify the popup position: "line", "col", "pos", "maxheight",
"minheight", "maxwidth" and "minwidth".
For {id} see `popup_hide()`.
popup_notification({text}, {options}) *popup_notification()*
{not implemented yet}
Show the {text} for 3 seconds at the top of the Vim window.
This works like: >
call popup_create({text}, {
\ 'line': 1,
\ 'col': 10,
\ 'time': 3000,
\ 'tab': -1,
\ 'zindex': 200,
\ 'highlight': 'WarningMsg',
\ 'border': [],
\ })
< Use {options} to change the properties.
popup_show({id}) *popup_show()*
If {id} is a hidden popup, show it now.
For {id} see `popup_hide()`.
popup_setoptions({id}, {options}) *popup_setoptions()*
{not implemented yet}
Override options in popup {id} with entries in {options}.
POPUP BUFFER AND WINDOW *popup-buffer* POPUP BUFFER AND WINDOW *popup-buffer*
@@ -405,7 +412,8 @@ The second argument of |popup_create()| is a dictionary with options:
By default a double line is used all around when By default a double line is used all around when
'encoding' is "utf-8", otherwise ASCII characters are 'encoding' is "utf-8", otherwise ASCII characters are
used. used.
zindex Priority for the popup, default 50. zindex Priority for the popup, default 50. Mininum value is
1, maximum value is 32000.
time Time in milliseconds after which the popup will close. time Time in milliseconds after which the popup will close.
When omitted |popup_close()| must be used. When omitted |popup_close()| must be used.
moved Specifies to close the popup if the cursor moved: moved Specifies to close the popup if the cursor moved:
@@ -496,7 +504,7 @@ Vim provides standard filters |popup_filter_menu()| and
Note that "x" is the normal way to close a popup. You may want to use Esc, Note that "x" is the normal way to close a popup. You may want to use Esc,
but since many keys start with an Esc character, there may be a delay before but since many keys start with an Esc character, there may be a delay before
Vim recognizes the Esc key. If you do use Esc, it is reecommended to set the Vim recognizes the Esc key. If you do use Esc, it is recommended to set the
'ttimeoutlen' option to 100 and set 'timeout' and/or 'ttimeout'. 'ttimeoutlen' option to 100 and set 'timeout' and/or 'ttimeout'.

View File

@@ -812,6 +812,7 @@ static struct fst
#endif #endif
#ifdef FEAT_TEXT_PROP #ifdef FEAT_TEXT_PROP
{"popup_atcursor", 2, 2, f_popup_atcursor}, {"popup_atcursor", 2, 2, f_popup_atcursor},
{"popup_clear", 0, 0, f_popup_clear},
{"popup_close", 1, 2, f_popup_close}, {"popup_close", 1, 2, f_popup_close},
{"popup_create", 2, 2, f_popup_create}, {"popup_create", 2, 2, f_popup_create},
{"popup_getoptions", 1, 1, f_popup_getoptions}, {"popup_getoptions", 1, 1, f_popup_getoptions},
@@ -928,10 +929,10 @@ static struct fst
#endif #endif
{"sort", 1, 3, f_sort}, {"sort", 1, 3, f_sort},
#ifdef FEAT_SOUND #ifdef FEAT_SOUND
{"sound_clear", 0, 0, f_sound_clear},
{"sound_playevent", 1, 2, f_sound_playevent}, {"sound_playevent", 1, 2, f_sound_playevent},
{"sound_playfile", 1, 2, f_sound_playfile}, {"sound_playfile", 1, 2, f_sound_playfile},
{"sound_stop", 1, 1, f_sound_stop}, {"sound_stop", 1, 1, f_sound_stop},
{"sound_stopall", 0, 0, f_sound_stopall},
#endif #endif
{"soundfold", 1, 1, f_soundfold}, {"soundfold", 1, 1, f_soundfold},
{"spellbadword", 0, 1, f_spellbadword}, {"spellbadword", 0, 1, f_spellbadword},

View File

@@ -21,16 +21,16 @@ static const unsigned short cmdidxs1[26] =
/* n */ 285, /* n */ 285,
/* o */ 305, /* o */ 305,
/* p */ 317, /* p */ 317,
/* q */ 357, /* q */ 356,
/* r */ 360, /* r */ 359,
/* s */ 380, /* s */ 379,
/* t */ 448, /* t */ 447,
/* u */ 493, /* u */ 492,
/* v */ 504, /* v */ 503,
/* w */ 522, /* w */ 521,
/* x */ 536, /* x */ 535,
/* y */ 546, /* y */ 545,
/* z */ 547 /* z */ 546
}; };
/* /*
@@ -56,7 +56,7 @@ static const unsigned char cmdidxs2[26][26] =
/* m */ { 1, 0, 0, 0, 7, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16 }, /* m */ { 1, 0, 0, 0, 7, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16 },
/* n */ { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 8, 10, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0 }, /* n */ { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 8, 10, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0 },
/* o */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 5, 0, 0, 0, 0, 0, 0, 9, 0, 11, 0, 0, 0 }, /* o */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 5, 0, 0, 0, 0, 0, 0, 9, 0, 11, 0, 0, 0 },
/* p */ { 1, 0, 3, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 10, 0, 0, 17, 18, 27, 0, 28, 0, 29, 0 }, /* p */ { 1, 0, 3, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 9, 0, 0, 16, 17, 26, 0, 27, 0, 28, 0 },
/* q */ { 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* q */ { 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
/* r */ { 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 19, 0, 0, 0, 0 }, /* r */ { 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 19, 0, 0, 0, 0 },
/* s */ { 2, 6, 15, 0, 19, 23, 0, 25, 26, 0, 0, 29, 31, 35, 39, 41, 0, 49, 0, 50, 0, 62, 63, 0, 64, 0 }, /* s */ { 2, 6, 15, 0, 19, 23, 0, 25, 26, 0, 0, 29, 31, 35, 39, 41, 0, 49, 0, 50, 0, 62, 63, 0, 64, 0 },
@@ -69,4 +69,4 @@ static const unsigned char cmdidxs2[26][26] =
/* z */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } /* z */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
}; };
static const int command_count = 560; static const int command_count = 559;

View File

@@ -1091,9 +1091,6 @@ EX(CMD_pop, "pop", ex_tag,
EX(CMD_popup, "popup", ex_popup, EX(CMD_popup, "popup", ex_popup,
NEEDARG|EXTRA|BANG|TRLBAR|NOTRLCOM|CMDWIN, NEEDARG|EXTRA|BANG|TRLBAR|NOTRLCOM|CMDWIN,
ADDR_NONE), ADDR_NONE),
EX(CMD_popupclear, "popupclear", ex_popupclear,
TRLBAR,
ADDR_NONE),
EX(CMD_ppop, "ppop", ex_ptag, EX(CMD_ppop, "ppop", ex_ptag,
RANGE|BANG|COUNT|TRLBAR|ZEROR, RANGE|BANG|COUNT|TRLBAR|ZEROR,
ADDR_OTHER), ADDR_OTHER),

View File

@@ -710,6 +710,15 @@ popup_create(typval_T *argvars, typval_T *rettv, create_type_T type)
popup_mask_refresh = TRUE; popup_mask_refresh = TRUE;
} }
/*
* popup_clear()
*/
void
f_popup_clear(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
{
close_all_popups();
}
/* /*
* popup_create({text}, {options}) * popup_create({text}, {options})
*/ */
@@ -928,12 +937,6 @@ close_all_popups(void)
popup_close(curtab->tp_first_popupwin->w_id); popup_close(curtab->tp_first_popupwin->w_id);
} }
void
ex_popupclear(exarg_T *eap UNUSED)
{
close_all_popups();
}
/* /*
* popup_move({id}, {options}) * popup_move({id}, {options})
*/ */

View File

@@ -1,5 +1,6 @@
/* popupwin.c */ /* popupwin.c */
void popup_adjust_position(win_T *wp); void popup_adjust_position(win_T *wp);
void f_popup_clear(typval_T *argvars, typval_T *rettv);
void f_popup_create(typval_T *argvars, typval_T *rettv); void f_popup_create(typval_T *argvars, typval_T *rettv);
void f_popup_atcursor(typval_T *argvars, typval_T *rettv); void f_popup_atcursor(typval_T *argvars, typval_T *rettv);
int popup_any_visible(void); int popup_any_visible(void);
@@ -9,7 +10,6 @@ void f_popup_show(typval_T *argvars, typval_T *rettv);
void popup_close(int id); void popup_close(int id);
void popup_close_tabpage(tabpage_T *tp, int id); void popup_close_tabpage(tabpage_T *tp, int id);
void close_all_popups(void); void close_all_popups(void);
void ex_popupclear(exarg_T *eap);
void f_popup_move(typval_T *argvars, typval_T *rettv); void f_popup_move(typval_T *argvars, typval_T *rettv);
void f_popup_getpos(typval_T *argvars, typval_T *rettv); void f_popup_getpos(typval_T *argvars, typval_T *rettv);
void f_popup_getoptions(typval_T *argvars, typval_T *rettv); void f_popup_getoptions(typval_T *argvars, typval_T *rettv);

View File

@@ -2,6 +2,6 @@
void f_sound_playevent(typval_T *argvars, typval_T *rettv); void f_sound_playevent(typval_T *argvars, typval_T *rettv);
void f_sound_playfile(typval_T *argvars, typval_T *rettv); void f_sound_playfile(typval_T *argvars, typval_T *rettv);
void f_sound_stop(typval_T *argvars, typval_T *rettv); void f_sound_stop(typval_T *argvars, typval_T *rettv);
void f_sound_stopall(typval_T *argvars, typval_T *rettv); void f_sound_clear(typval_T *argvars, typval_T *rettv);
void sound_free(void); void sound_free(void);
/* vim: set ft=c : */ /* vim: set ft=c : */

View File

@@ -156,12 +156,18 @@ f_sound_playevent(typval_T *argvars, typval_T *rettv)
sound_play_common(argvars, rettv, FALSE); sound_play_common(argvars, rettv, FALSE);
} }
/*
* implementation of sound_playfile({path} [, {callback}])
*/
void void
f_sound_playfile(typval_T *argvars, typval_T *rettv) f_sound_playfile(typval_T *argvars, typval_T *rettv)
{ {
sound_play_common(argvars, rettv, TRUE); sound_play_common(argvars, rettv, TRUE);
} }
/*
* implementation of sound_stop({id})
*/
void void
f_sound_stop(typval_T *argvars, typval_T *rettv UNUSED) f_sound_stop(typval_T *argvars, typval_T *rettv UNUSED)
{ {
@@ -169,8 +175,11 @@ f_sound_stop(typval_T *argvars, typval_T *rettv UNUSED)
ca_context_cancel(context, tv_get_number(&argvars[0])); ca_context_cancel(context, tv_get_number(&argvars[0]));
} }
/*
* implementation of sound_clear()
*/
void void
f_sound_stopall(typval_T *argvars UNUSED, typval_T *rettv UNUSED) f_sound_clear(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
{ {
if (context != NULL) if (context != NULL)
{ {

View File

@@ -61,7 +61,7 @@ func Test_simple_popup()
call term_wait(buf) call term_wait(buf)
call term_sendkeys(buf, "0") call term_sendkeys(buf, "0")
call term_wait(buf) call term_wait(buf)
call term_sendkeys(buf, ":popupclear\<CR>") call term_sendkeys(buf, ":call popup_clear()\<CR>")
call VerifyScreenDump(buf, 'Test_popupwin_08', {}) call VerifyScreenDump(buf, 'Test_popupwin_08', {})
" clean up " clean up
@@ -271,7 +271,7 @@ func Test_popup_in_tab()
call assert_equal(0, popup_getpos(winid).visible) call assert_equal(0, popup_getpos(winid).visible)
quit quit
call assert_equal(1, popup_getpos(winid).visible) call assert_equal(1, popup_getpos(winid).visible)
popupclear call popup_clear()
" global popup is visible in any tab " global popup is visible in any tab
let winid = popup_create("text", {'tab': -1}) let winid = popup_create("text", {'tab': -1})
@@ -280,7 +280,7 @@ func Test_popup_in_tab()
call assert_equal(1, popup_getpos(winid).visible) call assert_equal(1, popup_getpos(winid).visible)
quit quit
call assert_equal(1, popup_getpos(winid).visible) call assert_equal(1, popup_getpos(winid).visible)
popupclear call popup_clear()
endfunc endfunc
func Test_popup_valid_arguments() func Test_popup_valid_arguments()
@@ -288,13 +288,13 @@ func Test_popup_valid_arguments()
let winid = popup_create("text", {"col": 0}) let winid = popup_create("text", {"col": 0})
let pos = popup_getpos(winid) let pos = popup_getpos(winid)
call assert_inrange(&columns / 2 - 1, &columns / 2 + 1, pos.col) call assert_inrange(&columns / 2 - 1, &columns / 2 + 1, pos.col)
popupclear call popup_clear()
" using cursor column has minimum value of 1 " 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) let pos = popup_getpos(winid)
call assert_equal(1, pos.col) call assert_equal(1, pos.col)
popupclear call popup_clear()
" center " center
let winid = popup_create("text", {"pos": 'center'}) let winid = popup_create("text", {"pos": 'center'})
@@ -303,57 +303,57 @@ func Test_popup_valid_arguments()
call assert_inrange(around - 1, around + 1, pos.col) call assert_inrange(around - 1, around + 1, pos.col)
let around = (&lines - pos.height) / 2 let around = (&lines - pos.height) / 2
call assert_inrange(around - 1, around + 1, pos.line) call assert_inrange(around - 1, around + 1, pos.line)
popupclear call popup_clear()
endfunc endfunc
func Test_popup_invalid_arguments() func Test_popup_invalid_arguments()
call assert_fails('call popup_create(666, {})', 'E714:') call assert_fails('call popup_create(666, {})', 'E714:')
popupclear call popup_clear()
call assert_fails('call popup_create("text", "none")', 'E715:') call assert_fails('call popup_create("text", "none")', 'E715:')
popupclear call popup_clear()
call assert_fails('call popup_create("text", {"col": "xxx"})', 'E475:') call assert_fails('call popup_create("text", {"col": "xxx"})', 'E475:')
popupclear call popup_clear()
call assert_fails('call popup_create("text", {"col": "cursor8"})', 'E15:') call assert_fails('call popup_create("text", {"col": "cursor8"})', 'E15:')
popupclear 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:')
popupclear 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:')
popupclear call popup_clear()
call assert_fails('call popup_create("text", {"line": "xxx"})', 'E475:') call assert_fails('call popup_create("text", {"line": "xxx"})', 'E475:')
popupclear call popup_clear()
call assert_fails('call popup_create("text", {"line": "cursor8"})', 'E15:') call assert_fails('call popup_create("text", {"line": "cursor8"})', 'E15:')
popupclear 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:')
popupclear 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:')
popupclear call popup_clear()
call assert_fails('call popup_create("text", {"pos": "there"})', 'E475:') call assert_fails('call popup_create("text", {"pos": "there"})', 'E475:')
popupclear call popup_clear()
call assert_fails('call popup_create("text", {"padding": "none"})', 'E714:') call assert_fails('call popup_create("text", {"padding": "none"})', 'E714:')
popupclear call popup_clear()
call assert_fails('call popup_create("text", {"border": "none"})', 'E714:') call assert_fails('call popup_create("text", {"border": "none"})', 'E714:')
popupclear call popup_clear()
call assert_fails('call popup_create("text", {"borderhighlight": "none"})', 'E714:') call assert_fails('call popup_create("text", {"borderhighlight": "none"})', 'E714:')
popupclear call popup_clear()
call assert_fails('call popup_create("text", {"borderchars": "none"})', 'E714:') call assert_fails('call popup_create("text", {"borderchars": "none"})', 'E714:')
popupclear call popup_clear()
call assert_fails('call popup_create([{"text": "text"}, 666], {})', 'E715:') call assert_fails('call popup_create([{"text": "text"}, 666], {})', 'E715:')
popupclear call popup_clear()
call assert_fails('call popup_create([{"text": "text", "props": "none"}], {})', 'E714:') call assert_fails('call popup_create([{"text": "text", "props": "none"}], {})', 'E714:')
popupclear call popup_clear()
call assert_fails('call popup_create([{"text": "text", "props": ["none"]}], {})', 'E715:') call assert_fails('call popup_create([{"text": "text", "props": ["none"]}], {})', 'E715:')
popupclear call popup_clear()
endfunc endfunc
func Test_win_execute_closing_curwin() func Test_win_execute_closing_curwin()
split split
let winid = popup_create('some text', {}) let winid = popup_create('some text', {})
call assert_fails('call win_execute(winid, winnr() .. "close")', 'E994') call assert_fails('call win_execute(winid, winnr() .. "close")', 'E994')
popupclear call popup_clear()
endfunc endfunc
func Test_win_execute_not_allowed() func Test_win_execute_not_allowed()
@@ -374,7 +374,7 @@ func Test_win_execute_not_allowed()
call assert_fails('call win_execute(winid, "wincmd w")', 'E994:') call assert_fails('call win_execute(winid, "wincmd w")', 'E994:')
call assert_fails('call win_execute(winid, "wincmd t")', 'E994:') call assert_fails('call win_execute(winid, "wincmd t")', 'E994:')
call assert_fails('call win_execute(winid, "wincmd b")', 'E994:') call assert_fails('call win_execute(winid, "wincmd b")', 'E994:')
popupclear call popup_clear()
endfunc endfunc
func Test_popup_with_wrap() func Test_popup_with_wrap()
@@ -770,7 +770,7 @@ func Test_popup_filter()
call assert_equal(-1, winbufnr(winid)) call assert_equal(-1, winbufnr(winid))
delfunc MyPopupFilter delfunc MyPopupFilter
popupclear call popup_clear()
endfunc endfunc
func Test_popup_close_callback() func Test_popup_close_callback()
@@ -944,7 +944,7 @@ func Test_popup_position_adjust()
endfor endfor
endfor endfor
popupclear call popup_clear()
%bwipe! %bwipe!
endfunc endfunc
@@ -1010,7 +1010,7 @@ func Test_adjust_left_past_screen_width()
call popup_close( p ) call popup_close( p )
redraw redraw
popupclear call popup_clear()
%bwipe! %bwipe!
endfunc endfunc
@@ -1026,7 +1026,7 @@ func Test_popup_moved()
" trigger the check for last_cursormoved by going into insert mode " trigger the check for last_cursormoved by going into insert mode
call feedkeys("li\<Esc>", 'xt') call feedkeys("li\<Esc>", 'xt')
call assert_equal({}, popup_getpos(winid)) call assert_equal({}, popup_getpos(winid))
popupclear call popup_clear()
exe "normal gg0/word\<CR>" exe "normal gg0/word\<CR>"
let winid = popup_atcursor('text', {'moved': 'word'}) let winid = popup_atcursor('text', {'moved': 'word'})
@@ -1034,7 +1034,7 @@ func Test_popup_moved()
call assert_equal(1, popup_getpos(winid).visible) call assert_equal(1, popup_getpos(winid).visible)
call feedkeys("hi\<Esc>", 'xt') call feedkeys("hi\<Esc>", 'xt')
call assert_equal({}, popup_getpos(winid)) call assert_equal({}, popup_getpos(winid))
popupclear call popup_clear()
exe "normal gg0/word\<CR>" exe "normal gg0/word\<CR>"
let winid = popup_atcursor('text', {'moved': 'word'}) let winid = popup_atcursor('text', {'moved': 'word'})
@@ -1046,7 +1046,7 @@ func Test_popup_moved()
call assert_equal(1, popup_getpos(winid).visible) call assert_equal(1, popup_getpos(winid).visible)
call feedkeys("eli\<Esc>", 'xt') call feedkeys("eli\<Esc>", 'xt')
call assert_equal({}, popup_getpos(winid)) call assert_equal({}, popup_getpos(winid))
popupclear call popup_clear()
" WORD is the default " WORD is the default
exe "normal gg0/WORD\<CR>" exe "normal gg0/WORD\<CR>"
@@ -1059,7 +1059,7 @@ func Test_popup_moved()
call assert_equal(1, popup_getpos(winid).visible) call assert_equal(1, popup_getpos(winid).visible)
call feedkeys("Eli\<Esc>", 'xt') call feedkeys("Eli\<Esc>", 'xt')
call assert_equal({}, popup_getpos(winid)) call assert_equal({}, popup_getpos(winid))
popupclear call popup_clear()
exe "normal gg0/word\<CR>" exe "normal gg0/word\<CR>"
let winid = popup_atcursor('text', {'moved': [5, 10]}) let winid = popup_atcursor('text', {'moved': [5, 10]})
@@ -1070,7 +1070,7 @@ func Test_popup_moved()
call assert_equal(1, popup_getpos(winid).visible) call assert_equal(1, popup_getpos(winid).visible)
call feedkeys("eli\<Esc>", 'xt') call feedkeys("eli\<Esc>", 'xt')
call assert_equal({}, popup_getpos(winid)) call assert_equal({}, popup_getpos(winid))
popupclear call popup_clear()
bwipe! bwipe!
call test_override('ALL', 0) call test_override('ALL', 0)

View File

@@ -41,7 +41,7 @@ func Test_play_silent()
let id2 = sound_playfile(fname, 'PlayCallback') let id2 = sound_playfile(fname, 'PlayCallback')
call assert_true(id2 > 0) call assert_true(id2 > 0)
sleep 20m sleep 20m
call sound_stopall() call sound_clear()
call assert_equal(id2, g:id) call assert_equal(id2, g:id)
call assert_equal(1, g:result) call assert_equal(1, g:result)
endfunc endfunc

View File

@@ -777,6 +777,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1513,
/**/ /**/
1512, 1512,
/**/ /**/