vim-patch:9.1.1284: not possible to configure pum truncation char

Problem:  not possible to configure the completion menu truncation
          character
Solution: add the "trunc" suboption to the 'fillchars' setting to
          configure the truncation indicator (glepnir).

closes: vim/vim#17006

b87620466c

Co-authored-by: glepnir <glephunter@gmail.com>
This commit is contained in:
zeertzjq
2025-04-08 13:32:28 +08:00
parent b64c2d763e
commit 1c723b2e6f
10 changed files with 464 additions and 185 deletions

View File

@@ -2615,8 +2615,8 @@ A jump table for the options with a short description can be found at |Q_op|.
*'fillchars'* *'fcs'* *'fillchars'* *'fcs'*
'fillchars' 'fcs' string (default "") 'fillchars' 'fcs' string (default "")
global or local to window |global-local| global or local to window |global-local|
Characters to fill the statuslines, vertical separators and special Characters to fill the statuslines, vertical separators, special
lines in the window. lines in the window and truncated text in the |ins-completion-menu|.
It is a comma-separated list of items. Each item has a name, a colon It is a comma-separated list of items. Each item has a name, a colon
and the value of that item: |E1511| and the value of that item: |E1511|
@@ -2640,6 +2640,8 @@ A jump table for the options with a short description can be found at |Q_op|.
msgsep ' ' message separator 'display' msgsep ' ' message separator 'display'
eob '~' empty lines at the end of a buffer eob '~' empty lines at the end of a buffer
lastline '@' 'display' contains lastline/truncate lastline '@' 'display' contains lastline/truncate
trunc '>' truncated text in the
|ins-completion-menu|.
Any one that is omitted will fall back to the default. Any one that is omitted will fall back to the default.
@@ -2671,9 +2673,14 @@ A jump table for the options with a short description can be found at |Q_op|.
vertright WinSeparator |hl-WinSeparator| vertright WinSeparator |hl-WinSeparator|
verthoriz WinSeparator |hl-WinSeparator| verthoriz WinSeparator |hl-WinSeparator|
fold Folded |hl-Folded| fold Folded |hl-Folded|
foldopen FoldColumn |hl-FoldColumn|
foldclose FoldColumn |hl-FoldColumn|
foldsep FoldColumn |hl-FoldColumn|
diff DiffDelete |hl-DiffDelete| diff DiffDelete |hl-DiffDelete|
eob EndOfBuffer |hl-EndOfBuffer| eob EndOfBuffer |hl-EndOfBuffer|
lastline NonText |hl-NonText| lastline NonText |hl-NonText|
trunc one of the many Popup menu highlighting groups like
|hl-PmenuSel|
*'findfunc'* *'ffu'* *E1514* *'findfunc'* *'ffu'* *E1514*
'findfunc' 'ffu' string (default "") 'findfunc' 'ffu' string (default "")
@@ -4656,8 +4663,10 @@ A jump table for the options with a short description can be found at |Q_op|.
global global
Maximum width for the popup menu (|ins-completion-menu|). When zero, Maximum width for the popup menu (|ins-completion-menu|). When zero,
there is no maximum width limit, otherwise the popup menu will never be there is no maximum width limit, otherwise the popup menu will never be
wider than this value. Truncated text will be indicated by "..." at the wider than this value. Truncated text will be indicated by "trunc"
end. Takes precedence over 'pumwidth'. value of 'fillchars' option.
This option takes precedence over 'pumwidth'.
*'pumwidth'* *'pw'* *'pumwidth'* *'pw'*
'pumwidth' 'pw' number (default 15) 'pumwidth' 'pw' number (default 15)

View File

@@ -2307,8 +2307,8 @@ vim.o.ft = vim.o.filetype
vim.bo.filetype = vim.o.filetype vim.bo.filetype = vim.o.filetype
vim.bo.ft = vim.bo.filetype vim.bo.ft = vim.bo.filetype
--- Characters to fill the statuslines, vertical separators and special --- Characters to fill the statuslines, vertical separators, special
--- lines in the window. --- lines in the window and truncated text in the `ins-completion-menu`.
--- It is a comma-separated list of items. Each item has a name, a colon --- It is a comma-separated list of items. Each item has a name, a colon
--- and the value of that item: `E1511` --- and the value of that item: `E1511`
--- ---
@@ -2332,6 +2332,8 @@ vim.bo.ft = vim.bo.filetype
--- msgsep ' ' message separator 'display' --- msgsep ' ' message separator 'display'
--- eob '~' empty lines at the end of a buffer --- eob '~' empty lines at the end of a buffer
--- lastline '@' 'display' contains lastline/truncate --- lastline '@' 'display' contains lastline/truncate
--- trunc '>' truncated text in the
--- `ins-completion-menu`.
--- ---
--- Any one that is omitted will fall back to the default. --- Any one that is omitted will fall back to the default.
--- ---
@@ -2366,9 +2368,14 @@ vim.bo.ft = vim.bo.filetype
--- vertright WinSeparator `hl-WinSeparator` --- vertright WinSeparator `hl-WinSeparator`
--- verthoriz WinSeparator `hl-WinSeparator` --- verthoriz WinSeparator `hl-WinSeparator`
--- fold Folded `hl-Folded` --- fold Folded `hl-Folded`
--- foldopen FoldColumn `hl-FoldColumn`
--- foldclose FoldColumn `hl-FoldColumn`
--- foldsep FoldColumn `hl-FoldColumn`
--- diff DiffDelete `hl-DiffDelete` --- diff DiffDelete `hl-DiffDelete`
--- eob EndOfBuffer `hl-EndOfBuffer` --- eob EndOfBuffer `hl-EndOfBuffer`
--- lastline NonText `hl-NonText` --- lastline NonText `hl-NonText`
--- trunc one of the many Popup menu highlighting groups like
--- `hl-PmenuSel`
--- ---
--- @type string --- @type string
vim.o.fillchars = "" vim.o.fillchars = ""
@@ -4838,8 +4845,10 @@ vim.go.ph = vim.go.pumheight
--- Maximum width for the popup menu (`ins-completion-menu`). When zero, --- Maximum width for the popup menu (`ins-completion-menu`). When zero,
--- there is no maximum width limit, otherwise the popup menu will never be --- there is no maximum width limit, otherwise the popup menu will never be
--- wider than this value. Truncated text will be indicated by "..." at the --- wider than this value. Truncated text will be indicated by "trunc"
--- end. Takes precedence over 'pumwidth'. --- value of 'fillchars' option.
---
--- This option takes precedence over 'pumwidth'.
--- ---
--- @type integer --- @type integer
vim.o.pummaxwidth = 0 vim.o.pummaxwidth = 0

View File

