summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-06-10 13:11:22 +0200
committerBram Moolenaar <Bram@vim.org>2019-06-10 13:11:22 +0200
commit3ff5f0f05d437a6b3eaf3caa5dc2762b49314617 (patch)
tree8ea013e3bb1441b897d232b0139b711d5612d6f0 /src
parent38ea784fecf7921dca83ddc75fe9cb40708521b2 (diff)
patch 8.1.1513: all popup functionality is in functions, except :popupclearv8.1.1513
Problem: All popup functionality is in functions, except :popupclear. Solution: Add popup_clear() for consistency. Also rename sound_stopall() to sound_clear().
Diffstat (limited to 'src')
-rw-r--r--src/evalfunc.c3
-rw-r--r--src/ex_cmdidxs.h24
-rw-r--r--src/ex_cmds.h3
-rw-r--r--src/popupwin.c15
-rw-r--r--src/proto/popupwin.pro2
-rw-r--r--src/proto/sound.pro2
-rw-r--r--src/sound.c11
-rw-r--r--src/testdir/test_popupwin.vim68
-rw-r--r--src/testdir/test_sound.vim2
-rw-r--r--src/version.c2
10 files changed, 72 insertions, 60 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 2d8bf52750..48b848d012 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -812,6 +812,7 @@ static struct fst
#endif
#ifdef FEAT_TEXT_PROP
{"popup_atcursor", 2, 2, f_popup_atcursor},
+ {"popup_clear", 0, 0, f_popup_clear},
{"popup_close", 1, 2, f_popup_close},
{"popup_create", 2, 2, f_popup_create},
{"popup_getoptions", 1, 1, f_popup_getoptions},
@@ -928,10 +929,10 @@ static struct fst
#endif
{"sort", 1, 3, f_sort},
#ifdef FEAT_SOUND
+ {"sound_clear", 0, 0, f_sound_clear},
{"sound_playevent", 1, 2, f_sound_playevent},
{"sound_playfile", 1, 2, f_sound_playfile},
{"sound_stop", 1, 1, f_sound_stop},
- {"sound_stopall", 0, 0, f_sound_stopall},
#endif
{"soundfold", 1, 1, f_soundfold},
{"spellbadword", 0, 1, f_spellbadword},
diff --git a/src/ex_cmdidxs.h b/src/ex_cmdidxs.h
index 2aae4b63d8..0103a1741a 100644
--- a/src/ex_cmdidxs.h
+++ b/src/ex_cmdidxs.h
@@ -21,16 +21,16 @@ static const unsigned short cmdidxs1[26] =
/* n */ 285,
/* o */ 305,
/* p */ 317,
- /* q */ 357,
- /* r */ 360,
- /* s */ 380,
- /* t */ 448,
- /* u */ 493,
- /* v */ 504,
- /* w */ 522,
- /* x */ 536,
- /* y */ 546,
- /* z */ 547
+ /* q */ 356,
+ /* r */ 359,
+ /* s */ 379,
+ /* t */ 447,
+ /* u */ 492,
+ /* v */ 503,
+ /* w */ 521,
+ /* x */ 535,
+ /* y */ 545,
+ /* 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 },
/* 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 },
- /* 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 },
/* 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 },
@@ -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 }
};
-static const int command_count = 560;
+static const int command_count = 559;
diff --git a/src/ex_cmds.h b/src/ex_cmds.h
index 9c913a8f6a..5ec69be364 100644
--- a/src/ex_cmds.h
+++ b/src/ex_cmds.h
@@ -1091,9 +1091,6 @@ EX(CMD_pop, "pop", ex_tag,
EX(CMD_popup, "popup", ex_popup,
NEEDARG|EXTRA|BANG|TRLBAR|NOTRLCOM|CMDWIN,
ADDR_NONE),
-EX(CMD_popupclear, "popupclear", ex_popupclear,
- TRLBAR,
- ADDR_NONE),
EX(CMD_ppop, "ppop", ex_ptag,
RANGE|BANG|COUNT|TRLBAR|ZEROR,
ADDR_OTHER),
diff --git a/src/popupwin.c b/src/popupwin.c
index 000bed9b70..c5123697d1 100644
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -711,6 +711,15 @@ popup_create(typval_T *argvars, typval_T *rettv, create_type_T type)
}
/*
+ * popup_clear()
+ */
+ void
+f_popup_clear(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
+{
+ close_all_popups();
+}
+
+/*
* popup_create({text}, {options})
*/
void
@@ -928,12 +937,6 @@ close_all_popups(void)
popup_close(curtab->tp_first_popupwin->w_id);
}
- void
-ex_popupclear(exarg_T *eap UNUSED)
-{
- close_all_popups();
-}
-
/*
* popup_move({id}, {options})
*/
diff --git a/src/proto/popupwin.pro b/src/proto/popupwin.pro
index a50e7b7faa..2a377a748f 100644
--- a/src/proto/popupwin.pro
+++ b/src/proto/popupwin.pro
@@ -1,5 +1,6 @@
/* popupwin.c */
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_atcursor(typval_T *argvars, typval_T *rettv);
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_tabpage(tabpage_T *tp, int id);
void close_all_popups(void);
-void ex_popupclear(exarg_T *eap);
void f_popup_move(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);
diff --git a/src/proto/sound.pro b/src/proto/sound.pro
index 43e4727750..cf8439ad43 100644
--- a/src/proto/sound.pro
+++ b/src/proto/sound.pro
@@ -2,6 +2,6 @@
void f_sound_playevent(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_stopall(typval_T *argvars, typval_T *rettv);
+void f_sound_clear(typval_T *argvars, typval_T *rettv);
void sound_free(void);
/* vim: set ft=c : */
diff --git a/src/sound.c b/src/sound.c
index ac6c377be8..e28ccff90a 100644
--- a/src/sound.c
+++ b/src/sound.c
@@ -156,12 +156,18 @@ f_sound_playevent(typval_T *argvars, typval_T *rettv)
sound_play_common(argvars, rettv, FALSE);
}
+/*
+ * implementation of sound_playfile({path} [, {callback}])
+ */
void
f_sound_playfile(typval_T *argvars, typval_T *rettv)
{
sound_play_common(argvars, rettv, TRUE);
}
+/*
+ * implementation of sound_stop({id})
+ */
void
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]));
}
+/*
+ * implementation of sound_clear()
+ */
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)
{
diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim
index f275a4937a..51eed30669 100644
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -61,7 +61,7 @@ func Test_simple_popup()
call term_wait(buf)
call term_sendkeys(buf, "0")
call term_wait(buf)
- call term_sendkeys(buf, ":popupclear\<CR>")
+ call term_sendkeys(buf, ":call popup_clear()\<CR>")
call VerifyScreenDump(buf, 'Test_popupwin_08', {})
" clean up
@@ -271,7 +271,7 @@ func Test_popup_in_tab()
call assert_equal(0, popup_getpos(winid).visible)
quit
call assert_equal(1, popup_getpos(winid).visible)
- popupclear
+ call popup_clear()
" global popup is visible in any tab
let winid = popup_create("text", {'tab': -1})
@@ -280,7 +280,7 @@ func Test_popup_in_tab()
call assert_equal(1, popup_getpos(winid).visible)
quit
call assert_equal(1, popup_getpos(winid).visible)
- popupclear
+ call popup_clear()
endfunc
func Test_popup_valid_arguments()
@@ -288,13 +288,13 @@ func Test_popup_valid_arguments()
let winid = popup_create("text", {"col": 0})
let pos = popup_getpos(winid)
call assert_inrange(&columns / 2 - 1, &columns / 2 + 1, pos.col)
- popupclear
+ 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)
- popupclear
+ call popup_clear()
" 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)
let around = (&lines - pos.height) / 2
call assert_inrange(around - 1, around + 1, pos.line)
- popupclear
+ call popup_clear()
endfunc
func Test_popup_invalid_arguments()
call assert_fails('call popup_create(666, {})', 'E714:')
- popupclear
+ call popup_clear()
call assert_fails('call popup_create("text", "none")', 'E715:')
- popupclear
+ call popup_clear()
call assert_fails('call popup_create("text", {"col": "xxx"})', 'E475:')
- popupclear
+ call popup_clear()
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:')
- popupclear
+ call popup_clear()
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:')
- popupclear
+ call popup_clear()
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:')
- popupclear
+ call popup_clear()
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:')
- popupclear
+ call popup_clear()
call assert_fails('call popup_create("text", {"padding": "none"})', 'E714:')
- popupclear
+ call popup_clear()
call assert_fails('call popup_create("text", {"border": "none"})', 'E714:')
- popupclear
+ call popup_clear()
call assert_fails('call popup_create("text", {"borderhighlight": "none"})', 'E714:')
- popupclear
+ call popup_clear()
call assert_fails('call popup_create("text", {"borderchars": "none"})', 'E714:')
- popupclear
+ call popup_clear()
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:')
- popupclear
+ call popup_clear()
call assert_fails('call popup_create([{"text": "text", "props": ["none"]}], {})', 'E715:')
- popupclear
+ call popup_clear()
endfunc
func Test_win_execute_closing_curwin()
split
let winid = popup_create('some text', {})
call assert_fails('call win_execute(winid, winnr() .. "close")', 'E994')
- popupclear
+ call popup_clear()
endfunc
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 t")', 'E994:')
call assert_fails('call win_execute(winid, "wincmd b")', 'E994:')
- popupclear
+ call popup_clear()
endfunc
func Test_popup_with_wrap()
@@ -770,7 +770,7 @@ func Test_popup_filter()
call assert_equal(-1, winbufnr(winid))
delfunc MyPopupFilter
- popupclear
+ call popup_clear()
endfunc
func Test_popup_close_callback()
@@ -944,7 +944,7 @@ func Test_popup_position_adjust()
endfor
endfor
- popupclear
+ call popup_clear()
%bwipe!
endfunc
@@ -1010,7 +1010,7 @@ func Test_adjust_left_past_screen_width()
call popup_close( p )
redraw
- popupclear
+ call popup_clear()
%bwipe!
endfunc
@@ -1026,7 +1026,7 @@ func Test_popup_moved()
" trigger the check for last_cursormoved by going into insert mode
call feedkeys("li\<Esc>", 'xt')
call assert_equal({}, popup_getpos(winid))
- popupclear
+ call popup_clear()
exe "normal gg0/word\<CR>"
let winid = popup_atcursor('text', {'moved': 'word'})
@@ -1034,7 +1034,7 @@ func Test_popup_moved()
call assert_equal(1, popup_getpos(winid).visible)
call feedkeys("hi\<Esc>", 'xt')
call assert_equal({}, popup_getpos(winid))
- popupclear
+ call popup_clear()
exe "normal gg0/word\<CR>"
let winid = popup_atcursor('text', {'moved': 'word'})
@@ -1046,7 +1046,7 @@ func Test_popup_moved()
call assert_equal(1, popup_getpos(winid).visible)
call feedkeys("eli\<Esc>", 'xt')
call assert_equal({}, popup_getpos(winid))
- popupclear
+ call popup_clear()
" WORD is the default
exe "normal gg0/WORD\<CR>"
@@ -1059,7 +1059,7 @@ func Test_popup_moved()
call assert_equal(1, popup_getpos(winid).visible)
call feedkeys("Eli\<Esc>", 'xt')
call assert_equal({}, popup_getpos(winid))
- popupclear
+ call popup_clear()
exe "normal gg0/word\<CR>"
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 feedkeys("eli\<Esc>", 'xt')
call assert_equal({}, popup_getpos(winid))
- popupclear
+ call popup_clear()
bwipe!
call test_override('ALL', 0)
diff --git a/src/testdir/test_sound.vim b/src/testdir/test_sound.vim
index e47c677e99..1e2c455e66 100644
--- a/src/testdir/test_sound.vim
+++ b/src/testdir/test_sound.vim
@@ -41,7 +41,7 @@ func Test_play_silent()
let id2 = sound_playfile(fname, 'PlayCallback')
call assert_true(id2 > 0)
sleep 20m
- call sound_stopall()
+ call sound_clear()
call assert_equal(id2, g:id)
call assert_equal(1, g:result)
endfunc
diff --git a/src/version.c b/src/version.c
index 3b434a3285..76b874e1b4 100644
--- a/src/version.c
+++ b/src/version.c
@@ -778,6 +778,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1513,
+/**/
1512,
/**/
1511,