From 0813bb021aa64a1479990be9e17196b32d9d50f2 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Thu, 24 Dec 2020 22:00:23 -0500 Subject: vim-patch:8.2.0051: command line completion test skipped Problem: Command line completion test skipped. (Christian Brabandt) Solution: Invert condition. https://github.com/vim/vim/commit/731a799bb926c6f424dbfb63430cf631ca7e132a Cherry-pick Test_cmdline_complete_bang() from patch v8.2.0049. --- src/nvim/testdir/test_cmdline.vim | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/nvim/testdir/test_cmdline.vim b/src/nvim/testdir/test_cmdline.vim index 81f653c393..6d3c6589d3 100644 --- a/src/nvim/testdir/test_cmdline.vim +++ b/src/nvim/testdir/test_cmdline.vim @@ -548,6 +548,13 @@ func Test_cmdline_complete_user_names() endif endfunc +func Test_cmdline_complete_bang() + if executable('whoami') + call feedkeys(":!whoam\\\"\", 'tx') + call assert_match('^".*\', @:) + endif +endfunc + funct Test_cmdline_complete_languages() let lang = substitute(execute('language messages'), '.*"\(.*\)"$', '\1', '') -- cgit From 8cf4a02bf23af9eaafba3f0dbc1c613aa1b91575 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Thu, 24 Dec 2020 23:00:58 -0500 Subject: vim-patch:8.1.2212: cannot see the selection type in :reg output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: Cannot see the selection type in :reg output. (Ayberk Aydın) Solution: Add c/l/b. (Christian Brabandt, closes vim/vim#5110, closes vim/vim#4546) https://github.com/vim/vim/commit/3691f1ee72b68a47e6dcc75927bfa46565cf3614 Patch v8.1.0999 is not ported so ":registers" does not omit register 1. --- src/nvim/ops.c | 44 +++++++++++++++++++++++-------------- src/nvim/testdir/test_registers.vim | 30 ++++++++++++------------- 2 files changed, 42 insertions(+), 32 deletions(-) (limited to 'src') diff --git a/src/nvim/ops.c b/src/nvim/ops.c index 8fddb1b561..052b07ed44 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -3554,15 +3554,21 @@ void ex_display(exarg_T *eap) int name; char_u *arg = eap->arg; int clen; + char_u type[2]; if (arg != NULL && *arg == NUL) arg = NULL; int attr = HL_ATTR(HLF_8); - /* Highlight title */ - MSG_PUTS_TITLE(_("\n--- Registers ---")); + // Highlight title + msg_puts_title(_("\nType Name Content")); for (int i = -1; i < NUM_REGISTERS && !got_int; i++) { name = get_register_name(i); + switch (get_reg_type(name, NULL)) { + case kMTLineWise: type[0] = 'l'; break; + case kMTCharWise: type[0] = 'c'; break; + default: type[0] = 'b'; break; + } if (arg != NULL && vim_strchr(arg, name) == NULL) { continue; /* did not ask for this register */ @@ -3587,11 +3593,14 @@ void ex_display(exarg_T *eap) if (yb->y_array != NULL) { msg_putchar('\n'); + msg_puts(" "); + msg_putchar(type[0]); + msg_puts(" "); msg_putchar('"'); msg_putchar(name); MSG_PUTS(" "); - int n = Columns - 6; + int n = Columns - 11; for (size_t j = 0; j < yb->y_size && n > 1; j++) { if (j) { MSG_PUTS_ATTR("^J", attr); @@ -3616,8 +3625,8 @@ void ex_display(exarg_T *eap) */ if ((p = get_last_insert()) != NULL && (arg == NULL || vim_strchr(arg, '.') != NULL) && !got_int) { - MSG_PUTS("\n\". "); - dis_msg(p, TRUE); + msg_puts("\n c \". "); + dis_msg(p, true); } /* @@ -3625,8 +3634,8 @@ void ex_display(exarg_T *eap) */ if (last_cmdline != NULL && (arg == NULL || vim_strchr(arg, ':') != NULL) && !got_int) { - MSG_PUTS("\n\": "); - dis_msg(last_cmdline, FALSE); + msg_puts("\n c \": "); + dis_msg(last_cmdline, false); } /* @@ -3634,8 +3643,8 @@ void ex_display(exarg_T *eap) */ if (curbuf->b_fname != NULL && (arg == NULL || vim_strchr(arg, '%') != NULL) && !got_int) { - MSG_PUTS("\n\"% "); - dis_msg(curbuf->b_fname, FALSE); + msg_puts("\n c \"% "); + dis_msg(curbuf->b_fname, false); } /* @@ -3646,8 +3655,8 @@ void ex_display(exarg_T *eap) linenr_T dummy; if (buflist_name_nr(0, &fname, &dummy) != FAIL) { - MSG_PUTS("\n\"# "); - dis_msg(fname, FALSE); + msg_puts("\n c \"# "); + dis_msg(fname, false); } } @@ -3656,8 +3665,8 @@ void ex_display(exarg_T *eap) */ if (last_search_pat() != NULL && (arg == NULL || vim_strchr(arg, '/') != NULL) && !got_int) { - MSG_PUTS("\n\"/ "); - dis_msg(last_search_pat(), FALSE); + msg_puts("\n c \"/ "); + dis_msg(last_search_pat(), false); } /* @@ -3665,8 +3674,8 @@ void ex_display(exarg_T *eap) */ if (expr_line != NULL && (arg == NULL || vim_strchr(arg, '=') != NULL) && !got_int) { - MSG_PUTS("\n\"= "); - dis_msg(expr_line, FALSE); + msg_puts("\n c \"= "); + dis_msg(expr_line, false); } } @@ -3676,9 +3685,10 @@ void ex_display(exarg_T *eap) */ static void dis_msg( - char_u *p, - int skip_esc /* if TRUE, ignore trailing ESC */ + const char_u *p, + bool skip_esc // if true, ignore trailing ESC ) + FUNC_ATTR_NONNULL_ALL { int n; int l; diff --git a/src/nvim/testdir/test_registers.vim b/src/nvim/testdir/test_registers.vim index 2f72b6a4c0..8a90f9b251 100644 --- a/src/nvim/testdir/test_registers.vim +++ b/src/nvim/testdir/test_registers.vim @@ -52,27 +52,27 @@ func Test_display_registers() let b = execute('registers') call assert_equal(a, b) - call assert_match('^\n--- Registers ---\n' - \ . '"" a\n' - \ . '"0 ba\n' - \ . '"1 b\n' - \ . '"a b\n' + call assert_match('^\nType Name Content\n' + \ . ' c "" a\n' + \ . ' c "0 ba\n' + \ . ' c "1 b\n' + \ . ' c "a b\n' \ . '.*' - \ . '"- a\n' + \ . ' c "- a\n' \ . '.*' - \ . '": ls\n' - \ . '"% file2\n' - \ . '"# file1\n' - \ . '"/ bar\n' - \ . '"= 2\*4', a) + \ . ' c ": ls\n' + \ . ' c "% file2\n' + \ . ' c "# file1\n' + \ . ' c "/ bar\n' + \ . ' c "= 2\*4', a) let a = execute('registers a') - call assert_match('^\n--- Registers ---\n' - \ . '"a b', a) + call assert_match('^\nType Name Content\n' + \ . ' c "a b', a) let a = execute('registers :') - call assert_match('^\n--- Registers ---\n' - \ . '": ls', a) + call assert_match('^\nType Name Content\n' + \ . ' c ": ls', a) bwipe! endfunc -- cgit From 1e823986e98721d7fda9a7d28fb9c085fdbc73a6 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Fri, 25 Dec 2020 03:04:15 -0500 Subject: vim-patch:8.2.1174: no test for the "recording @x" message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: No test for the "recording @x" message. Solution: Add a test. (Dominique Pellé, closes vim/vim#6427) https://github.com/vim/vim/commit/11a5b19a8ce543c258832ac53d771047f4e1061d --- src/nvim/testdir/test_registers.vim | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src') diff --git a/src/nvim/testdir/test_registers.vim b/src/nvim/testdir/test_registers.vim index 8a90f9b251..8d2a768ba0 100644 --- a/src/nvim/testdir/test_registers.vim +++ b/src/nvim/testdir/test_registers.vim @@ -2,6 +2,9 @@ " Tests for register operations " +source check.vim +source view_util.vim + " This test must be executed first to check for empty and unset registers. func Test_aaa_empty_reg_test() call assert_fails('normal @@', 'E748:') @@ -77,6 +80,19 @@ func Test_display_registers() bwipe! endfunc +func Test_recording_status_in_ex_line() + norm qx + redraw! + call assert_equal('recording @x', Screenline(&lines)) + set shortmess=q + redraw! + call assert_equal('recording', Screenline(&lines)) + set shortmess& + norm q + redraw! + call assert_equal('', Screenline(&lines)) +endfunc + " Check that replaying a typed sequence does not use an Esc and following " characters as an escape sequence. func Test_recording_esc_sequence() -- cgit From 43834b24ac6037ec7678872877d3370134e46024 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Thu, 24 Dec 2020 17:18:25 -0500 Subject: vim-patch:8.2.2206: :exe command line completion only works for first argument Problem: :exe command line completion only works for first argument. Solution: Skip over text if more is following. (closes vim/vim#7546) https://github.com/vim/vim/commit/4941b5effd7f6a26583a949c92ee50276a3b43f9 Port "IS_WHITE_OR_NUL" macro from patch v8.2.0562 as "ascii_iswhite_or_nul()" inline function. N/A patches for version.c: vim-patch:8.2.0782: cannot build with Lua on MS-Windows Problem: Cannot build with Lua on MS-Windows. Solution: Add DLL symbol for luaL_Loadstring. (Ken Takata) https://github.com/vim/vim/commit/df1643a6a7886b9363c2a98438e61cbe1c803d41 vim-patch:8.2.0856: CTRL-S stops output Problem: CTRL-S stops output. Solution: Invert the IXON flag. (closes vim/vim#6166) https://github.com/vim/vim/commit/928eec649b8af389de0fdb7aba2034d27df3e058 vim-patch:8.2.1212: cannot build with Lua 5.4 Problem: Cannot build with Lua 5.4. Solution: Use luaL_typeerror instead defining it. (closes vim/vim#6454) https://github.com/vim/vim/commit/5551b131daef3a621a28dcbbe118920f5b9fabe6 vim-patch:8.2.2211: MS-Windows: can't load Python dll if not in the path Problem: MS-Windows: can't load Python dll if not in the path. Solution: Use the InstallPath registry entry. (Kelvin Lee, closes vim/vim#7540) https://github.com/vim/vim/commit/b2f9e0e2c537bcde16dab3b62687a17e17849ce1 --- src/nvim/ascii.h | 12 ++++++++++++ src/nvim/eval.c | 18 ++++++++++++++++++ src/nvim/testdir/test_cmdline.vim | 11 +++++++++++ 3 files changed, 41 insertions(+) (limited to 'src') diff --git a/src/nvim/ascii.h b/src/nvim/ascii.h index 2397af27cc..f41068ea70 100644 --- a/src/nvim/ascii.h +++ b/src/nvim/ascii.h @@ -89,6 +89,10 @@ static inline bool ascii_iswhite(int) REAL_FATTR_CONST REAL_FATTR_ALWAYS_INLINE; +static inline bool ascii_iswhite_or_nul(int) + REAL_FATTR_CONST + REAL_FATTR_ALWAYS_INLINE; + static inline bool ascii_isdigit(int) REAL_FATTR_CONST REAL_FATTR_ALWAYS_INLINE; @@ -117,6 +121,14 @@ static inline bool ascii_iswhite(int c) return c == ' ' || c == '\t'; } +/// Checks if `c` is a space or tab character or NUL. +/// +/// @see {ascii_isdigit} +static inline bool ascii_iswhite_or_nul(int c) +{ + return ascii_iswhite(c) || c == NUL; +} + /// Check whether character is a decimal digit. /// /// Library isdigit() function is officially locale-dependent and, for diff --git a/src/nvim/eval.c b/src/nvim/eval.c index cc707c0c84..10a382ec4e 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -2556,6 +2556,7 @@ void free_for_info(void *fi_void) void set_context_for_expression(expand_T *xp, char_u *arg, cmdidx_T cmdidx) + FUNC_ATTR_NONNULL_ALL { int got_eq = FALSE; int c; @@ -2638,6 +2639,23 @@ void set_context_for_expression(expand_T *xp, char_u *arg, cmdidx_T cmdidx) } } } + + // ":exe one two" completes "two" + if ((cmdidx == CMD_execute + || cmdidx == CMD_echo + || cmdidx == CMD_echon + || cmdidx == CMD_echomsg) + && xp->xp_context == EXPAND_EXPRESSION) { + for (;;) { + char_u *const n = skiptowhite(arg); + + if (n == arg || ascii_iswhite_or_nul(*skipwhite(n))) { + break; + } + arg = skipwhite(n); + } + } + xp->xp_pattern = arg; } diff --git a/src/nvim/testdir/test_cmdline.vim b/src/nvim/testdir/test_cmdline.vim index 6d3c6589d3..8fc3361b79 100644 --- a/src/nvim/testdir/test_cmdline.vim +++ b/src/nvim/testdir/test_cmdline.vim @@ -577,6 +577,17 @@ funct Test_cmdline_complete_languages() endif endfunc +func Test_cmdline_complete_expression() + let g:SomeVar = 'blah' + for cmd in ['exe', 'echo', 'echon', 'echomsg'] + call feedkeys(":" .. cmd .. " SomeV\\\"\", 'tx') + call assert_match('"' .. cmd .. ' SomeVar', @:) + call feedkeys(":" .. cmd .. " foo SomeV\\\"\", 'tx') + call assert_match('"' .. cmd .. ' foo SomeVar', @:) + endfor + unlet g:SomeVar +endfunc + func Test_cmdline_write_alternatefile() new call setline('.', ['one', 'two']) -- cgit