@@ -1,7 +1,7 @@
" These commands create the option window. " These commands create the option window.
" "
" Maintainer: The Vim Project <https://github.com/vim/vim> " Maintainer: The Vim Project <https://github.com/vim/vim>
" Last Change: 2025 Apr 06 " Last Change: 2025 Apr 07
" Former Maintainer: Bram Moolenaar <Bram@vim.org> " Former Maintainer: Bram Moolenaar <Bram@vim.org>
" If there already is an option window, jump to that one. " If there already is an option window, jump to that one.
@@ -333,7 +333,7 @@ call <SID>AddOption("sidescrolloff", gettext("minimal number of columns to keep
call append("$", " \tset siso=" . &siso) call append("$", " \tset siso=" . &siso)
call <SID>AddOption("display", gettext("include \"lastline\" to show the last line even if it doesn't fit\ninclude \"uhex\" to show unprintable characters as a hex number")) call <SID>AddOption("display", gettext("include \"lastline\" to show the last line even if it doesn't fit\ninclude \"uhex\" to show unprintable characters as a hex number"))
call <SID>OptionG("dy", &dy) call <SID>OptionG("dy", &dy)
call <SID>AddOption("fillchars", gettext("characters to use for the status line, folds and filler lines")) call <SID>AddOption("fillchars", gettext("characters to use for the status line, folds, diffs, buffer text, filler lines and truncation in the completion menu"))
call <SID>OptionG("fcs", &fcs) call <SID>OptionG("fcs", &fcs)
call <SID>AddOption("cmdheight", gettext("number of lines used for the command-line")) call <SID>AddOption("cmdheight", gettext("number of lines used for the command-line"))
call append("$", " \tset ch=" . &ch) call append("$", " \tset ch=" . &ch)

View File

@@ -1056,6 +1056,7 @@ typedef struct {
schar_T msgsep; schar_T msgsep;
schar_T eob; schar_T eob;
schar_T lastline; schar_T lastline;
schar_T trunc;
} fcs_chars_T; } fcs_chars_T;
/// Structure which contains all information that belongs to a window. /// Structure which contains all information that belongs to a window.

View File

@@ -3035,8 +3035,8 @@ local options = {
defaults = '', defaults = '',
deny_duplicates = true, deny_duplicates = true,
desc = [=[ desc = [=[
Characters to fill the statuslines, vertical separators and special Characters to fill the statuslines, vertical separators, special
lines in the window. lines in the window and truncated text in the |ins-completion-menu|.
It is a comma-separated list of items. Each item has a name, a colon It is a comma-separated list of items. Each item has a name, a colon
and the value of that item: |E1511| and the value of that item: |E1511|
@@ -3060,6 +3060,8 @@ local options = {
msgsep ' ' message separator 'display' msgsep ' ' message separator 'display'
eob '~' empty lines at the end of a buffer eob '~' empty lines at the end of a buffer
lastline '@' 'display' contains lastline/truncate lastline '@' 'display' contains lastline/truncate
trunc '>' truncated text in the
|ins-completion-menu|.
Any one that is omitted will fall back to the default. Any one that is omitted will fall back to the default.
@@ -3091,9 +3093,14 @@ local options = {
vertright WinSeparator |hl-WinSeparator| vertright WinSeparator |hl-WinSeparator|
verthoriz WinSeparator |hl-WinSeparator| verthoriz WinSeparator |hl-WinSeparator|
fold Folded |hl-Folded| fold Folded |hl-Folded|
foldopen FoldColumn |hl-FoldColumn|
foldclose FoldColumn |hl-FoldColumn|
foldsep FoldColumn |hl-FoldColumn|
diff DiffDelete |hl-DiffDelete| diff DiffDelete |hl-DiffDelete|
eob EndOfBuffer |hl-EndOfBuffer| eob EndOfBuffer |hl-EndOfBuffer|
lastline NonText |hl-NonText| lastline NonText |hl-NonText|
trunc one of the many Popup menu highlighting groups like
|hl-PmenuSel|
]=], ]=],
expand_cb = 'expand_set_chars_option', expand_cb = 'expand_set_chars_option',
full_name = 'fillchars', full_name = 'fillchars',
@@ -6477,8 +6484,10 @@ local options = {
desc = [=[ desc = [=[
Maximum width for the popup menu (|ins-completion-menu|). When zero, Maximum width for the popup menu (|ins-completion-menu|). When zero,
there is no maximum width limit, otherwise the popup menu will never be there is no maximum width limit, otherwise the popup menu will never be
wider than this value. Truncated text will be indicated by "..." at the wider than this value. Truncated text will be indicated by "trunc"
end. Takes precedence over 'pumwidth'. value of 'fillchars' option.
This option takes precedence over 'pumwidth'.
]=], ]=],
full_name = 'pummaxwidth', full_name = 'pummaxwidth',
scope = { 'global' }, scope = { 'global' },

View File

@@ -2132,6 +2132,7 @@ static const struct chars_tab fcs_tab[] = {
CHARSTAB_ENTRY(&fcs_chars.msgsep, "msgsep", " ", NULL), CHARSTAB_ENTRY(&fcs_chars.msgsep, "msgsep", " ", NULL),
CHARSTAB_ENTRY(&fcs_chars.eob, "eob", "~", NULL), CHARSTAB_ENTRY(&fcs_chars.eob, "eob", "~", NULL),
CHARSTAB_ENTRY(&fcs_chars.lastline, "lastline", "@", NULL), CHARSTAB_ENTRY(&fcs_chars.lastline, "lastline", "@", NULL),
CHARSTAB_ENTRY(&fcs_chars.trunc, "trunc", ">", NULL),
}; };
static lcs_chars_T lcs_chars; static lcs_chars_T lcs_chars;
@@ -2237,6 +2238,7 @@ const char *set_chars_option(win_T *wp, const char *value, CharsOption what, boo
} }
const char *s = p + tab[i].name.size + 1; const char *s = p + tab[i].name.size + 1;
if (what == kListchars && strcmp(tab[i].name.data, "multispace") == 0) { if (what == kListchars && strcmp(tab[i].name.data, "multispace") == 0) {
if (round == 0) { if (round == 0) {
// Get length of lcs-multispace string in the first round // Get length of lcs-multispace string in the first round
@@ -2257,7 +2259,6 @@ const char *set_chars_option(win_T *wp, const char *value, CharsOption what, boo
e_wrong_number_of_characters_for_field_str, e_wrong_number_of_characters_for_field_str,
tab[i].name.data); tab[i].name.data);
} }
p = s;
} else { } else {
int multispace_pos = 0; int multispace_pos = 0;
while (*s != NUL && *s != ',') { while (*s != NUL && *s != ',') {
@@ -2266,14 +2267,14 @@ const char *set_chars_option(win_T *wp, const char *value, CharsOption what, boo
lcs_chars.multispace[multispace_pos++] = c1; lcs_chars.multispace[multispace_pos++] = c1;
} }
} }
p = s;
} }
p = s;
break; break;
} }
if (what == kListchars && strcmp(tab[i].name.data, "leadmultispace") == 0) { if (what == kListchars && strcmp(tab[i].name.data, "leadmultispace") == 0) {
if (round == 0) { if (round == 0) {
// get length of lcs-leadmultispace string in first round // Get length of lcs-leadmultispace string in first round
last_lmultispace = p; last_lmultispace = p;
lead_multispace_len = 0; lead_multispace_len = 0;
while (*s != NUL && *s != ',') { while (*s != NUL && *s != ',') {
@@ -2291,7 +2292,6 @@ const char *set_chars_option(win_T *wp, const char *value, CharsOption what, boo
e_wrong_number_of_characters_for_field_str, e_wrong_number_of_characters_for_field_str,
tab[i].name.data); tab[i].name.data);
} }
p = s;
} else { } else {
int multispace_pos = 0; int multispace_pos = 0;
while (*s != NUL && *s != ',') { while (*s != NUL && *s != ',') {
@@ -2300,8 +2300,8 @@ const char *set_chars_option(win_T *wp, const char *value, CharsOption what, boo
lcs_chars.leadmultispace[multispace_pos++] = c1; lcs_chars.leadmultispace[multispace_pos++] = c1;
} }
} }
p = s;
} }
p = s;
break; break;
} }

