diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-12-30 08:27:56 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-30 08:27:56 +0100 |
commit | 00af06b3728e16155e08833e7e7708c495f500de (patch) | |
tree | 2d90915886e5643d72d1733733fc02533f50c920 | |
parent | 34a59242a0d42687a49119cca590e7b4203496ef (diff) | |
parent | 5e1cad6d3378398c059e1a7144e1310b7bcb2398 (diff) | |
download | rneovim-00af06b3728e16155e08833e7e7708c495f500de.tar.gz rneovim-00af06b3728e16155e08833e7e7708c495f500de.tar.bz2 rneovim-00af06b3728e16155e08833e7e7708c495f500de.zip |
Merge #11616 from janlazo/vim-8.0.1491
vim-patch:8.0.{1356,1491,1495,1522,1538,1540},8.1.{554,670,1300,1303,1875,2377}
-rw-r--r-- | runtime/doc/autocmd.txt | 14 | ||||
-rw-r--r-- | runtime/doc/eval.txt | 7 | ||||
-rw-r--r-- | runtime/doc/options.txt | 20 | ||||
-rwxr-xr-x | scripts/vim-patch.sh | 2 | ||||
-rw-r--r-- | src/nvim/edit.c | 2 | ||||
-rw-r--r-- | src/nvim/ex_getln.c | 2 | ||||
-rw-r--r-- | src/nvim/keymap.c | 1 | ||||
-rw-r--r-- | src/nvim/normal.c | 6 | ||||
-rw-r--r-- | src/nvim/option_defs.h | 3 | ||||
-rw-r--r-- | src/nvim/options.lua | 15 | ||||
-rw-r--r-- | src/nvim/popupmnu.c | 134 | ||||
-rw-r--r-- | src/nvim/screen.c | 4 | ||||
-rw-r--r-- | src/nvim/screen.h | 3 | ||||
-rw-r--r-- | src/nvim/testdir/test_popup.vim | 31 | ||||
-rw-r--r-- | test/functional/ui/popupmenu_spec.lua | 82 |
15 files changed, 231 insertions, 95 deletions
diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index ac61297767..97379bfa27 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -583,13 +583,6 @@ ColorSchemePre Before loading a color scheme. |:colorscheme| Useful to setup removing things added by a color scheme, before another one is loaded. - *CompleteDone* -CompleteDone After Insert mode completion is done. Either - when something was completed or abandoning - completion. |ins-completion| - The |v:completed_item| variable contains the - completed item. - CompleteChanged *CompleteChanged* After each time the Insert mode completion menu changed. Not fired on popup menu hide, @@ -610,6 +603,13 @@ CompleteChanged *CompleteChanged* The size and position of the popup are also available by calling |pum_getpos()|. + *CompleteDone* +CompleteDone After Insert mode completion is done. Either + when something was completed or abandoning + completion. |ins-completion| + The |v:completed_item| variable contains the + completed item. + *CursorHold* CursorHold When the user doesn't press a key for the time specified with 'updatetime'. Not re-triggered diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 77589b732d..fecb8b5f74 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -3121,8 +3121,9 @@ complete_info([{what}]) the items listed in {what} are returned. Unsupported items in {what} are silently ignored. - To get the position of the popup menu, see |pum_getpos()|. It's - also available in |v:event| during the |CompleteChanged| event. + To get the position and size of the popup menu, see + |pum_getpos()|. It's also available in |v:event| during the + |CompleteChanged| event. Examples: > " Get all items @@ -3770,6 +3771,8 @@ feedkeys({string} [, {mode}]) *feedkeys()* and "\..." notation |expr-quote|. For example, feedkeys("\<CR>") simulates pressing of the <Enter> key. But feedkeys('\<CR>') pushes 5 characters. + A special code that might be useful is <Ignore>, it exits the + wait for a character without doing anything. *<Ignore>* {mode} is a String, which can contain these character flags: 'm' Remap keys. This is default. If {mode} is absent, diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 57e3a00f89..4b832a8606 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -4524,13 +4524,6 @@ A jump table for the options with a short description can be found at |Q_op|. global When on a ":" prompt is used in Ex mode. - *'pumheight'* *'ph'* -'pumheight' 'ph' number (default 0) - global - Determines the maximum number of items to show in the popup menu for - Insert mode completion. When zero as much space as available is used. - |ins-completion-menu|. - *'pumblend'* *'pb'* 'pumblend' 'pb' number (default 0) global @@ -4547,6 +4540,19 @@ A jump table for the options with a short description can be found at |Q_op|. < UI-dependent. Works best with RGB colors. 'termguicolors' + *'pumheight'* *'ph'* +'pumheight' 'ph' number (default 0) + global + Determines the maximum number of items to show in the popup menu for + Insert mode completion. When zero as much space as available is used. + |ins-completion-menu|. + + *'pumwidth'* *'pw'* +'pumwidth' 'pw' number (default 15) + global + Determines the minium width to use for the popup menu for Insert mode + completion. |ins-completion-menu|. + *'pyxversion'* *'pyx'* 'pyxversion' 'pyx' number (default depends on the build) global diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index b5806311c9..769f0fed58 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -430,9 +430,11 @@ _set_tokens_and_tags() { list_missing_vimpatches() { local -a missing_vim_patches=() _set_missing_vimpatches "$@" + set +u # Avoid "unbound variable" with bash < 4.4 below. for line in "${missing_vim_patches[@]}"; do printf '%s\n' "$line" done + set -u } # Sets / appends to missing_vim_patches (useful to avoid a subshell when diff --git a/src/nvim/edit.c b/src/nvim/edit.c index eecea03a19..cb5c7023d7 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -638,7 +638,7 @@ static int insert_check(VimState *state) static int insert_execute(VimState *state, int key) { - if (key == K_IGNORE) { + if (key == K_IGNORE || key == K_NOP) { return -1; // get another key } InsertState *s = (InsertState *)state; diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index e5f5e5ad87..c09a3c08ef 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -536,7 +536,7 @@ static int command_line_check(VimState *state) static int command_line_execute(VimState *state, int key) { - if (key == K_IGNORE) { + if (key == K_IGNORE || key == K_NOP) { return -1; // get another key } diff --git a/src/nvim/keymap.c b/src/nvim/keymap.c index b8b9c945b9..4b8b9992f5 100644 --- a/src/nvim/keymap.c +++ b/src/nvim/keymap.c @@ -309,6 +309,7 @@ static const struct key_name_entry { { K_ZERO, "Nul" }, { K_SNR, "SNR" }, { K_PLUG, "Plug" }, + { K_IGNORE, "Ignore" }, { K_COMMAND, "Cmd" }, { 0, NULL } // NOTE: When adding a long name update MAX_KEY_NAME_LEN. diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 9c5434a0dd..9c707a6fdc 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -874,8 +874,10 @@ static void normal_finish_command(NormalState *s) s->old_mapped_len = typebuf_maplen(); } - // If an operation is pending, handle it... - do_pending_operator(&s->ca, s->old_col, false); + // If an operation is pending, handle it. But not for K_IGNORE. + if (s->ca.cmdchar != K_IGNORE) { + do_pending_operator(&s->ca, s->old_col, false); + } // Wait for a moment when a message is displayed that will be overwritten // by the mode message. diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index 4f9f32794b..fcad6836bf 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -371,8 +371,9 @@ EXTERN long p_columns; // 'columns' EXTERN int p_confirm; // 'confirm' EXTERN int p_cp; // 'compatible' EXTERN char_u *p_cot; // 'completeopt' -EXTERN long p_ph; // 'pumheight' EXTERN long p_pb; // 'pumblend' +EXTERN long p_ph; // 'pumheight' +EXTERN long p_pw; // 'pumwidth' EXTERN char_u *p_cpo; // 'cpoptions' EXTERN char_u *p_csprg; // 'cscopeprg' EXTERN int p_csre; // 'cscoperelative' diff --git a/src/nvim/options.lua b/src/nvim/options.lua index 93bfc1c0b1..7d080b8d56 100644 --- a/src/nvim/options.lua +++ b/src/nvim/options.lua @@ -1816,6 +1816,14 @@ return { defaults={if_true={vi=true}} }, { + full_name='pumblend', abbreviation='pb', + type='number', scope={'global'}, + vi_def=true, + redraw={'ui_option'}, + varname='p_pb', + defaults={if_true={vi=0}} + }, + { full_name='pumheight', abbreviation='ph', type='number', scope={'global'}, vi_def=true, @@ -1823,12 +1831,11 @@ return { defaults={if_true={vi=0}} }, { - full_name='pumblend', abbreviation='pb', + full_name='pumwidth', abbreviation='pw', type='number', scope={'global'}, vi_def=true, - redraw={'ui_option'}, - varname='p_pb', - defaults={if_true={vi=0}} + varname='p_pw', + defaults={if_true={vi=15}} }, { full_name='pyxversion', abbreviation='pyx', diff --git a/src/nvim/popupmnu.c b/src/nvim/popupmnu.c index 7a7f8a9d75..4ba2a1032d 100644 --- a/src/nvim/popupmnu.c +++ b/src/nvim/popupmnu.c @@ -54,7 +54,6 @@ static bool pum_invalid = false; // the screen was just cleared # include "popupmnu.c.generated.h" #endif #define PUM_DEF_HEIGHT 10 -#define PUM_DEF_WIDTH 15 static void pum_compute_size(void) { @@ -84,7 +83,7 @@ static void pum_compute_size(void) /// Show the popup menu with items "array[size]". /// "array" must remain valid until pum_undisplay() is called! -/// When possible the leftmost character is aligned with screen column "col". +/// When possible the leftmost character is aligned with cursor column. /// The menu appears above the screen line "row" or at "row" + "height" - 1. /// /// @param array @@ -97,13 +96,12 @@ static void pum_compute_size(void) void pum_display(pumitem_T *array, int size, int selected, bool array_changed, int cmd_startcol) { - int def_width; int context_lines; int above_row; int below_row; int redo_count = 0; - int row; - int col; + int pum_win_row; + int cursor_col; if (!pum_is_visible) { // To keep the code simple, we only allow changing the @@ -123,23 +121,23 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed, // wildoptions=pum if (State == CMDLINE) { - row = ui_has(kUICmdline) ? 0 : cmdline_row; - col = cmd_startcol; + pum_win_row = ui_has(kUICmdline) ? 0 : cmdline_row; + cursor_col = cmd_startcol; pum_anchor_grid = ui_has(kUICmdline) ? -1 : DEFAULT_GRID_HANDLE; } else { // anchor position: the start of the completed word - row = curwin->w_wrow; + pum_win_row = curwin->w_wrow; if (curwin->w_p_rl) { - col = curwin->w_width - curwin->w_wcol - 1; + cursor_col = curwin->w_width - curwin->w_wcol - 1; } else { - col = curwin->w_wcol; + cursor_col = curwin->w_wcol; } pum_anchor_grid = (int)curwin->w_grid.handle; if (!ui_has(kUIMultigrid)) { pum_anchor_grid = (int)default_grid.handle; - row += curwin->w_winrow; - col += curwin->w_wincol; + pum_win_row += curwin->w_winrow; + cursor_col += curwin->w_wincol; } } @@ -154,14 +152,15 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed, ADD(item, STRING_OBJ(cstr_to_string((char *)array[i].pum_info))); ADD(arr, ARRAY_OBJ(item)); } - ui_call_popupmenu_show(arr, selected, row, col, pum_anchor_grid); + ui_call_popupmenu_show(arr, selected, pum_win_row, cursor_col, + pum_anchor_grid); } else { ui_call_popupmenu_select(selected); return; } } - def_width = PUM_DEF_WIDTH; + int def_width = (int)p_pw; win_T *pvwin = NULL; FOR_ALL_WINDOWS_IN_TAB(wp, curtab) { @@ -190,11 +189,11 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed, pum_height = (int)p_ph; } - // Put the pum below "row" if possible. If there are few lines decide on - // where there is more room. - if (row + 2 >= below_row - pum_height - && row - above_row > (below_row - above_row) / 2) { - // pum above "row" + // Put the pum below "pum_win_row" if possible. + // If there are few lines decide on where there is more room. + if (pum_win_row + 2 >= below_row - pum_height + && pum_win_row - above_row > (below_row - above_row) / 2) { + // pum above "pum_win_row" pum_above = true; // Leave two lines of context if possible @@ -204,12 +203,12 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed, context_lines = curwin->w_wrow - curwin->w_cline_row; } - if (row >= size + context_lines) { - pum_row = row - size - context_lines; + if (pum_win_row >= size + context_lines) { + pum_row = pum_win_row - size - context_lines; pum_height = size; } else { pum_row = 0; - pum_height = row - context_lines; + pum_height = pum_win_row - context_lines; } if ((p_ph > 0) && (pum_height > p_ph)) { @@ -217,7 +216,7 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed, pum_height = (int)p_ph; } } else { - // pum below "row" + // pum below "pum_win_row" pum_above = false; // Leave two lines of context if possible @@ -228,7 +227,7 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed, + curwin->w_cline_height - curwin->w_wrow; } - pum_row = row + context_lines; + pum_row = pum_win_row + context_lines; if (size > below_row - pum_row) { pum_height = below_row - pum_row; } else { @@ -245,16 +244,10 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed, return; } - // If there is a preview window above, avoid drawing over it. - // Do keep at least 10 entries. - if (pvwin != NULL && pum_row < above_row && pum_height > 10) { - if (row - above_row < 10) { - pum_row = row - 10; - pum_height = 10; - } else { - pum_row = above_row; - pum_height = row - above_row; - } + // If there is a preview window above avoid drawing over it. + if (pvwin != NULL && pum_row < above_row && pum_height > above_row) { + pum_row = above_row; + pum_height = pum_win_row - above_row; } if (pum_external) { return; @@ -277,11 +270,15 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed, def_width = max_width; } - if ((((col < Columns - PUM_DEF_WIDTH) || (col < Columns - max_width)) + if ((((cursor_col < Columns - p_pw) + || (cursor_col < Columns - max_width)) && !curwin->w_p_rl) - || (curwin->w_p_rl && ((col > PUM_DEF_WIDTH) || (col > max_width)))) { - // align pum column with "col" - pum_col = col; + || (curwin->w_p_rl + && ((cursor_col > p_pw) || (cursor_col > max_width)))) { + // align pum with "cursor_col" + pum_col = cursor_col; + + // start with the maximum space available if (curwin->w_p_rl) { pum_width = pum_col - pum_scrollbar + 1; } else { @@ -291,11 +288,60 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed, } if ((pum_width > max_width + pum_kind_width + pum_extra_width + 1) - && (pum_width > PUM_DEF_WIDTH)) { + && (pum_width > p_pw)) { + // the width is more than needed for the items, make it + // narrower pum_width = max_width + pum_kind_width + pum_extra_width + 1; - if (pum_width < PUM_DEF_WIDTH) { - pum_width = PUM_DEF_WIDTH; + if (pum_width < p_pw) { + pum_width = (int)p_pw; + } + } + } else if (((cursor_col > p_pw || cursor_col > max_width) + && !curwin->w_p_rl) + || (curwin->w_p_rl + && (cursor_col < Columns - p_pw + || cursor_col < Columns - max_width))) { + // align pum edge with "cursor_col" + if (curwin->w_p_rl + && W_ENDCOL(curwin) < max_width + pum_scrollbar + 1) { + pum_col = cursor_col + max_width + pum_scrollbar + 1; + if (pum_col >= Columns) { + pum_col = Columns - 1; + } + } else if (!curwin->w_p_rl) { + if (curwin->w_wincol > Columns - max_width - pum_scrollbar + && max_width <= p_pw) { + // use full width to end of the screen + pum_col = cursor_col - max_width - pum_scrollbar; + if (pum_col < 0) { + pum_col = 0; + } + } + } + + if (curwin->w_p_rl) { + pum_width = pum_col - pum_scrollbar + 1; + } else { + pum_width = Columns - pum_col - pum_scrollbar; + } + + if (pum_width < p_pw) { + pum_width = (int)p_pw; + if (curwin->w_p_rl) { + if (pum_width > pum_col) { + pum_width = pum_col; + } + } else { + if (pum_width >= Columns - pum_col) { + pum_width = Columns - pum_col - 1; + } + } + } else if (pum_width > max_width + pum_kind_width + pum_extra_width + 1 + && pum_width > p_pw) { + pum_width = max_width + pum_kind_width + pum_extra_width + 1; + if (pum_width < p_pw) { + pum_width = (int)p_pw; } } } else if (Columns < def_width) { @@ -309,9 +355,9 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed, assert(Columns - 1 >= INT_MIN); pum_width = (int)(Columns - 1); } else { - if (max_width > PUM_DEF_WIDTH) { + if (max_width > p_pw) { // truncate - max_width = PUM_DEF_WIDTH; + max_width = (int)p_pw; } if (curwin->w_p_rl) { @@ -474,7 +520,7 @@ void pum_redraw(void) if (size < pum_width) { // Most left character requires 2-cells but only 1 cell - // is available on screen. Put a '<' on the left of the + // is available on screen. Put a '<' on the left of the // pum item *(--rt) = '<'; size++; diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 1b7eeeecb8..0612575e67 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -121,8 +121,6 @@ #define MB_FILLER_CHAR '<' /* character used when a double-width character * doesn't fit. */ -#define W_ENDCOL(wp) (wp->w_wincol + wp->w_width) -#define W_ENDROW(wp) (wp->w_winrow + wp->w_height) // temporary buffer for rendering a single screenline, so it can be @@ -2447,8 +2445,6 @@ win_line ( pos.lnum = lnum; pos.col = search_match_endcol; getvcol(curwin, &pos, (colnr_T *)&tocol, NULL, NULL); - } else { - tocol = MAXCOL; } // do at least one character; happens when past end of line if (fromcol == tocol) { diff --git a/src/nvim/screen.h b/src/nvim/screen.h index 61ed98247d..9267672cf1 100644 --- a/src/nvim/screen.h +++ b/src/nvim/screen.h @@ -56,6 +56,9 @@ extern StlClickDefinition *tab_page_click_defs; /// Size of the tab_page_click_defs array extern long tab_page_click_defs_size; +#define W_ENDCOL(wp) (wp->w_wincol + wp->w_width) +#define W_ENDROW(wp) (wp->w_winrow + wp->w_height) + #ifdef INCLUDE_GENERATED_DECLARATIONS # include "screen.h.generated.h" #endif diff --git a/src/nvim/testdir/test_popup.vim b/src/nvim/testdir/test_popup.vim index 9db6112eeb..e5696f4cbb 100644 --- a/src/nvim/testdir/test_popup.vim +++ b/src/nvim/testdir/test_popup.vim @@ -733,6 +733,28 @@ func Test_popup_and_preview_autocommand() bw! endfunc +func Test_popup_and_previewwindow_dump() + if !CanRunVimInTerminal() + return + endif + call writefile([ + \ 'set previewheight=9', + \ 'silent! pedit', + \ 'call setline(1, map(repeat(["ab"], 10), "v:val. v:key"))', + \ 'exec "norm! G\<C-E>\<C-E>"', + \ ], 'Xscript') + let buf = RunVimInTerminal('-S Xscript', {}) + + " Test that popup and previewwindow do not overlap. + call term_sendkeys(buf, "o\<C-X>\<C-N>") + sleep 100m + call VerifyScreenDump(buf, 'Test_popup_and_previewwindow_01', {}) + + call term_sendkeys(buf, "\<Esc>u") + call StopVimInTerminal(buf) + call delete('Xscript') +endfunc + func Test_popup_position() if !CanRunVimInTerminal() return @@ -762,6 +784,15 @@ func Test_popup_position() call term_sendkeys(buf, "GA\<C-N>") call VerifyScreenDump(buf, 'Test_popup_position_03', {'rows': 8}) + " completed text wider than the window and 'pumwidth' smaller than available + " space + call term_sendkeys(buf, "\<Esc>u") + call term_sendkeys(buf, ":set pumwidth=20\<CR>") + call term_sendkeys(buf, "ggI123456789_\<Esc>") + call term_sendkeys(buf, "jI123456789_\<Esc>") + call term_sendkeys(buf, "GA\<C-N>") + call VerifyScreenDump(buf, 'Test_popup_position_04', {'rows': 10}) + call term_sendkeys(buf, "\<Esc>u") call StopVimInTerminal(buf) call delete('Xtest') diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua index fabcc05ce6..a0e5c3ca63 100644 --- a/test/functional/ui/popupmenu_spec.lua +++ b/test/functional/ui/popupmenu_spec.lua @@ -739,16 +739,16 @@ describe('builtin popupmenu', function() ee | ff | gg | - {s:aa } | - {n:bb }{3:iew][+] }| - {n:cc } | - {n:dd } | - {n:ee } | - {n:ff } | - {n:gg } | - {n:hh } | - {n:ii } | - {n:jj } | + hh | + {s:aa }{c: }{3:ew][+] }| + {n:bb }{c: } | + {n:cc }{c: } | + {n:dd }{c: } | + {n:ee }{c: } | + {n:ff }{c: } | + {n:gg }{c: } | + {n:hh }{c: } | + {n:ii }{s: } | aa^ | {4:[No Name] [+] }| {2:-- }{5:match 1 of 10} | @@ -1156,10 +1156,10 @@ describe('builtin popupmenu', function() funcs.complete(29, {'word', 'choice', 'text', 'thing'}) screen:expect([[ some long prefix before the ^ | - {1:~ }{n: word }| - {1:~ }{n: choice}| - {1:~ }{n: text }| - {1:~ }{n: thing }| + {n:word }{1: }| + {n:choice }{1: }| + {n:text }{1: }| + {n:thing }{1: }| {1:~ }| {1:~ }| {1:~ }| @@ -1204,10 +1204,10 @@ describe('builtin popupmenu', function() feed('<c-p>') screen:expect([[ some long prefix before the text| - {1:^~ }{n: word }| - {1:~ }{n: choice}| - {1:~ }{s: text }| - {1:~ }{n: thing }| + {n:^word }{1: }| + {n:choice }{1: }| + {s:text }{1: }| + {n:thing }{1: }| {1:~ }| {1:~ }| {1:~ }| @@ -1301,10 +1301,10 @@ describe('builtin popupmenu', function() funcs.complete(29, {'word', 'choice', 'text', 'thing'}) screen:expect([[ some long prefix before the ^ | - {1:~ }{n: word }| - {1:~ }{n: choice}| - {1:~ }{n: text }| - {1:~ }{n: thing }| + {n:word }{1: }| + {n:choice }{1: }| + {n:text }{1: }| + {n:thing }{1: }| {1:~ }| {1:~ }| {1:~ }| @@ -2019,4 +2019,42 @@ describe('builtin popupmenu', function() {9:-- Keyword Local completion (^N^P) }{10:match 1 of 3} | ]]) end) + + it("'pumheight'", function() + screen:try_resize(32,8) + feed('isome long prefix before the ') + command("set completeopt+=noinsert,noselect") + command("set linebreak") + command("set pumheight=2") + funcs.complete(29, {'word', 'choice', 'text', 'thing'}) + screen:expect([[ + some long prefix before the ^ | + {n:word }{c: }{1: }| + {n:choice }{s: }{1: }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {2:-- INSERT --} | + ]]) + end) + + it("'pumwidth'", function() + screen:try_resize(32,8) + feed('isome long prefix before the ') + command("set completeopt+=noinsert,noselect") + command("set linebreak") + command("set pumwidth=8") + funcs.complete(29, {'word', 'choice', 'text', 'thing'}) + screen:expect([[ + some long prefix before the ^ | + {n:word }{1: }| + {n:choice }{1: }| + {n:text }{1: }| + {n:thing }{1: }| + {1:~ }| + {1:~ }| + {2:-- INSERT --} | + ]]) + end) end) |