aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/doc/cmdline.txt7
-rw-r--r--runtime/doc/starting.txt7
-rwxr-xr-xsrc/clint.py3
-rw-r--r--src/nvim/eval.c29
-rw-r--r--src/nvim/ex_cmds.lua2
-rw-r--r--src/nvim/ex_docmd.c69
-rw-r--r--src/nvim/ex_getln.c11
-rw-r--r--src/nvim/globals.h7
-rw-r--r--src/nvim/main.c15
-rw-r--r--src/nvim/message.c8
-rw-r--r--src/nvim/misc1.c2
-rw-r--r--src/nvim/os/win_defs.h9
-rw-r--r--src/nvim/screen.c36
-rw-r--r--src/nvim/state.c1
-rw-r--r--src/nvim/terminal.c6
-rw-r--r--src/nvim/testdir/Makefile1
-rw-r--r--src/nvim/testdir/test49.vim3
-rw-r--r--src/nvim/testdir/test_hide.vim97
-rw-r--r--src/nvim/testdir/test_history.vim24
-rw-r--r--src/nvim/testdir/test_nested_function.vim21
-rw-r--r--src/nvim/testdir/test_search.vim15
-rw-r--r--src/nvim/version.c235
-rw-r--r--test/functional/helpers.lua2
-rw-r--r--test/functional/ui/wildmode_spec.lua168
24 files changed, 638 insertions, 140 deletions
diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt
index d870a72600..652487d8ab 100644
--- a/runtime/doc/cmdline.txt
+++ b/runtime/doc/cmdline.txt
@@ -327,8 +327,11 @@ terminals)
List entries 6 to 12 from the search history: >
:history / 6,12
<
- List the recent five entries from all histories: >
- :history all -5,
+ List the penultimate entry from all histories: >
+ :history all -2
+<
+ List the most recent two entries from all histories: >
+ :history all -2,
:keepp[atterns] {command} *:keepp* *:keeppatterns*
Execute {command}, without adding anything to the search
diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt
index 91915406cb..4cfc98d5b6 100644
--- a/runtime/doc/starting.txt
+++ b/runtime/doc/starting.txt
@@ -53,7 +53,7 @@ filename One or more file names. The first one will be the current
< Starting in Ex mode: >
nvim -e -
nvim -E
-< Start editing in silent mode. See |-s-ex|.
+< Start editing in |silent-mode|.
*-t* *-tag*
-t {tag} A tag. "tag" is looked up in the tags file, the associated
@@ -200,7 +200,7 @@ argument.
*-E*
-E Start Vim in improved Ex mode |gQ|.
- *-s-ex*
+ *-s-ex* *silent-mode*
-s Silent or batch mode. Only when "-s" is preceded by the "-e"
argument. Otherwise see |-s|, which does take an argument
while this use of "-s" doesn't. To be used when Vim is used
@@ -221,7 +221,7 @@ argument.
Initializations are skipped (except the ones given with the
"-u" argument).
Example: >
- vim -e -s < thefilter thefile
+ vim -es < thefilter thefile
<
*-b*
-b Binary mode. File I/O will only recognize <NL> to separate
@@ -351,6 +351,7 @@ argument.
*--headless*
--headless Do not start the built-in UI.
+ See also |silent-mode|, which does start a (limited) UI.
==============================================================================
2. Initialization *initialization* *startup*
diff --git a/src/clint.py b/src/clint.py
index 69a061d2ab..4a41650ec4 100755
--- a/src/clint.py
+++ b/src/clint.py
@@ -2613,7 +2613,8 @@ def CheckBraces(filename, clean_lines, linenum, error):
func_start_linenum += 1
else:
- if clean_lines.lines[func_start_linenum].endswith('{'):
+ func_start = clean_lines.lines[func_start_linenum]
+ if not func_start.startswith('enum ') and func_start.endswith('{'):
error(filename, func_start_linenum,
'readability/braces', 5,
'Brace starting function body must be placed '
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 78c8dd02db..c42929ef7c 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -9079,7 +9079,8 @@ static dict_T *get_buffer_info(buf_T *buf)
tv_dict_add_nr(dict, S_LEN("bufnr"), buf->b_fnum);
tv_dict_add_str(dict, S_LEN("name"),
buf->b_ffname != NULL ? (const char *)buf->b_ffname : "");
- tv_dict_add_nr(dict, S_LEN("lnum"), buflist_findlnum(buf));
+ tv_dict_add_nr(dict, S_LEN("lnum"),
+ buf == curbuf ? curwin->w_cursor.lnum : buflist_findlnum(buf));
tv_dict_add_nr(dict, S_LEN("loaded"), buf->b_ml.ml_mfp != NULL);
tv_dict_add_nr(dict, S_LEN("listed"), buf->b_p_bl);
tv_dict_add_nr(dict, S_LEN("changed"), bufIsChanged(buf));
@@ -14202,6 +14203,8 @@ do_searchpair (
int nest = 1;
int options = SEARCH_KEEP;
proftime_T tm;
+ size_t pat2_len;
+ size_t pat3_len;
/* Make 'cpoptions' empty, the 'l' flag should not be used here. */
save_cpo = p_cpo;
@@ -14210,18 +14213,22 @@ do_searchpair (
/* Set the time limit, if there is one. */
tm = profile_setlimit(time_limit);
- /* Make two search patterns: start/end (pat2, for in nested pairs) and
- * start/middle/end (pat3, for the top pair). */
- pat2 = xmalloc(STRLEN(spat) + STRLEN(epat) + 15);
- pat3 = xmalloc(STRLEN(spat) + STRLEN(mpat) + STRLEN(epat) + 23);
- sprintf((char *)pat2, "\\(%s\\m\\)\\|\\(%s\\m\\)", spat, epat);
- if (*mpat == NUL)
+ // Make two search patterns: start/end (pat2, for in nested pairs) and
+ // start/middle/end (pat3, for the top pair).
+ pat2_len = STRLEN(spat) + STRLEN(epat) + 17;
+ pat2 = xmalloc(pat2_len);
+ pat3_len = STRLEN(spat) + STRLEN(mpat) + STRLEN(epat) + 25;
+ pat3 = xmalloc(pat3_len);
+ snprintf((char *)pat2, pat2_len, "\\m\\(%s\\m\\)\\|\\(%s\\m\\)", spat, epat);
+ if (*mpat == NUL) {
STRCPY(pat3, pat2);
- else
- sprintf((char *)pat3, "\\(%s\\m\\)\\|\\(%s\\m\\)\\|\\(%s\\m\\)",
- spat, epat, mpat);
- if (flags & SP_START)
+ } else {
+ snprintf((char *)pat3, pat3_len,
+ "\\m\\(%s\\m\\)\\|\\(%s\\m\\)\\|\\(%s\\m\\)", spat, epat, mpat);
+ }
+ if (flags & SP_START) {
options |= SEARCH_START;
+ }
save_cursor = curwin->w_cursor;
pos = curwin->w_cursor;
diff --git a/src/nvim/ex_cmds.lua b/src/nvim/ex_cmds.lua
index 5757964f0f..5a578cd088 100644
--- a/src/nvim/ex_cmds.lua
+++ b/src/nvim/ex_cmds.lua
@@ -1076,7 +1076,7 @@ return {
},
{
command='hide',
- flags=bit.bor(BANG, RANGE, NOTADR, COUNT, EXTRA, NOTRLCOM),
+ flags=bit.bor(BANG, RANGE, NOTADR, COUNT, EXTRA, TRLBAR),
addr_type=ADDR_WINDOWS,
func='ex_hide',
},
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index d1ce589db1..29788a9865 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -340,12 +340,13 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline,
msg_list = &private_msg_list;
private_msg_list = NULL;
- /* It's possible to create an endless loop with ":execute", catch that
- * here. The value of 200 allows nested function calls, ":source", etc. */
- if (call_depth == 200) {
+ // It's possible to create an endless loop with ":execute", catch that
+ // here. The value of 200 allows nested function calls, ":source", etc.
+ // Allow 200 or 'maxfuncdepth', whatever is larger.
+ if (call_depth >= 200 && call_depth >= p_mfd) {
EMSG(_("E169: Command too recursive"));
- /* When converting to an exception, we do not include the command name
- * since this is not an error of the specific command. */
+ // When converting to an exception, we do not include the command name
+ // since this is not an error of the specific command.
do_errthrow((struct condstack *)NULL, (char_u *)NULL);
msg_list = saved_msg_list;
return FAIL;
@@ -4674,17 +4675,17 @@ char_u *find_nextcmd(const char_u *p)
return (char_u *)p + 1;
}
-/*
- * Check if *p is a separator between Ex commands.
- * Return NULL if it isn't, (p + 1) if it is.
- */
+/// Check if *p is a separator between Ex commands, skipping over white space.
+/// Return NULL if it isn't, the following character if it is.
char_u *check_nextcmd(char_u *p)
{
- p = skipwhite(p);
- if (*p == '|' || *p == '\n')
- return p + 1;
- else
- return NULL;
+ char_u *s = skipwhite(p);
+
+ if (*s == '|' || *s == '\n') {
+ return (s + 1);
+ } else {
+ return NULL;
+ }
}
/*
@@ -6254,31 +6255,27 @@ void ex_all(exarg_T *eap)
static void ex_hide(exarg_T *eap)
{
- if (*eap->arg != NUL && check_nextcmd(eap->arg) == NULL)
- eap->errmsg = e_invarg;
- else {
- /* ":hide" or ":hide | cmd": hide current window */
- eap->nextcmd = check_nextcmd(eap->arg);
+ // ":hide" or ":hide | cmd": hide current window
if (!eap->skip) {
- if (eap->addr_count == 0)
- win_close(curwin, FALSE); /* don't free buffer */
- else {
- int winnr = 0;
- win_T *win = NULL;
-
- FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
- winnr++;
- if (winnr == eap->line2) {
- win = wp;
- break;
- }
+ if (eap->addr_count == 0) {
+ win_close(curwin, false); // don't free buffer
+ } else {
+ int winnr = 0;
+ win_T *win = NULL;
+
+ FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
+ winnr++;
+ if (winnr == eap->line2) {
+ win = wp;
+ break;
+ }
+ }
+ if (win == NULL) {
+ win = lastwin;
+ }
+ win_close(win, false);
}
- if (win == NULL)
- win = lastwin;
- win_close(win, FALSE);
- }
}
- }
}
/*
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 1d81a39dfe..ecd5c81822 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -12,6 +12,7 @@
#include <inttypes.h>
#include "nvim/assert.h"
+#include "nvim/log.h"
#include "nvim/vim.h"
#include "nvim/ascii.h"
#include "nvim/arabic.h"
@@ -472,11 +473,12 @@ static int command_line_execute(VimState *state, int key)
}
// free expanded names when finished walking through matches
- if (s->xpc.xp_numfiles != -1
- && !(s->c == p_wc && KeyTyped) && s->c != p_wcm
+ if (!(s->c == p_wc && KeyTyped) && s->c != p_wcm
&& s->c != Ctrl_N && s->c != Ctrl_P && s->c != Ctrl_A
&& s->c != Ctrl_L) {
- (void)ExpandOne(&s->xpc, NULL, NULL, 0, WILD_FREE);
+ if (s->xpc.xp_numfiles != -1) {
+ (void)ExpandOne(&s->xpc, NULL, NULL, 0, WILD_FREE);
+ }
s->did_wild_list = false;
if (!p_wmnu || (s->c != K_UP && s->c != K_DOWN)) {
s->xpc.xp_context = EXPAND_NOTHING;
@@ -1222,6 +1224,7 @@ static int command_line_handle_key(CommandLineState *s)
break; // Use ^D as normal char instead
}
+ wild_menu_showing = WM_LIST;
redrawcmd();
return 1; // don't do incremental search now
@@ -1452,7 +1455,7 @@ static int command_line_handle_key(CommandLineState *s)
if (s->hiscnt != s->i) {
// jumped to other entry
char_u *p;
- int len;
+ int len = 0;
int old_firstc;
xfree(ccline.cmdbuff);
diff --git a/src/nvim/globals.h b/src/nvim/globals.h
index f08812600f..13ecafcbe3 100644
--- a/src/nvim/globals.h
+++ b/src/nvim/globals.h
@@ -931,8 +931,11 @@ EXTERN char_u langmap_mapchar[256]; /* mapping for language keys */
EXTERN int save_p_ls INIT(= -1); /* Save 'laststatus' setting */
EXTERN int save_p_wmh INIT(= -1); /* Save 'winminheight' setting */
EXTERN int wild_menu_showing INIT(= 0);
-# define WM_SHOWN 1 /* wildmenu showing */
-# define WM_SCROLLED 2 /* wildmenu showing with scroll */
+enum {
+ WM_SHOWN = 1, ///< wildmenu showing
+ WM_SCROLLED = 2, ///< wildmenu showing with scroll
+ WM_LIST = 3, ///< cmdline CTRL-D
+};
EXTERN char breakat_flags[256]; /* which characters are in 'breakat' */
diff --git a/src/nvim/main.c b/src/nvim/main.c
index 7dcf00c26b..a46c1a58f8 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -98,10 +98,8 @@ typedef struct {
bool input_isatty; // stdin is a terminal
bool output_isatty; // stdout is a terminal
bool err_isatty; // stderr is a terminal
- bool headless; // Dont try to start an user interface
- // or read/write to stdio(unless
- // embedding)
- int no_swap_file; /* "-n" argument used */
+ bool headless; // Do not start the builtin UI.
+ int no_swap_file; // "-n" argument used
int use_debug_break_level;
int window_count; /* number of windows to use */
int window_layout; /* 0, WIN_HOR, WIN_VER or WIN_TABS */
@@ -932,10 +930,11 @@ static void command_line_scan(mparm_T *parmp)
break;
case 's':
- if (exmode_active) /* "-s" silent (batch) mode */
- silent_mode = TRUE;
- else /* "-s {scriptin}" read from script file */
- want_argument = TRUE;
+ if (exmode_active) { // "-es" silent (batch) mode
+ silent_mode = true;
+ } else { // "-s {scriptin}" read from script file
+ want_argument = true;
+ }
break;
case 't': /* "-t {tag}" or "-t{tag}" jump to tag */
diff --git a/src/nvim/message.c b/src/nvim/message.c
index 36f9ca84ed..28c88f5a14 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -2722,9 +2722,11 @@ do_dialog (
int c;
int i;
- /* Don't output anything in silent mode ("ex -s") */
- if (silent_mode)
- return dfltbutton; /* return default option */
+ if (silent_mode // No dialogs in silent mode ("ex -s")
+ || !ui_active() // Without a UI Nvim waits for input forever.
+ ) {
+ return dfltbutton; // return default option
+ }
oldState = State;
diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c
index 835b9c7b20..5270687a4d 100644
--- a/src/nvim/misc1.c
+++ b/src/nvim/misc1.c
@@ -2203,7 +2203,7 @@ change_warning (
set_vim_var_string(VV_WARNINGMSG, _(w_readonly), -1);
msg_clr_eos();
(void)msg_end();
- if (msg_silent == 0 && !silent_mode) {
+ if (msg_silent == 0 && !silent_mode && ui_active()) {
ui_flush();
os_delay(1000L, true); /* give the user time to think about it */
}
diff --git a/src/nvim/os/win_defs.h b/src/nvim/os/win_defs.h
index 7ed70f6092..8fd2e51f8b 100644
--- a/src/nvim/os/win_defs.h
+++ b/src/nvim/os/win_defs.h
@@ -30,8 +30,13 @@
#define USE_CRNL
-// We have our own RGB macro in macros.h.
-#undef RGB
+// Windows defines a RGB macro that produces 0x00bbggrr color values for use
+// with GDI. Our macro is different, and we don't use GDI.
+#if defined(RGB)
+# undef RGB
+ // Duplicated from macros.h to avoid include-order sensitivity.
+# define RGB(r, g, b) ((r << 16) | (g << 8) | b)
+#endif
#ifdef _MSC_VER
# ifndef inline
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index bcc996679b..cd4f4de40f 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -86,6 +86,7 @@
#include <stdbool.h>
#include <string.h>
+#include "nvim/log.h"
#include "nvim/vim.h"
#include "nvim/ascii.h"
#include "nvim/arabic.h"
@@ -4874,11 +4875,14 @@ void win_redr_status(win_T *wp)
int this_ru_col;
static int busy = FALSE;
- /* It's possible to get here recursively when 'statusline' (indirectly)
- * invokes ":redrawstatus". Simply ignore the call then. */
- if (busy)
+ // May get here recursively when 'statusline' (indirectly)
+ // invokes ":redrawstatus". Simply ignore the call then.
+ if (busy
+ // Also ignore if wildmenu is showing.
+ || (wild_menu_showing != 0 && !ui_is_external(kUIWildmenu))) {
return;
- busy = TRUE;
+ }
+ busy = true;
wp->w_redr_status = FALSE;
if (wp->w_status_height == 0) {
@@ -6441,13 +6445,11 @@ void setcursor(void)
}
}
-/*
- * insert 'line_count' lines at 'row' in window 'wp'
- * if 'invalid' is TRUE the wp->w_lines[].wl_lnum is invalidated.
- * if 'mayclear' is TRUE the screen will be cleared if it is faster than
- * scrolling.
- * Returns FAIL if the lines are not inserted, OK for success.
- */
+/// Insert 'line_count' lines at 'row' in window 'wp'.
+/// If 'invalid' is TRUE the wp->w_lines[].wl_lnum is invalidated.
+/// If 'mayclear' is TRUE the screen will be cleared if it is faster than
+/// scrolling.
+/// Returns FAIL if the lines are not inserted, OK for success.
int win_ins_lines(win_T *wp, int row, int line_count, int invalid, int mayclear)
{
int did_delete;
@@ -6510,13 +6512,11 @@ int win_ins_lines(win_T *wp, int row, int line_count, int invalid, int mayclear)
return OK;
}
-/*
- * delete "line_count" window lines at "row" in window "wp"
- * If "invalid" is TRUE curwin->w_lines[] is invalidated.
- * If "mayclear" is TRUE the screen will be cleared if it is faster than
- * scrolling
- * Return OK for success, FAIL if the lines are not deleted.
- */
+/// Delete "line_count" window lines at "row" in window "wp".
+/// If "invalid" is TRUE curwin->w_lines[] is invalidated.
+/// If "mayclear" is TRUE the screen will be cleared if it is faster than
+/// scrolling
+/// Return OK for success, FAIL if the lines are not deleted.
int win_del_lines(win_T *wp, int row, int line_count, int invalid, int mayclear)
{
int retval;
diff --git a/src/nvim/state.c b/src/nvim/state.c
index be6aa21664..eb0b590a9b 100644
--- a/src/nvim/state.c
+++ b/src/nvim/state.c
@@ -6,6 +6,7 @@
#include "nvim/lib/kvec.h"
#include "nvim/ascii.h"
+#include "nvim/log.h"
#include "nvim/state.h"
#include "nvim/vim.h"
#include "nvim/main.h"
diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c
index 099f49f09b..deec930ebd 100644
--- a/src/nvim/terminal.c
+++ b/src/nvim/terminal.c
@@ -43,6 +43,7 @@
#include <vterm.h>
+#include "nvim/log.h"
#include "nvim/vim.h"
#include "nvim/terminal.h"
#include "nvim/message.h"
@@ -1010,7 +1011,10 @@ static void refresh_terminal(Terminal *term)
// Calls refresh_terminal() on all invalidated_terminals.
static void refresh_timer_cb(TimeWatcher *watcher, void *data)
{
- if (exiting) { // Cannot redraw (requires event loop) during teardown/exit.
+ if (exiting // Cannot redraw (requires event loop) during teardown/exit.
+ // WM_LIST (^D) is not redrawn, unlike the normal wildmenu. So we must
+ // skip redraws to keep it visible.
+ || wild_menu_showing == WM_LIST) {
goto end;
}
Terminal *term;
diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile
index b45bd6ee14..944222dbb6 100644
--- a/src/nvim/testdir/Makefile
+++ b/src/nvim/testdir/Makefile
@@ -45,6 +45,7 @@ NEW_TESTS ?= \
test_gn.res \
test_hardcopy.res \
test_help_tagjump.res \
+ test_hide.res \
test_history.res \
test_hlsearch.res \
test_increment.res \
diff --git a/src/nvim/testdir/test49.vim b/src/nvim/testdir/test49.vim
index a0e170dea4..467abcd9b9 100644
--- a/src/nvim/testdir/test49.vim
+++ b/src/nvim/testdir/test49.vim
@@ -481,12 +481,9 @@ function! ExtraVim(...)
bwipeout
let g:Xpath = g:Xpath + sum
- " FIXME(nvim): delete() of a file used by a subprocess hangs TSAN build on travis CI.
- if !empty($TRAVIS)
" Delete the extra script and the resultfile.
call delete(extra_script)
call delete(resultfile)
- endif
" Switch back to the buffer that was active when this function was entered.
exec "buffer" current_buffnr
diff --git a/src/nvim/testdir/test_hide.vim b/src/nvim/testdir/test_hide.vim
new file mode 100644
index 0000000000..128b8ff945
--- /dev/null
+++ b/src/nvim/testdir/test_hide.vim
@@ -0,0 +1,97 @@
+" Tests for :hide command/modifier and 'hidden' option
+
+function SetUp()
+ let s:save_hidden = &hidden
+ let s:save_bufhidden = &bufhidden
+ let s:save_autowrite = &autowrite
+ set nohidden
+ set bufhidden=
+ set noautowrite
+endfunc
+
+function TearDown()
+ let &hidden = s:save_hidden
+ let &bufhidden = s:save_bufhidden
+ let &autowrite = s:save_autowrite
+endfunc
+
+function Test_hide()
+ let orig_bname = bufname('')
+ let orig_winnr = winnr('$')
+
+ new Xf1
+ set modified
+ call assert_fails('edit Xf2')
+ bwipeout! Xf1
+
+ new Xf1
+ set modified
+ edit! Xf2
+ call assert_equal(['Xf2', 2], [bufname(''), winnr('$')])
+ call assert_equal([1, 0], [buflisted('Xf1'), bufloaded('Xf1')])
+ bwipeout! Xf1
+ bwipeout! Xf2
+
+ new Xf1
+ set modified
+ " :hide as a command
+ hide
+ call assert_equal([orig_bname, orig_winnr], [bufname(''), winnr('$')])
+ call assert_equal([1, 1], [buflisted('Xf1'), bufloaded('Xf1')])
+ bwipeout! Xf1
+
+ new Xf1
+ set modified
+ " :hide as a command with trailing comment
+ hide " comment
+ call assert_equal([orig_bname, orig_winnr], [bufname(''), winnr('$')])
+ call assert_equal([1, 1], [buflisted('Xf1'), bufloaded('Xf1')])
+ bwipeout! Xf1
+
+ new Xf1
+ set modified
+ " :hide as a command with bar
+ hide | new Xf2 " comment
+ call assert_equal(['Xf2', 2], [bufname(''), winnr('$')])
+ call assert_equal([1, 1], [buflisted('Xf1'), bufloaded('Xf1')])
+ bwipeout! Xf1
+ bwipeout! Xf2
+
+ new Xf1
+ set modified
+ " :hide as a modifier with trailing comment
+ hide edit Xf2 " comment
+ call assert_equal(['Xf2', 2], [bufname(''), winnr('$')])
+ call assert_equal([1, 1], [buflisted('Xf1'), bufloaded('Xf1')])
+ bwipeout! Xf1
+ bwipeout! Xf2
+
+ new Xf1
+ set modified
+ " To check that the bar is not recognized to separate commands
+ hide echo "one|two"
+ call assert_equal(['Xf1', 2], [bufname(''), winnr('$')])
+ call assert_equal([1, 1], [buflisted('Xf1'), bufloaded('Xf1')])
+ bwipeout! Xf1
+
+ " set hidden
+ new Xf1
+ set hidden
+ set modified
+ edit Xf2 " comment
+ call assert_equal(['Xf2', 2], [bufname(''), winnr('$')])
+ call assert_equal([1, 1], [buflisted('Xf1'), bufloaded('Xf1')])
+ bwipeout! Xf1
+ bwipeout! Xf2
+
+ " set hidden bufhidden=wipe
+ new Xf1
+ set bufhidden=wipe
+ set modified
+ hide edit! Xf2 " comment
+ call assert_equal(['Xf2', 2], [bufname(''), winnr('$')])
+ call assert_equal([0, 0], [buflisted('Xf1'), bufloaded('Xf1')])
+ bwipeout! Xf2
+endfunc
+
+" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/nvim/testdir/test_history.vim b/src/nvim/testdir/test_history.vim
index 3163b344d3..ca31e3f06c 100644
--- a/src/nvim/testdir/test_history.vim
+++ b/src/nvim/testdir/test_history.vim
@@ -31,6 +31,30 @@ function History_Tests(hist)
call assert_equal('ls', histget(a:hist, -1))
call assert_equal(4, histnr(a:hist))
+ let a=execute('history ' . a:hist)
+ call assert_match("^\n # \\S* history\n 3 buffers\n> 4 ls$", a)
+ let a=execute('history all')
+ call assert_match("^\n # .* history\n 3 buffers\n> 4 ls", a)
+
+ if len(a:hist) > 0
+ let a=execute('history ' . a:hist . ' 2')
+ call assert_match("^\n # \\S* history$", a)
+ let a=execute('history ' . a:hist . ' 3')
+ call assert_match("^\n # \\S* history\n 3 buffers$", a)
+ let a=execute('history ' . a:hist . ' 4')
+ call assert_match("^\n # \\S* history\n> 4 ls$", a)
+ let a=execute('history ' . a:hist . ' 3,4')
+ call assert_match("^\n # \\S* history\n 3 buffers\n> 4 ls$", a)
+ let a=execute('history ' . a:hist . ' -1')
+ call assert_match("^\n # \\S* history\n> 4 ls$", a)
+ let a=execute('history ' . a:hist . ' -2')
+ call assert_match("^\n # \\S* history\n 3 buffers$", a)
+ let a=execute('history ' . a:hist . ' -2,')
+ call assert_match("^\n # \\S* history\n 3 buffers\n> 4 ls$", a)
+ let a=execute('history ' . a:hist . ' -3')
+ call assert_match("^\n # \\S* history$", a)
+ endif
+
" Test for removing entries matching a pattern
for i in range(1, 3)
call histadd(a:hist, 'text_' . i)
diff --git a/src/nvim/testdir/test_nested_function.vim b/src/nvim/testdir/test_nested_function.vim
index 7e301ed33e..afaaea6ceb 100644
--- a/src/nvim/testdir/test_nested_function.vim
+++ b/src/nvim/testdir/test_nested_function.vim
@@ -40,3 +40,24 @@ func Test_nested_argument()
delfunc g:X
unlet g:Y
endfunc
+
+func Recurse(count)
+ if a:count > 0
+ call Recurse(a:count - 1)
+ endif
+endfunc
+
+func Test_max_nesting()
+ let call_depth_here = 2
+ let ex_depth_here = 5
+ set mfd&
+
+ call Recurse(99 - call_depth_here)
+ call assert_fails('call Recurse(' . (100 - call_depth_here) . ')', 'E132:')
+
+ set mfd=210
+ call Recurse(209 - ex_depth_here)
+ call assert_fails('call Recurse(' . (210 - ex_depth_here) . ')', 'E169:')
+
+ set mfd&
+endfunc
diff --git a/src/nvim/testdir/test_search.vim b/src/nvim/testdir/test_search.vim
index 2106fc2dec..a333e7f206 100644
--- a/src/nvim/testdir/test_search.vim
+++ b/src/nvim/testdir/test_search.vim
@@ -283,3 +283,18 @@ func Test_use_sub_pat()
call X()
bwipe!
endfunc
+
+func Test_searchpair()
+ new
+ call setline(1, ['other code here', '', '[', '" cursor here', ']'])
+ 4
+ let a=searchpair('\[','',']','bW')
+ call assert_equal(3, a)
+ set nomagic
+ 4
+ let a=searchpair('\[','',']','bW')
+ call assert_equal(3, a)
+ set magic
+ q!
+endfunc
+
diff --git a/src/nvim/version.c b/src/nvim/version.c
index f2b56e0108..1ecda654d1 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -77,6 +77,229 @@ static char *features[] = {
// clang-format off
static const int included_patches[] = {
+ // 875,
+ // 874,
+ // 873,
+ // 872,
+ // 871,
+ // 870,
+ // 869,
+ // 868,
+ // 867,
+ // 866,
+ // 865,
+ // 864,
+ // 863,
+ // 862,
+ // 861,
+ // 860,
+ // 859,
+ // 858,
+ // 857,
+ // 856,
+ // 855,
+ // 854,
+ // 853,
+ // 852,
+ // 851,
+ // 850,
+ // 849,
+ // 848,
+ // 847,
+ // 846,
+ // 845,
+ // 844,
+ // 843,
+ // 842,
+ // 841,
+ // 840,
+ // 839,
+ // 838,
+ // 837,
+ // 836,
+ // 835,
+ // 834,
+ // 833,
+ // 832,
+ // 831,
+ // 830,
+ // 829,
+ // 828,
+ // 827,
+ // 826,
+ // 825,
+ // 824,
+ // 823,
+ // 822,
+ // 821,
+ // 820,
+ // 819,
+ // 818,
+ // 817,
+ // 816,
+ // 815,
+ // 814,
+ // 813,
+ // 812,
+ // 811,
+ // 810,
+ // 809,
+ // 808,
+ // 807,
+ // 806,
+ // 805,
+ // 804,
+ // 803,
+ // 802,
+ // 801,
+ // 800,
+ // 799,
+ // 798,
+ // 797,
+ // 796,
+ // 795,
+ // 794,
+ // 793,
+ // 792,
+ // 791,
+ // 790,
+ // 789,
+ // 788,
+ // 787,
+ // 786,
+ // 785,
+ // 784,
+ // 783,
+ // 782,
+ // 781,
+ // 780,
+ // 779,
+ // 778,
+ // 777,
+ // 776,
+ // 775,
+ // 774,
+ // 773,
+ // 772,
+ // 771,
+ // 770,
+ // 769,
+ // 768,
+ // 767,
+ // 766,
+ // 765,
+ // 764,
+ // 763,
+ // 762,
+ // 761,
+ // 760,
+ // 759,
+ // 758,
+ // 757,
+ // 756,
+ // 755,
+ // 754,
+ // 753,
+ // 752,
+ // 751,
+ // 750,
+ // 749,
+ // 748,
+ // 747,
+ // 746,
+ // 745,
+ // 744,
+ // 743,
+ // 742,
+ // 741,
+ // 740,
+ // 739,
+ // 738,
+ // 737,
+ // 736,
+ // 735,
+ // 734,
+ // 733,
+ // 732,
+ // 731,
+ // 730,
+ // 729,
+ // 728,
+ // 727,
+ // 726,
+ // 725,
+ // 724,
+ // 723,
+ // 722,
+ // 721,
+ // 720,
+ // 719,
+ // 718,
+ // 717,
+ // 716,
+ // 715,
+ // 714,
+ // 713,
+ // 712,
+ // 711,
+ 710,
+ // 709,
+ // 708,
+ // 707,
+ // 706,
+ // 705,
+ // 704,
+ // 703,
+ // 702,
+ // 701,
+ // 700,
+ // 699,
+ // 698,
+ // 697,
+ // 696,
+ // 695,
+ // 694,
+ // 693,
+ // 692,
+ // 691,
+ // 690,
+ // 689,
+ // 688,
+ // 687,
+ // 686,
+ // 685,
+ // 684,
+ // 683,
+ // 682,
+ // 681,
+ // 680,
+ // 679,
+ // 678,
+ // 677,
+ // 676,
+ // 675,
+ // 674,
+ // 673,
+ // 672,
+ // 671,
+ // 670,
+ // 669,
+ // 668,
+ // 667,
+ // 666,
+ // 665,
+ // 664,
+ // 663,
+ // 662,
+ // 661,
+ // 660,
+ // 659,
+ // 658,
+ // 657,
+ // 656,
+ // 655,
+ // 654,
+ // 653,
652,
// 651,
// 650,
@@ -582,17 +805,17 @@ static const int included_patches[] = {
150,
// 149,
// 148,
- // 147,
- // 146,
+ 147,
+ 146,
// 145 NA
// 144 NA
- // 143,
+ 143,
// 142,
// 141,
// 140,
// 139 NA
// 138 NA
- // 137,
+ 137,
136,
135,
134,
@@ -618,7 +841,7 @@ static const int included_patches[] = {
// 114 NA
// 113 NA
// 112,
- // 111,
+ 111,
110,
// 109 NA
// 108 NA
@@ -643,7 +866,7 @@ static const int included_patches[] = {
// 89 NA
88,
// 87 NA
- // 86,
+ 86,
85,
84,
83,
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua
index f4b2a8dfdc..848f1ef477 100644
--- a/test/functional/helpers.lua
+++ b/test/functional/helpers.lua
@@ -367,7 +367,7 @@ end
local function set_shell_powershell()
source([[
set shell=powershell shellquote=\" shellpipe=\| shellredir=>
- set shellcmdflag=\ -NoProfile\ -ExecutionPolicy\ RemoteSigned\ -Command
+ set shellcmdflag=\ -NoLogo\ -NoProfile\ -ExecutionPolicy\ RemoteSigned\ -Command
let &shellxquote=' '
]])
end
diff --git a/test/functional/ui/wildmode_spec.lua b/test/functional/ui/wildmode_spec.lua
index 052cdd55a1..41a751c284 100644
--- a/test/functional/ui/wildmode_spec.lua
+++ b/test/functional/ui/wildmode_spec.lua
@@ -1,57 +1,151 @@
local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local clear, feed, command = helpers.clear, helpers.feed, helpers.command
+local iswin = helpers.iswin
local funcs = helpers.funcs
+local eq = helpers.eq
+local eval = helpers.eval
+local retry = helpers.retry
-if helpers.pending_win32(pending) then return end
-
-describe("'wildmode'", function()
+describe("'wildmenu'", function()
local screen
-
before_each(function()
clear()
screen = Screen.new(25, 5)
screen:attach()
end)
-
after_each(function()
screen:detach()
end)
- describe("'wildmenu'", function()
- it(':sign <tab> shows wildmenu completions', function()
- command('set wildmode=full')
- command('set wildmenu')
- feed(':sign <tab>')
- screen:expect([[
- |
- ~ |
- ~ |
- define jump list > |
- :sign define^ |
- ]])
- end)
+ it(':sign <tab> shows wildmenu completions', function()
+ command('set wildmode=full')
+ command('set wildmenu')
+ feed(':sign <tab>')
+ screen:expect([[
+ |
+ ~ |
+ ~ |
+ define jump list > |
+ :sign define^ |
+ ]])
+ end)
- it('does not crash after cycling back to original text', function()
- command('set wildmode=full')
- feed(':j<Tab><Tab><Tab>')
- screen:expect([[
- |
- ~ |
- ~ |
- join jumps |
- :j^ |
- ]])
- -- This would cause nvim to crash before #6650
- feed('<BS><Tab>')
- screen:expect([[
- |
- ~ |
- ~ |
- ! # & < = > @ > |
- :!^ |
- ]])
+ it('does not crash after cycling back to original text', function()
+ command('set wildmode=full')
+ feed(':j<Tab><Tab><Tab>')
+ screen:expect([[
+ |
+ ~ |
+ ~ |
+ join jumps |
+ :j^ |
+ ]])
+ -- This would cause nvim to crash before #6650
+ feed('<BS><Tab>')
+ screen:expect([[
+ |
+ ~ |
+ ~ |
+ ! # & < = > @ > |
+ :!^ |
+ ]])
+ end)
+
+ it('is preserved during :terminal activity', function()
+ -- Because this test verifies a _lack_ of activity after screen:sleep(), we
+ -- must wait the full timeout. So make it reasonable.
+ screen.timeout = 1000
+
+ command('set wildmenu wildmode=full')
+ command('set scrollback=4')
+ if iswin() then
+ if helpers.pending_win32(pending) then return end
+ -- feed([[:terminal 1,2,3,4,5 | foreach-object -process {echo $_; sleep 0.1}]])
+ else
+ feed([[:terminal for i in $(seq 1 5000); do printf 'foo\nfoo\nfoo\n'; sleep 0.1; done<cr>]])
+ end
+
+ feed([[<C-\><C-N>gg]])
+ feed([[:sign <Tab>]]) -- Invoke wildmenu.
+ screen:sleep(50) -- Allow some terminal output.
+ screen:expect([[
+ foo |
+ foo |
+ foo |
+ define jump list > |
+ :sign define^ |
+ ]])
+
+ -- cmdline CTRL-D display should also be preserved.
+ feed([[<C-\><C-N>]])
+ feed([[:sign <C-D>]]) -- Invoke cmdline CTRL-D.
+ screen:sleep(50) -- Allow some terminal output.
+ screen:expect([[
+ :sign |
+ define place |
+ jump undefine |
+ list unplace |
+ :sign ^ |
+ ]])
+
+ -- Exiting cmdline should show the buffer.
+ feed([[<C-\><C-N>]])
+ screen:expect([[
+ ^foo |
+ foo |
+ foo |
+ foo |
+ |
+ ]])
+ end)
+
+ it('ignores :redrawstatus called from a timer #7108', function()
+ -- Because this test verifies a _lack_ of activity after screen:sleep(), we
+ -- must wait the full timeout. So make it reasonable.
+ screen.timeout = 1000
+
+ command('set wildmenu wildmode=full')
+ command([[call timer_start(10, {->execute('redrawstatus')}, {'repeat':-1})]])
+ feed([[<C-\><C-N>]])
+ feed([[:sign <Tab>]]) -- Invoke wildmenu.
+ screen:sleep(30) -- Allow some timer activity.
+ screen:expect([[
+ |
+ ~ |
+ ~ |
+ define jump list > |
+ :sign define^ |
+ ]])
+ end)
+
+ it('with laststatus=0, :vsplit, :term #2255', function()
+ -- Because this test verifies a _lack_ of activity after screen:sleep(), we
+ -- must wait the full timeout. So make it reasonable.
+ screen.timeout = 1000
+
+ if not iswin() then
+ command('set shell=sh') -- Need a predictable "$" prompt.
+ end
+ command('set laststatus=0')
+ command('vsplit')
+ command('term')
+
+ -- Check for a shell prompt to verify that the terminal loaded.
+ retry(nil, nil, function()
+ if iswin() then
+ eq('Microsoft', eval("matchstr(join(getline(1, '$')), 'Microsoft')"))
+ else
+ eq('$', eval([[matchstr(getline(1), '\$')]]))
+ end
end)
+
+ feed([[<C-\><C-N>]])
+ feed([[:<Tab>]]) -- Invoke wildmenu.
+ screen:sleep(10) -- Flush
+ -- Check only the last 2 lines, because the shell output is
+ -- system-dependent.
+ screen:expect('! # & < = > @ > \n:!^', nil, nil, nil, true)
end)
end)