View File

@@ -577,6 +577,7 @@ void pum_redraw(void)
int thumb_pos = 0; int thumb_pos = 0;
int thumb_height = 1; int thumb_height = 1;
int n; int n;
schar_T fcs_trunc = curwin->w_p_fcs_chars.trunc;
// "word" "kind" "extra text" // "word" "kind" "extra text"
const hlf_T hlfsNorm[3] = { HLF_PNI, HLF_PNK, HLF_PNX }; const hlf_T hlfsNorm[3] = { HLF_PNI, HLF_PNK, HLF_PNX };
@@ -644,8 +645,6 @@ void pum_redraw(void)
thumb_pos = (pum_first * (pum_height - thumb_height) + scroll_range / 2) / scroll_range; thumb_pos = (pum_first * (pum_height - thumb_height) + scroll_range / 2) / scroll_range;
} }
const int ellipsis_width = 3;
for (int i = 0; i < pum_height; i++) { for (int i = 0; i < pum_height; i++) {
int idx = i + pum_first; int idx = i + pum_first;
const hlf_T *const hlfs = (idx == pum_selected) ? hlfsSel : hlfsNorm; const hlf_T *const hlfs = (idx == pum_selected) ? hlfsSel : hlfsNorm;
@@ -668,7 +667,7 @@ void pum_redraw(void)
// Do this 3 times and order from p_cia // Do this 3 times and order from p_cia
int grid_col = col_off; int grid_col = col_off;
int totwidth = 0; int totwidth = 0;
bool need_ellipsis = false; bool need_fcs_trunc = false;
int order[3]; int order[3];
int items_width_array[3] = { pum_base_width, pum_kind_width, pum_extra_width }; int items_width_array[3] = { pum_base_width, pum_kind_width, pum_extra_width };
pum_align_order(order); pum_align_order(order);
@@ -721,9 +720,8 @@ void pum_redraw(void)
char *rt = reverse_text(st); char *rt = reverse_text(st);
char *rt_start = rt; char *rt_start = rt;
int cells = (int)mb_string2cells(rt); int cells = (int)mb_string2cells(rt);
if (p_pmw > ellipsis_width && pum_width == p_pmw if (pum_width == p_pmw && totwidth + 1 + cells >= pum_width) {
&& grid_col - cells < col_off - pum_width) { need_fcs_trunc = true;
need_ellipsis = true;
} }
if (grid_col - cells < col_off - pum_width) { if (grid_col - cells < col_off - pum_width) {
@@ -751,9 +749,8 @@ void pum_redraw(void)
grid_col -= width; grid_col -= width;
} else { } else {
int cells = (int)mb_string2cells(st); int cells = (int)mb_string2cells(st);
if (p_pmw > ellipsis_width && pum_width == p_pmw if (pum_width == p_pmw && totwidth + 1 + cells >= pum_width) {
&& grid_col + cells > col_off + pum_width) { need_fcs_trunc = true;
need_ellipsis = true;
} }
if (attrs == NULL) { if (attrs == NULL) {
@@ -820,21 +817,21 @@ void pum_redraw(void)
if (pum_rl) { if (pum_rl) {
const int lcol = col_off - pum_width + 1; const int lcol = col_off - pum_width + 1;
grid_line_fill(lcol, grid_col + 1, schar_from_ascii(' '), orig_attr); grid_line_fill(lcol, grid_col + 1, schar_from_ascii(' '), orig_attr);
if (need_ellipsis) { if (need_fcs_trunc) {
bool over_wide = pum_width > ellipsis_width && linebuf_char[lcol + ellipsis_width] == NUL; linebuf_char[lcol] = fcs_trunc != NUL && fcs_trunc != schar_from_ascii('>')
grid_line_fill(lcol, lcol + ellipsis_width, schar_from_ascii('.'), orig_attr); ? fcs_trunc : schar_from_ascii('<');
if (over_wide) { if (pum_width > 1 && linebuf_char[lcol + 1] == NUL) {
grid_line_put_schar(lcol + ellipsis_width, schar_from_ascii(' '), orig_attr); linebuf_char[lcol + 1] = schar_from_ascii(' ');
} }
} }
} else { } else {
const int rcol = col_off + pum_width; const int rcol = col_off + pum_width;
grid_line_fill(grid_col, rcol, schar_from_ascii(' '), orig_attr); grid_line_fill(grid_col, rcol, schar_from_ascii(' '), orig_attr);
if (need_ellipsis) { if (need_fcs_trunc) {
if (pum_width > ellipsis_width && linebuf_char[rcol - ellipsis_width] == NUL) { if (pum_width > 1 && linebuf_char[rcol - 1] == NUL) {
grid_line_put_schar(rcol - ellipsis_width - 1, schar_from_ascii(' '), orig_attr); linebuf_char[rcol - 2] = schar_from_ascii(' ');
} }
grid_line_fill(rcol - ellipsis_width, rcol, schar_from_ascii('.'), orig_attr); linebuf_char[rcol - 1] = fcs_trunc != NUL ? fcs_trunc : schar_from_ascii('>');
} }
} }

View File

@@ -5626,7 +5626,7 @@ describe('builtin popupmenu', function()
end) end)
-- oldtest: Test_pum_maxwidth() -- oldtest: Test_pum_maxwidth()
it('"pummaxwidth"', function() it("'pummaxwidth'", function()
screen:try_resize(60, 8) screen:try_resize(60, 8)
api.nvim_buf_set_lines(0, 0, -1, true, { api.nvim_buf_set_lines(0, 0, -1, true, {
'123456789_123456789_123456789_a', '123456789_123456789_123456789_a',
@@ -5683,8 +5683,8 @@ describe('builtin popupmenu', function()
## grid 3 ## grid 3
{2:-- Keyword Local completion (^N^P) }{5:match 1 of 2} | {2:-- Keyword Local completion (^N^P) }{5:match 1 of 2} |
## grid 4 ## grid 4
{s: 1234567...}| {s: 123456789>}|
{n: 1234567...}| {n: 123456789>}|
]], ]],
float_pos = { [4] = { -1, 'NW', 2, 3, 11, false, 100, 1, 3, 11 } }, float_pos = { [4] = { -1, 'NW', 2, 3, 11, false, 100, 1, 3, 11 } },
}) })
@@ -5693,8 +5693,8 @@ describe('builtin popupmenu', function()
123456789_123456789_123456789_a | 123456789_123456789_123456789_a |
123456789_123456789_123456789_b | 123456789_123456789_123456789_b |
123456789_123456789_123456789_a^ | 123456789_123456789_123456789_a^ |
{1:~ }{s: 1234567...}{1: }| {1:~ }{s: 123456789>}{1: }|
{1:~ }{n: 1234567...}{1: }| {1:~ }{n: 123456789>}{1: }|
{1:~ }|*2 {1:~ }|*2
{2:-- Keyword Local completion (^N^P) }{5:match 1 of 2} | {2:-- Keyword Local completion (^N^P) }{5:match 1 of 2} |
]]) ]])
@@ -5717,8 +5717,8 @@ describe('builtin popupmenu', function()
## grid 3 ## grid 3
{2:-- Keyword Local completion (^N^P) }{5:match 1 of 2} | {2:-- Keyword Local completion (^N^P) }{5:match 1 of 2} |
## grid 4 ## grid 4
{s: 123456789_1234567...}| {s: 123456789_123456789>}|
{n: 123456789_1234567...}| {n: 123456789_123456789>}|
]], ]],
float_pos = { [4] = { -1, 'NW', 2, 3, 11, false, 100, 1, 3, 11 } }, float_pos = { [4] = { -1, 'NW', 2, 3, 11, false, 100, 1, 3, 11 } },
}) })
@@ -5727,8 +5727,8 @@ describe('builtin popupmenu', function()
123456789_123456789_123456789_a | 123456789_123456789_123456789_a |
123456789_123456789_123456789_b | 123456789_123456789_123456789_b |
123456789_123456789_123456789_a^ | 123456789_123456789_123456789_a^ |
{1:~ }{s: 123456789_1234567...}{1: }| {1:~ }{s: 123456789_123456789>}{1: }|
{1:~ }{n: 123456789_1234567...}{1: }| {1:~ }{n: 123456789_123456789>}{1: }|
{1:~ }|*2 {1:~ }|*2
{2:-- Keyword Local completion (^N^P) }{5:match 1 of 2} | {2:-- Keyword Local completion (^N^P) }{5:match 1 of 2} |
]]) ]])
@@ -5751,8 +5751,8 @@ describe('builtin popupmenu', function()
## grid 3 ## grid 3
{2:-- Keyword Local completion (^N^P) }{5:match 1 of 2} | {2:-- Keyword Local completion (^N^P) }{5:match 1 of 2} |
## grid 4 ## grid 4
{s: 12345...}| {s: 1234567>}|
{n: 12345...}| {n: 1234567>}|
]], ]],
float_pos = { [4] = { -1, 'NW', 2, 3, 11, false, 100, 1, 3, 11 } }, float_pos = { [4] = { -1, 'NW', 2, 3, 11, false, 100, 1, 3, 11 } },
}) })
@@ -5761,8 +5761,8 @@ describe('builtin popupmenu', function()
123456789_123456789_123456789_a | 123456789_123456789_123456789_a |
123456789_123456789_123456789_b | 123456789_123456789_123456789_b |
123456789_123456789_123456789_a^ | 123456789_123456789_123456789_a^ |
{1:~ }{s: 12345...}{1: }| {1:~ }{s: 1234567>}{1: }|
{1:~ }{n: 12345...}{1: }| {1:~ }{n: 1234567>}{1: }|
{1:~ }|*2 {1:~ }|*2
{2:-- Keyword Local completion (^N^P) }{5:match 1 of 2} | {2:-- Keyword Local completion (^N^P) }{5:match 1 of 2} |
]]) ]])
@@ -5786,8 +5786,8 @@ describe('builtin popupmenu', function()
## grid 3 ## grid 3
{2:-- }{5:match 1 of 2} | {2:-- }{5:match 1 of 2} |
## grid 4 ## grid 4
{s: 12345...}| {s: 1234567>}|
{n: 12345...}| {n: 1234567>}|
]], ]],
float_pos = { [4] = { -1, 'NW', 2, 4, 11, false, 100, 1, 4, 11 } }, float_pos = { [4] = { -1, 'NW', 2, 4, 11, false, 100, 1, 4, 11 } },
}) })
@@ -5797,8 +5797,8 @@ describe('builtin popupmenu', function()
123456789_123456789_123456789_b | 123456789_123456789_123456789_b |
123456789_123456789_| 123456789_123456789_|
123456789_a^ | 123456789_a^ |
{1:~ }{s: 12345...}{1: }| {1:~ }{s: 1234567>}{1: }|
{1:~ }{n: 12345...}{1: }| {1:~ }{n: 1234567>}{1: }|
{1:~ }|*3 {1:~ }|*3
{2:-- }{5:match 1 of 2} | {2:-- }{5:match 1 of 2} |
]]) ]])
@@ -5810,18 +5810,36 @@ describe('builtin popupmenu', function()
it("'pummaxwidth' with multibyte", function() it("'pummaxwidth' with multibyte", function()
screen:try_resize(60, 8) screen:try_resize(60, 8)
exec([[ exec([[
let g:change = 0
func Omni_test(findstart, base) func Omni_test(findstart, base)
if a:findstart if a:findstart
return col(".") return col(".")
endif endif
if g:change == 0
return [ return [
\ #{word: "123456789_123456789_123456789_"}, \ #{word: "123456789_123456789_123456789_"},
\ #{word: "一二三四五六七八九十"}, \ #{word: "一二三四五六七八九十"},
\ #{word: "abcdefghij"}, \ #{word: "abcdefghij"},
\ #{word: "上下左右"}, \ #{word: "上下左右"},
\ ] \ ]
elseif g:change == 1
return [
\ #{word: "foo", menu: "fooMenu", kind: "fooKind"},
\ #{word: "bar", menu: "barMenu", kind: "barKind"},
\ #{word: "baz", menu: "bazMenu", kind: "bazKind"},
\ ]
elseif g:change == 2
return [
\ #{word: "foo", menu: "fooMenu", kind: "fooKind"},
\ #{word: "bar", menu: "fooMenu", kind: "一二三四"},
\ #{word: "一二三四五", kind: "multi"},
\ ]
else
return [#{word: "bar", menu: "fooMenu", kind: "一二三"}]
endif
endfunc endfunc
set omnifunc=Omni_test set omnifunc=Omni_test
set cot+=menuone
]]) ]])
feed('S<C-X><C-O>') feed('S<C-X><C-O>')
@@ -5871,9 +5889,9 @@ describe('builtin popupmenu', function()
## grid 3 ## grid 3
{2:-- Omni completion (^O^N^P) }{5:match 1 of 4} | {2:-- Omni completion (^O^N^P) }{5:match 1 of 4} |
## grid 4 ## grid 4
{s:1234567...}| {s:123456789>}|
{n:一二三 ...}| {n:一二三四 >}|
{n:abcdefghij}| {n:abcdefghi>}|
{n:上下左右 }| {n:上下左右 }|
]], ]],
float_pos = { [4] = { -1, 'NW', 2, 1, 0, false, 100, 1, 1, 0 } }, float_pos = { [4] = { -1, 'NW', 2, 1, 0, false, 100, 1, 1, 0 } },
@@ -5881,9 +5899,9 @@ describe('builtin popupmenu', function()
else else
screen:expect([[ screen:expect([[
123456789_123456789_123456789_^ | 123456789_123456789_123456789_^ |
{s:1234567...}{1: }| {s:123456789>}{1: }|
{n:一二三 ...}{1: }| {n:一二三四 >}{1: }|
{n:abcdefghij}{1: }| {n:abcdefghi>}{1: }|
{n:上下左右 }{1: }| {n:上下左右 }{1: }|
{1:~ }|*2 {1:~ }|*2
{2:-- Omni completion (^O^N^P) }{5:match 1 of 4} | {2:-- Omni completion (^O^N^P) }{5:match 1 of 4} |
@@ -5905,9 +5923,9 @@ describe('builtin popupmenu', function()
## grid 3 ## grid 3
{2:-- Omni completion (^O^N^P) }{5:match 1 of 4} | {2:-- Omni completion (^O^N^P) }{5:match 1 of 4} |
## grid 4 ## grid 4
{s:...7654321}| {s:<987654321}|
{n:... 三二一}| {n:< 四三二一}|
{n:jihgfedcba}| {n:<ihgfedcba}|
{n: 右左下上}| {n: 右左下上}|
]], ]],
float_pos = { [4] = { -1, 'NW', 2, 1, 50, false, 100, 1, 1, 50 } }, float_pos = { [4] = { -1, 'NW', 2, 1, 50, false, 100, 1, 1, 50 } },
@@ -5915,9 +5933,9 @@ describe('builtin popupmenu', function()
else else
screen:expect([[ screen:expect([[
^ _987654321_987654321_987654321| ^ _987654321_987654321_987654321|
{1: }{s:...7654321}| {1: }{s:<987654321}|
{1: }{n:... 三二一}| {1: }{n:< 四三二一}|
{1: }{n:jihgfedcba}| {1: }{n:<ihgfedcba}|
{1: }{n: 右左下上}| {1: }{n: 右左下上}|
{1: ~}|*2 {1: ~}|*2
{2:-- Omni completion (^O^N^P) }{5:match 1 of 4} | {2:-- Omni completion (^O^N^P) }{5:match 1 of 4} |
@@ -5940,43 +5958,29 @@ describe('builtin popupmenu', function()
## grid 3 ## grid 3
{2:-- Omni completion (^O^N^P) }{5:match 1 of 4} | {2:-- Omni completion (^O^N^P) }{5:match 1 of 4} |
## grid 4 ## grid 4
{s:12}| {s:1>}|
{n:}| {n: >}|
{n:ab}| {n:a>}|
{n:}| {n: >}|
]], ]],
float_pos = { [4] = { -1, 'NW', 2, 1, 0, false, 100, 1, 1, 0 } }, float_pos = { [4] = { -1, 'NW', 2, 1, 0, false, 100, 1, 1, 0 } },
}) })
else else
screen:expect([[ screen:expect([[
123456789_123456789_123456789_^ | 123456789_123456789_123456789_^ |
{s:12}{1: }| {s:1>}{1: }|
{n:}{1: }| {n: >}{1: }|
{n:ab}{1: }| {n:a>}{1: }|
{n:}{1: }| {n: >}{1: }|
{1:~ }|*2 {1:~ }|*2
{2:-- Omni completion (^O^N^P) }{5:match 1 of 4} | {2:-- Omni completion (^O^N^P) }{5:match 1 of 4} |
]]) ]])
end end
feed('<Esc>') feed('<Esc>')
end)
it([['pummaxwidth' works with "kind" and "menu"]], function()
exec([[
func Omni_test(findstart, base)
if a:findstart
return col(".")
endif
return [
\ #{word: "foo", menu: "fooMenu", kind: "fooKind"},
\ #{word: "bar", menu: "barMenu", kind: "barKind"},
\ #{word: "baz", menu: "bazMenu", kind: "bazKind"},
\ ]
endfunc
set omnifunc=Omni_test
]])
screen:try_resize(32, 20)
command('set pummaxwidth=14') command('set pummaxwidth=14')
command('let g:change=1')
feed('S<C-X><C-O>') feed('S<C-X><C-O>')
if multigrid then if multigrid then
screen:expect({ screen:expect({
@@ -5990,24 +5994,155 @@ describe('builtin popupmenu', function()
## grid 3 ## grid 3
{2:-- }{5:match 1 of 3} | {2:-- }{5:match 1 of 3} |
## grid 4 ## grid 4
{s:foo fooKind...}| {s:foo fooKind f>}|
{n:bar barKind...}| {n:bar barKind b>}|
{n:baz bazKind...}| {n:baz bazKind b>}|
]], ]],
float_pos = { [4] = { -1, 'NW', 2, 1, 0, false, 100, 1, 1, 0 } }, float_pos = { [4] = { -1, 'NW', 2, 1, 0, false, 100, 1, 1, 0 } },
}) })
else else
screen:expect([[ screen:expect([[
foo^ | foo^ |
{s:foo fooKind...}{1: }| {s:foo fooKind f>}{1: }|
{n:bar barKind...}{1: }| {n:bar barKind b>}{1: }|
{n:baz bazKind...}{1: }| {n:baz bazKind b>}{1: }|
{1:~ }|*15 {1:~ }|*15
{2:-- }{5:match 1 of 3} | {2:-- }{5:match 1 of 3} |
]]) ]])
end end
feed('<Esc>') feed('<Esc>')
-- Unicode Character U+2026 but one cell
command('set fcs+=trunc:…')
feed('S<C-X><C-O>')
if multigrid then
screen:expect({
grid = [[
## grid 1
[2:--------------------------------]|*19
[3:--------------------------------]|
## grid 2
foo^ |
{1:~ }|*18
## grid 3
{2:-- }{5:match 1 of 3} |
## grid 4
{s:foo fooKind f…}|
{n:bar barKind b…}|
{n:baz bazKind b…}|
]],
float_pos = { [4] = { -1, 'NW', 2, 1, 0, false, 100, 1, 1, 0 } },
})
else
screen:expect([[
foo^ |
{s:foo fooKind f…}{1: }|
{n:bar barKind b…}{1: }|
{n:baz bazKind b…}{1: }|
{1:~ }|*15
{2:-- }{5:match 1 of 3} |
]])
end
feed('<Esc>')
command('let g:change=2')
feed('S<C-X><C-O>')
if multigrid then
screen:expect({
grid = [[
## grid 1
[2:--------------------------------]|*19
[3:--------------------------------]|
## grid 2
foo^ |
{1:~ }|*18
## grid 3
{2:-- }{5:match 1 of 3} |
## grid 4
{s:foo fo…}|
{n:bar 一…}|
{n:一二三四五 mu…}|
]],
float_pos = { [4] = { -1, 'NW', 2, 1, 0, false, 100, 1, 1, 0 } },
})
else
screen:expect([[
foo^ |
{s:foo fo…}{1: }|
{n:bar 一…}{1: }|
{n:一二三四五 mu…}{1: }|
{1:~ }|*15
{2:-- }{5:match 1 of 3} |
]])
end
feed('<Esc>')
command('set fcs&')
feed('S<C-X><C-O>')
if multigrid then
screen:expect({
grid = [[
## grid 1
[2:--------------------------------]|*19
[3:--------------------------------]|
## grid 2
foo^ |
{1:~ }|*18
## grid 3
{2:-- }{5:match 1 of 3} |
## grid 4
{s:foo fo>}|
{n:bar 一>}|
{n:一二三四五 mu>}|
]],
float_pos = { [4] = { -1, 'NW', 2, 1, 0, false, 100, 1, 1, 0 } },
})
else
screen:expect([[
foo^ |
{s:foo fo>}{1: }|
{n:bar 一>}{1: }|
{n:一二三四五 mu>}{1: }|
{1:~ }|*15
{2:-- }{5:match 1 of 3} |
]])
end
feed('<Esc>')
command('set fcs=trunc:_')
command('let g:change=1')
feed('S<C-X><C-O>')
if multigrid then
screen:expect({
grid = [[
## grid 1
[2:--------------------------------]|*19
[3:--------------------------------]|
## grid 2
foo^ |
{1:~ }|*18
## grid 3
{2:-- }{5:match 1 of 3} |
## grid 4
{s:foo fooKind f_}|
{n:bar barKind b_}|
{n:baz bazKind b_}|
]],
float_pos = { [4] = { -1, 'NW', 2, 1, 0, false, 100, 1, 1, 0 } },
})
else
screen:expect([[
foo^ |
{s:foo fooKind f_}{1: }|
{n:bar barKind b_}{1: }|
{n:baz bazKind b_}{1: }|
{1:~ }|*15
{2:-- }{5:match 1 of 3} |
]])
end
feed('<Esc>')
command('set fcs&')
command('set rightleft') command('set rightleft')
feed('S<C-X><C-O>') feed('S<C-X><C-O>')
if multigrid then if multigrid then
@@ -6022,26 +6157,120 @@ describe('builtin popupmenu', function()
## grid 3 ## grid 3
{2:-- }{5:match 1 of 3} | {2:-- }{5:match 1 of 3} |
## grid 4 ## grid 4
{s:...dniKoof oof}| {s:<f dniKoof oof}|
{n:...dniKrab rab}| {n:<b dniKrab rab}|
{n:...dniKzab zab}| {n:<b dniKzab zab}|
]], ]],
float_pos = { [4] = { -1, 'NW', 2, 1, 18, false, 100, 1, 1, 18 } }, float_pos = { [4] = { -1, 'NW', 2, 1, 18, false, 100, 1, 1, 18 } },
}) })
else else
screen:expect([[ screen:expect([[
^ oof| ^ oof|
{1: }{s:...dniKoof oof}| {1: }{s:<f dniKoof oof}|
{1: }{n:...dniKrab rab}| {1: }{n:<b dniKrab rab}|
{1: }{n:...dniKzab zab}| {1: }{n:<b dniKzab zab}|
{1: ~}|*15 {1: ~}|*15
{2:-- }{5:match 1 of 3} | {2:-- }{5:match 1 of 3} |
]]) ]])
end end
feed('<Esc>') feed('<Esc>')
command('let g:change=2')
feed('S<C-X><C-O>')
if multigrid then
screen:expect({
grid = [[
## grid 1
[2:--------------------------------]|*19
[3:--------------------------------]|
## grid 2
^ oof|
{1: ~}|*18
## grid 3
{2:-- }{5:match 1 of 3} |
## grid 4
{s:<of oof}|
{n:<一 rab}|
{n:<um 五四三二一}|
]],
float_pos = { [4] = { -1, 'NW', 2, 1, 18, false, 100, 1, 1, 18 } },
})
else
screen:expect([[
^ oof|
{1: }{s:<of oof}|
{1: }{n:<一 rab}|
{1: }{n:<um 五四三二一}|
{1: ~}|*15
{2:-- }{5:match 1 of 3} |
]])
end
feed('<Esc>')
command('set fcs+=trunc:…')
feed('S<C-X><C-O>')
if multigrid then
screen:expect({
grid = [[
## grid 1
[2:--------------------------------]|*19
[3:--------------------------------]|
## grid 2
^ oof|
{1: ~}|*18
## grid 3
{2:-- }{5:match 1 of 3} |
## grid 4
{s:…of oof}|
{n:…一 rab}|
{n:…um 五四三二一}|
]],
float_pos = { [4] = { -1, 'NW', 2, 1, 18, false, 100, 1, 1, 18 } },
})
else
screen:expect([[
^ oof|
{1: }{s:…of oof}|
{1: }{n:…一 rab}|
{1: }{n:…um 五四三二一}|
{1: ~}|*15
{2:-- }{5:match 1 of 3} |
]])
end
feed('<Esc>')
command('set fcs&')
command('let g:change=3')
feed('S<C-X><C-O>')
if multigrid then
screen:expect({
grid = [[
## grid 1
[2:--------------------------------]|*19
[3:--------------------------------]|
## grid 2
^ rab|
{1: ~}|*18
## grid 3
{2:-- The only match} |
## grid 4
{s:<of 三二一 rab}|
]],
float_pos = { [4] = { -1, 'NW', 2, 1, 18, false, 100, 1, 1, 18 } },
})
else
screen:expect([[
^ rab|
{1: }{s:<of 三二一 rab}|
{1: ~}|*17
{2:-- The only match} |
]])
end
feed('<Esc>')
command('set norightleft') command('set norightleft')
command('set pummaxwidth=13') command('set pummaxwidth=4')
command('let g:change=2')
feed('S<C-X><C-O>') feed('S<C-X><C-O>')
if multigrid then if multigrid then
screen:expect({ screen:expect({
@@ -6055,18 +6284,18 @@ describe('builtin popupmenu', function()
## grid 3 ## grid 3
{2:-- }{5:match 1 of 3} | {2:-- }{5:match 1 of 3} |
## grid 4 ## grid 4
{s:foo fooKin...}| {s:foo>}|
{n:bar barKin...}| {n:bar>}|
{n:baz bazKin...}| {n:一 >}|
]], ]],
float_pos = { [4] = { -1, 'NW', 2, 1, 0, false, 100, 1, 1, 0 } }, float_pos = { [4] = { -1, 'NW', 2, 1, 0, false, 100, 1, 1, 0 } },
}) })
else else
screen:expect([[ screen:expect([[
foo^ | foo^ |
{s:foo fooKin...}{1: }| {s:foo>}{1: }|
{n:bar barKin...}{1: }| {n:bar>}{1: }|
{n:baz bazKin...}{1: }| {n:一 >}{1: }|
{1:~ }|*15 {1:~ }|*15
{2:-- }{5:match 1 of 3} | {2:-- }{5:match 1 of 3} |
]]) ]])
@@ -6087,18 +6316,18 @@ describe('builtin popupmenu', function()
## grid 3 ## grid 3
{2:-- }{5:match 1 of 3} | {2:-- }{5:match 1 of 3} |
## grid 4 ## grid 4
{s:...niKoof oof}| {s:<oof}|
{n:...niKrab rab}| {n:<rab}|
{n:...niKzab zab}| {n:< 一}|
]], ]],
float_pos = { [4] = { -1, 'NW', 2, 1, 19, false, 100, 1, 1, 19 } }, float_pos = { [4] = { -1, 'NW', 2, 1, 28, false, 100, 1, 1, 28 } },
}) })
else else
screen:expect([[ screen:expect([[
^ oof| ^ oof|
{1: }{s:...niKoof oof}| {1: }{s:<oof}|
{1: }{n:...niKrab rab}| {1: }{n:<rab}|
{1: }{n:...niKzab zab}| {1: }{n:< 一}|
{1: ~}|*15 {1: ~}|*15
{2:-- }{5:match 1 of 3} | {2:-- }{5:match 1 of 3} |
]]) ]])

View File

@@ -235,8 +235,9 @@ let test_values = {
\ 'fileformats': [['', 'dos', 'dos,unix'], ['xxx']], \ 'fileformats': [['', 'dos', 'dos,unix'], ['xxx']],
\ 'fillchars': [['', 'stl:x', 'stlnc:x', 'vert:x', 'fold:x', 'foldopen:x', \ 'fillchars': [['', 'stl:x', 'stlnc:x', 'vert:x', 'fold:x', 'foldopen:x',
\ 'foldclose:x', 'foldsep:x', 'diff:x', 'eob:x', 'lastline:x', \ 'foldclose:x', 'foldsep:x', 'diff:x', 'eob:x', 'lastline:x',
\ 'stl:\ ,vert:\|,fold:\\,diff:x'], \ 'trunc:_', 'trunc:_,eob:x,trunc:_',
\ ['xxx', 'vert:']], \ 'stl:\ ,vert:\|,fold:\\,trunc:…,diff:x'],
\ ['xxx', 'vert:', 'trunc:', "trunc:\b"]],
\ 'foldclose': [['', 'all'], ['xxx']], \ 'foldclose': [['', 'all'], ['xxx']],
\ 'foldmethod': [['manual', 'indent', 'expr', 'marker', 'syntax', 'diff'], \ 'foldmethod': [['manual', 'indent', 'expr', 'marker', 'syntax', 'diff'],
\ ['', 'xxx', 'expr,diff']], \ ['', 'xxx', 'expr,diff']],

View File

@@ -2024,8 +2024,9 @@ func Test_pum_maxwidth()
call term_sendkeys(buf, "\<Esc>3Gdd\"zp") call term_sendkeys(buf, "\<Esc>3Gdd\"zp")
call term_sendkeys(buf, ":set lines=10 columns=32\<CR>") call term_sendkeys(buf, ":set lines=10 columns=32\<CR>")
call TermWait(buf, 50)
call term_sendkeys(buf, "GA\<C-N>") call term_sendkeys(buf, "GA\<C-N>")
call VerifyScreenDump(buf, 'Test_pum_maxwidth_09', {'rows': 10, 'cols': 32}) call VerifyScreenDump(buf, 'Test_pum_maxwidth_05', {'rows': 10, 'cols': 32})
call term_sendkeys(buf, "\<Esc>3Gdd\"zp") call term_sendkeys(buf, "\<Esc>3Gdd\"zp")
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
@@ -2035,106 +2036,129 @@ func Test_pum_maxwidth_multibyte()
CheckScreendump CheckScreendump
let lines =<< trim END let lines =<< trim END
let g:change = 0
func Omni_test(findstart, base) func Omni_test(findstart, base)
if a:findstart if a:findstart
return col(".") return col(".")
endif endif
if g:change == 0
return [ return [
\ #{word: "123456789_123456789_123456789_"}, \ #{word: "123456789_123456789_123456789_"},
\ #{word: "一二三四五六七八九十"}, \ #{word: "一二三四五六七八九十"},
\ #{word: "abcdefghij"}, \ #{word: "abcdefghij"},
\ #{word: "上下左右"}, \ #{word: "上下左右"},
\ ] \ ]
endfunc elseif g:change == 1
set omnifunc=Omni_test
END
call writefile(lines, 'Xtest', 'D')
let buf = RunVimInTerminal('-S Xtest', {})
call TermWait(buf)
call term_sendkeys(buf, "S\<C-X>\<C-O>")
call VerifyScreenDump(buf, 'Test_pum_maxwidth_05', {'rows': 8})
call term_sendkeys(buf, "\<ESC>")
call term_sendkeys(buf, ":set pummaxwidth=10\<CR>")
call term_sendkeys(buf, "S\<C-X>\<C-O>")
call VerifyScreenDump(buf, 'Test_pum_maxwidth_06', {'rows': 8})
call term_sendkeys(buf, "\<ESC>")
if has('rightleft')
call term_sendkeys(buf, ":set rightleft\<CR>")
call term_sendkeys(buf, "S\<C-X>\<C-O>")
call VerifyScreenDump(buf, 'Test_pum_maxwidth_07', {'rows': 8})
call term_sendkeys(buf, "\<Esc>:set norightleft\<CR>")
endif
call term_sendkeys(buf, ":set pummaxwidth=2\<CR>")
call term_sendkeys(buf, "S\<C-X>\<C-O>")
call VerifyScreenDump(buf, 'Test_pum_maxwidth_08', {'rows': 8})
call term_sendkeys(buf, "\<ESC>")
call StopVimInTerminal(buf)
endfunc
func Test_pum_maxwidth_with_many_items()
CheckScreendump
let lines =<< trim END
func Omni_test(findstart, base)
if a:findstart
return col(".")
endif
return [ return [
\ #{word: "foo", menu: "fooMenu", kind: "fooKind"}, \ #{word: "foo", menu: "fooMenu", kind: "fooKind"},
\ #{word: "bar", menu: "barMenu", kind: "barKind"}, \ #{word: "bar", menu: "barMenu", kind: "barKind"},
\ #{word: "baz", menu: "bazMenu", kind: "bazKind"}, \ #{word: "baz", menu: "bazMenu", kind: "bazKind"},
\ ] \ ]
elseif g:change == 2
return [
\ #{word: "foo", menu: "fooMenu", kind: "fooKind"},
\ #{word: "bar", menu: "fooMenu", kind: "一二三四"},
\ #{word: "一二三四五", kind: "multi"},
\ ]
else
return [#{word: "bar", menu: "fooMenu", kind: "一二三"}]
endif
endfunc endfunc
set omnifunc=Omni_test set omnifunc=Omni_test
set cot+=menuone
END END
call writefile(lines, 'Xtest', 'D') call writefile(lines, 'Xtest', 'D')
let buf = RunVimInTerminal('-S Xtest', {}) let buf = RunVimInTerminal('-S Xtest', {})
call TermWait(buf) call TermWait(buf)
call term_sendkeys(buf, ":set pummaxwidth=20\<CR>")
call term_sendkeys(buf, "S\<C-X>\<C-O>") call term_sendkeys(buf, "S\<C-X>\<C-O>")
call VerifyScreenDump(buf, 'Test_pum_maxwidth_with_many_items_01', {'rows': 8}) call VerifyScreenDump(buf, 'Test_pum_maxwidth_06', {'rows': 8})
call term_sendkeys(buf, "\<ESC>") call term_sendkeys(buf, "\<ESC>")
call term_sendkeys(buf, ":set pummaxwidth=19\<CR>") call term_sendkeys(buf, ":set pummaxwidth=10\<CR>")
call term_sendkeys(buf, "S\<C-X>\<C-O>") call term_sendkeys(buf, "S\<C-X>\<C-O>")
call VerifyScreenDump(buf, 'Test_pum_maxwidth_with_many_items_02', {'rows': 8}) call VerifyScreenDump(buf, 'Test_pum_maxwidth_07', {'rows': 8})
call term_sendkeys(buf, "\<ESC>") call term_sendkeys(buf, "\<ESC>")
call term_sendkeys(buf, ":set pummaxwidth=18\<CR>") " display Ellipsis if has('rightleft')
call term_sendkeys(buf, ":set rightleft\<CR>")
call term_sendkeys(buf, "S\<C-X>\<C-O>") call term_sendkeys(buf, "S\<C-X>\<C-O>")
call VerifyScreenDump(buf, 'Test_pum_maxwidth_with_many_items_03', {'rows': 8}) call VerifyScreenDump(buf, 'Test_pum_maxwidth_08', {'rows': 8})
call term_sendkeys(buf, "\<Esc>:set norightleft\<CR>")
endif
call term_sendkeys(buf, ":set pummaxwidth=2\<CR>")
call term_sendkeys(buf, "S\<C-X>\<C-O>")
call VerifyScreenDump(buf, 'Test_pum_maxwidth_09', {'rows': 8})
call term_sendkeys(buf, "\<ESC>") call term_sendkeys(buf, "\<ESC>")
call term_sendkeys(buf, ":set pummaxwidth=16\<CR>") " display Ellipsis call term_sendkeys(buf, ":set pummaxwidth=14\<CR>")
call term_sendkeys(buf, "S\<C-X>\<C-O>") call term_sendkeys(buf, ":let g:change=1\<CR>S\<C-X>\<C-O>")
call VerifyScreenDump(buf, 'Test_pum_maxwidth_with_many_items_04', {'rows': 8}) call VerifyScreenDump(buf, 'Test_pum_maxwidth_10', {'rows': 8})
call term_sendkeys(buf, "\<ESC>") call term_sendkeys(buf, "\<ESC>")
call term_sendkeys(buf, ":set pummaxwidth=15\<CR>") " Unicode Character U+2026 but one cell
call term_sendkeys(buf, ":set fcs+=trunc:…\<CR>")
call term_sendkeys(buf, "S\<C-X>\<C-O>") call term_sendkeys(buf, "S\<C-X>\<C-O>")
call VerifyScreenDump(buf, 'Test_pum_maxwidth_with_many_items_05', {'rows': 8}) call VerifyScreenDump(buf, 'Test_pum_maxwidth_11', {'rows': 8})
call term_sendkeys(buf, "\<ESC>") call term_sendkeys(buf, "\<ESC>")
call term_sendkeys(buf, ":set pummaxwidth=12\<CR>") call term_sendkeys(buf, ":let g:change=2\<CR>S\<C-X>\<C-O>")
call term_sendkeys(buf, "S\<C-X>\<C-O>") call VerifyScreenDump(buf, 'Test_pum_maxwidth_12', {'rows': 8})
call VerifyScreenDump(buf, 'Test_pum_maxwidth_with_many_items_06', {'rows': 8})
call term_sendkeys(buf, "\<ESC>") call term_sendkeys(buf, "\<ESC>")
call term_sendkeys(buf, ":set pummaxwidth=10\<CR>") " display Ellipsis call term_sendkeys(buf, ":set fcs&\<CR>")
call term_sendkeys(buf, "S\<C-X>\<C-O>") call term_sendkeys(buf, "S\<C-X>\<C-O>")
call VerifyScreenDump(buf, 'Test_pum_maxwidth_with_many_items_07', {'rows': 8}) call VerifyScreenDump(buf, 'Test_pum_maxwidth_13', {'rows': 8})
call term_sendkeys(buf, "\<ESC>") call term_sendkeys(buf, "\<ESC>")
call term_sendkeys(buf, ":set pummaxwidth=1\<CR>") call term_sendkeys(buf, ":set fcs=trunc:_\<CR>")
call term_sendkeys(buf, ":let g:change=1\<CR>")
call TermWait(buf, 50)
call term_sendkeys(buf, "S\<C-X>\<C-O>") call term_sendkeys(buf, "S\<C-X>\<C-O>")
call VerifyScreenDump(buf, 'Test_pum_maxwidth_with_many_items_08', {'rows': 8}) call VerifyScreenDump(buf, 'Test_pum_maxwidth_14', {'rows': 8})
call term_sendkeys(buf, "\<ESC>") call term_sendkeys(buf, "\<ESC>")
call term_sendkeys(buf, ":set fcs&\<CR>")
if has('rightleft')
call term_sendkeys(buf, ":set rightleft\<CR>")
call term_sendkeys(buf, "S\<C-X>\<C-O>")
call VerifyScreenDump(buf, 'Test_pum_maxwidth_15', {'rows': 8})
call term_sendkeys(buf, "\<ESC>")
call term_sendkeys(buf, ":let g:change=2\<CR>")
call TermWait(buf, 50)
call term_sendkeys(buf, "S\<C-X>\<C-O>")
call VerifyScreenDump(buf, 'Test_pum_maxwidth_16', {'rows': 8})
call term_sendkeys(buf, "\<ESC>")
call term_sendkeys(buf, ":set fcs+=trunc:…\<CR>")
call term_sendkeys(buf, "S\<C-X>\<C-O>")
call VerifyScreenDump(buf, 'Test_pum_maxwidth_17', {'rows': 8})
call term_sendkeys(buf, "\<ESC>")
call term_sendkeys(buf, ":set fcs&\<CR>")
call term_sendkeys(buf, ":let g:change=3\<CR>")
call TermWait(buf, 50)
call term_sendkeys(buf, "S\<C-X>\<C-O>")
call VerifyScreenDump(buf, 'Test_pum_maxwidth_18', {'rows': 8})
call term_sendkeys(buf, "\<Esc>:set norightleft\<CR>")
endif
call term_sendkeys(buf, ":set pummaxwidth=4\<CR>")
call term_sendkeys(buf, ":let g:change=2\<CR>")
call TermWait(buf, 50)
call term_sendkeys(buf, "S\<C-X>\<C-O>")
call VerifyScreenDump(buf, 'Test_pum_maxwidth_19', {'rows': 8})
call term_sendkeys(buf, "\<ESC>")
if has('rightleft')
call term_sendkeys(buf, ":set rightleft\<CR>")
call TermWait(buf, 50)
call term_sendkeys(buf, "S\<C-X>\<C-O>")
call VerifyScreenDump(buf, 'Test_pum_maxwidth_20', {'rows': 8})
call term_sendkeys(buf, "\<Esc>:set norightleft\<CR>")
endif
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
endfunc endfunc