mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-11 15:37:29 +02:00
Merge remote-tracking branch 'vim/master'
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
" The default vimrc file.
|
||||
"
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last change: 2016 Aug 28
|
||||
" Last change: 2016 Sep 02
|
||||
"
|
||||
" This is loaded if no vimrc file was found.
|
||||
" Except when Vim is run with "-u NONE" or "-C".
|
||||
@@ -13,6 +13,12 @@ if v:progname =~? "evim"
|
||||
finish
|
||||
endif
|
||||
|
||||
" Bail out if something that ran earlier, e.g. a system wide vimrc, does not
|
||||
" want Vim to use these default values.
|
||||
if exists('skip_defaults_vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Use Vim settings, rather than Vi settings (much better!).
|
||||
" This must be first, because it changes other options as a side effect.
|
||||
set nocompatible
|
||||
|
||||
+2
-1
@@ -2126,8 +2126,9 @@ test_arglist \
|
||||
test_matchadd_conceal_utf8 \
|
||||
test_menu \
|
||||
test_messages \
|
||||
test_nested_function \
|
||||
test_nested_function \
|
||||
test_netbeans \
|
||||
test_normal \
|
||||
test_options \
|
||||
test_packadd \
|
||||
test_partial \
|
||||
|
||||
+21
-1
@@ -670,7 +670,8 @@ buf_clear_file(buf_T *buf)
|
||||
|
||||
/*
|
||||
* buf_freeall() - free all things allocated for a buffer that are related to
|
||||
* the file. flags:
|
||||
* the file. Careful: get here with "curwin" NULL when exiting.
|
||||
* flags:
|
||||
* BFA_DEL buffer is going to be deleted
|
||||
* BFA_WIPE buffer is going to be wiped out
|
||||
* BFA_KEEP_UNDO do not free undo information
|
||||
@@ -681,7 +682,13 @@ buf_freeall(buf_T *buf, int flags)
|
||||
#ifdef FEAT_AUTOCMD
|
||||
int is_curbuf = (buf == curbuf);
|
||||
bufref_T bufref;
|
||||
# ifdef FEAT_WINDOWS
|
||||
int is_curwin = (curwin!= NULL && curwin->w_buffer == buf);
|
||||
win_T *the_curwin = curwin;
|
||||
tabpage_T *the_curtab = curtab;
|
||||
# endif
|
||||
|
||||
/* Make sure the buffer isn't closed by autocommands. */
|
||||
buf->b_closing = TRUE;
|
||||
set_bufref(&bufref, buf);
|
||||
if (buf->b_ml.ml_mfp != NULL)
|
||||
@@ -709,6 +716,19 @@ buf_freeall(buf_T *buf, int flags)
|
||||
return;
|
||||
}
|
||||
buf->b_closing = FALSE;
|
||||
|
||||
# ifdef FEAT_WINDOWS
|
||||
/* If the buffer was in curwin and the window has changed, go back to that
|
||||
* window, if it still exists. This avoids that ":edit x" triggering a
|
||||
* "tabnext" BufUnload autocmd leaves a window behind without a buffer. */
|
||||
if (is_curwin && curwin != the_curwin && win_valid_any_tab(the_curwin))
|
||||
{
|
||||
block_autocmds();
|
||||
goto_tabpage_win(the_curtab, the_curwin);
|
||||
unblock_autocmds();
|
||||
}
|
||||
# endif
|
||||
|
||||
# ifdef FEAT_EVAL
|
||||
if (aborting()) /* autocmds may abort script processing */
|
||||
return;
|
||||
|
||||
+11
-8
@@ -3935,25 +3935,28 @@ do_ecmd(
|
||||
auto_buf = TRUE;
|
||||
else
|
||||
{
|
||||
win_T *the_curwin = curwin;
|
||||
|
||||
/* Set the w_closing flag to avoid that autocommands close the
|
||||
* window. */
|
||||
the_curwin->w_closing = TRUE;
|
||||
|
||||
if (curbuf == old_curbuf.br_buf)
|
||||
#endif
|
||||
buf_copy_options(buf, BCO_ENTER);
|
||||
|
||||
/* close the link to the current buffer */
|
||||
/* Close the link to the current buffer. This will set
|
||||
* curwin->w_buffer to NULL. */
|
||||
u_sync(FALSE);
|
||||
close_buffer(oldwin, curbuf,
|
||||
(flags & ECMD_HIDE) ? 0 : DOBUF_UNLOAD, FALSE);
|
||||
|
||||
#ifdef FEAT_AUTOCMD
|
||||
/* Autocommands may open a new window and leave oldwin open
|
||||
* which leads to crashes since the above call sets
|
||||
* oldwin->w_buffer to NULL. */
|
||||
if (curwin != oldwin && oldwin != aucmd_win
|
||||
&& win_valid(oldwin) && oldwin->w_buffer == NULL)
|
||||
win_close(oldwin, FALSE);
|
||||
the_curwin->w_closing = FALSE;
|
||||
|
||||
# ifdef FEAT_EVAL
|
||||
if (aborting()) /* autocmds may abort script processing */
|
||||
/* autocmds may abort script processing */
|
||||
if (aborting() && curwin->w_buffer != NULL)
|
||||
{
|
||||
vim_free(new_name);
|
||||
goto theend;
|
||||
|
||||
+1
-6
@@ -2482,12 +2482,7 @@ do_one_cmd(
|
||||
&& !IS_USER_CMDIDX(ea.cmdidx))
|
||||
{
|
||||
/* Command not allowed when editing the command line. */
|
||||
#ifdef FEAT_CMDWIN
|
||||
if (cmdwin_type != 0)
|
||||
errormsg = (char_u *)_(e_cmdwin);
|
||||
else
|
||||
#endif
|
||||
errormsg = (char_u *)_(e_secure);
|
||||
errormsg = get_text_locked_msg();
|
||||
goto doend;
|
||||
}
|
||||
#ifdef FEAT_AUTOCMD
|
||||
|
||||
+52
-26
@@ -177,17 +177,22 @@ getcmdline(
|
||||
int histype; /* history type to be used */
|
||||
#endif
|
||||
#ifdef FEAT_SEARCH_EXTRA
|
||||
pos_T old_cursor;
|
||||
pos_T search_start; /* where 'incsearch' starts searching */
|
||||
pos_T save_cursor;
|
||||
colnr_T old_curswant;
|
||||
colnr_T init_curswant = curwin->w_curswant;
|
||||
colnr_T old_leftcol;
|
||||
colnr_T init_leftcol = curwin->w_leftcol;
|
||||
linenr_T old_topline;
|
||||
pos_T cursor_start;
|
||||
linenr_T init_topline = curwin->w_topline;
|
||||
pos_T match_start = curwin->w_cursor;
|
||||
pos_T match_end;
|
||||
# ifdef FEAT_DIFF
|
||||
int old_topfill;
|
||||
int init_topfill = curwin->w_topfill;
|
||||
# endif
|
||||
linenr_T old_botline;
|
||||
linenr_T init_botline = curwin->w_botline;
|
||||
int did_incsearch = FALSE;
|
||||
int incsearch_postponed = FALSE;
|
||||
#endif
|
||||
@@ -230,8 +235,8 @@ getcmdline(
|
||||
ccline.overstrike = FALSE; /* always start in insert mode */
|
||||
#ifdef FEAT_SEARCH_EXTRA
|
||||
clearpos(&match_end);
|
||||
old_cursor = curwin->w_cursor; /* needs to be restored later */
|
||||
cursor_start = old_cursor;
|
||||
save_cursor = curwin->w_cursor; /* may be restored later */
|
||||
search_start = curwin->w_cursor;
|
||||
old_curswant = curwin->w_curswant;
|
||||
old_leftcol = curwin->w_leftcol;
|
||||
old_topline = curwin->w_topline;
|
||||
@@ -1006,11 +1011,17 @@ getcmdline(
|
||||
ccline.cmdbuff[ccline.cmdlen] = NUL;
|
||||
#ifdef FEAT_SEARCH_EXTRA
|
||||
if (ccline.cmdlen == 0)
|
||||
old_cursor = cursor_start;
|
||||
else
|
||||
{
|
||||
old_cursor = match_start;
|
||||
decl(&old_cursor);
|
||||
search_start = save_cursor;
|
||||
/* save view settings, so that the screen
|
||||
* won't be restored at the wrong position */
|
||||
old_curswant = init_curswant;
|
||||
old_leftcol = init_leftcol;
|
||||
old_topline = init_topline;
|
||||
# ifdef FEAT_DIFF
|
||||
old_topfill = init_topfill;
|
||||
# endif
|
||||
old_botline = init_botline;
|
||||
}
|
||||
#endif
|
||||
redrawcmd();
|
||||
@@ -1040,7 +1051,7 @@ getcmdline(
|
||||
}
|
||||
#ifdef FEAT_SEARCH_EXTRA
|
||||
if (ccline.cmdlen == 0)
|
||||
old_cursor = cursor_start;
|
||||
search_start = save_cursor;
|
||||
#endif
|
||||
redraw_cmdline = TRUE;
|
||||
goto returncmd; /* back to cmd mode */
|
||||
@@ -1127,7 +1138,7 @@ getcmdline(
|
||||
ccline.cmdbuff[ccline.cmdlen] = NUL;
|
||||
#ifdef FEAT_SEARCH_EXTRA
|
||||
if (ccline.cmdlen == 0)
|
||||
old_cursor = cursor_start;
|
||||
search_start = save_cursor;
|
||||
#endif
|
||||
redrawcmd();
|
||||
goto cmdline_changed;
|
||||
@@ -1476,7 +1487,7 @@ getcmdline(
|
||||
if (did_incsearch)
|
||||
{
|
||||
curwin->w_cursor = match_end;
|
||||
if (!equalpos(curwin->w_cursor, old_cursor))
|
||||
if (!equalpos(curwin->w_cursor, search_start))
|
||||
{
|
||||
c = gchar_cursor();
|
||||
/* If 'ignorecase' and 'smartcase' are set and the
|
||||
@@ -1665,9 +1676,9 @@ getcmdline(
|
||||
#endif
|
||||
goto cmdline_not_changed;
|
||||
|
||||
#ifdef FEAT_SEARCH_EXTRA
|
||||
case Ctrl_G: /* next match */
|
||||
case Ctrl_T: /* previous match */
|
||||
#ifdef FEAT_SEARCH_EXTRA
|
||||
if (p_is && !cmd_silent && (firstc == '/' || firstc == '?'))
|
||||
{
|
||||
pos_T t;
|
||||
@@ -1693,7 +1704,7 @@ getcmdline(
|
||||
--emsg_off;
|
||||
if (i)
|
||||
{
|
||||
old_cursor = match_start;
|
||||
search_start = match_start;
|
||||
match_end = t;
|
||||
match_start = t;
|
||||
if (c == Ctrl_T && firstc == '/')
|
||||
@@ -1701,17 +1712,17 @@ getcmdline(
|
||||
/* move just before the current match, so that
|
||||
* when nv_search finishes the cursor will be
|
||||
* put back on the match */
|
||||
old_cursor = t;
|
||||
(void)decl(&old_cursor);
|
||||
search_start = t;
|
||||
(void)decl(&search_start);
|
||||
}
|
||||
if (lt(t, old_cursor) && c == Ctrl_G)
|
||||
if (lt(t, search_start) && c == Ctrl_G)
|
||||
{
|
||||
/* wrap around */
|
||||
old_cursor = t;
|
||||
search_start = t;
|
||||
if (firstc == '?')
|
||||
(void)incl(&old_cursor);
|
||||
(void)incl(&search_start);
|
||||
else
|
||||
(void)decl(&old_cursor);
|
||||
(void)decl(&search_start);
|
||||
}
|
||||
|
||||
set_search_match(&match_end);
|
||||
@@ -1732,8 +1743,9 @@ getcmdline(
|
||||
}
|
||||
else
|
||||
vim_beep(BO_ERROR);
|
||||
goto cmdline_not_changed;
|
||||
}
|
||||
goto cmdline_not_changed;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case Ctrl_V:
|
||||
@@ -1877,7 +1889,7 @@ cmdline_changed:
|
||||
continue;
|
||||
}
|
||||
incsearch_postponed = FALSE;
|
||||
curwin->w_cursor = old_cursor; /* start at old position */
|
||||
curwin->w_cursor = search_start; /* start at old position */
|
||||
|
||||
/* If there is no command line, don't do anything */
|
||||
if (ccline.cmdlen == 0)
|
||||
@@ -1995,9 +2007,18 @@ returncmd:
|
||||
#ifdef FEAT_SEARCH_EXTRA
|
||||
if (did_incsearch)
|
||||
{
|
||||
curwin->w_cursor = old_cursor;
|
||||
if (gotesc)
|
||||
curwin->w_cursor = cursor_start;
|
||||
curwin->w_cursor = save_cursor;
|
||||
else
|
||||
{
|
||||
if (!equalpos(save_cursor, search_start))
|
||||
{
|
||||
/* put the '" mark at the original position */
|
||||
curwin->w_cursor = save_cursor;
|
||||
setpcmark();
|
||||
}
|
||||
curwin->w_cursor = search_start;
|
||||
}
|
||||
curwin->w_curswant = old_curswant;
|
||||
curwin->w_leftcol = old_leftcol;
|
||||
curwin->w_topline = old_topline;
|
||||
@@ -2140,13 +2161,18 @@ text_locked(void)
|
||||
*/
|
||||
void
|
||||
text_locked_msg(void)
|
||||
{
|
||||
EMSG(_(get_text_locked_msg()));
|
||||
}
|
||||
|
||||
char_u *
|
||||
get_text_locked_msg(void)
|
||||
{
|
||||
#ifdef FEAT_CMDWIN
|
||||
if (cmdwin_type != 0)
|
||||
EMSG(_(e_cmdwin));
|
||||
else
|
||||
return e_cmdwin;
|
||||
#endif
|
||||
EMSG(_(e_secure));
|
||||
return e_secure;
|
||||
}
|
||||
|
||||
#if defined(FEAT_AUTOCMD) || defined(PROTO)
|
||||
|
||||
+17
-8
@@ -7796,6 +7796,7 @@ static AutoPatCmd *active_apc_list = NULL; /* stack of active autocommands */
|
||||
*/
|
||||
static garray_T augroups = {0, 0, sizeof(char_u *), 10, NULL};
|
||||
#define AUGROUP_NAME(i) (((char_u **)augroups.ga_data)[i])
|
||||
/* use get_deleted_augroup() to get this */
|
||||
static char_u *deleted_augroup = NULL;
|
||||
|
||||
/*
|
||||
@@ -7828,6 +7829,14 @@ static event_T last_event;
|
||||
static int last_group;
|
||||
static int autocmd_blocked = 0; /* block all autocmds */
|
||||
|
||||
static char_u *
|
||||
get_deleted_augroup(void)
|
||||
{
|
||||
if (deleted_augroup == NULL)
|
||||
deleted_augroup = (char_u *)_("--Deleted--");
|
||||
return deleted_augroup;
|
||||
}
|
||||
|
||||
/*
|
||||
* Show the autocommands for one AutoPat.
|
||||
*/
|
||||
@@ -7851,7 +7860,7 @@ show_autocmd(AutoPat *ap, event_T event)
|
||||
if (ap->group != AUGROUP_DEFAULT)
|
||||
{
|
||||
if (AUGROUP_NAME(ap->group) == NULL)
|
||||
msg_puts_attr(deleted_augroup, hl_attr(HLF_E));
|
||||
msg_puts_attr(get_deleted_augroup(), hl_attr(HLF_E));
|
||||
else
|
||||
msg_puts_attr(AUGROUP_NAME(ap->group), hl_attr(HLF_T));
|
||||
msg_puts((char_u *)" ");
|
||||
@@ -8046,6 +8055,8 @@ au_del_group(char_u *name)
|
||||
i = au_find_group(name);
|
||||
if (i == AUGROUP_ERROR) /* the group doesn't exist */
|
||||
EMSG2(_("E367: No such group: \"%s\""), name);
|
||||
else if (i == current_augroup)
|
||||
EMSG(_("E936: Cannot delete the current group"));
|
||||
else
|
||||
{
|
||||
event_T event;
|
||||
@@ -8067,9 +8078,7 @@ au_del_group(char_u *name)
|
||||
vim_free(AUGROUP_NAME(i));
|
||||
if (in_use)
|
||||
{
|
||||
if (deleted_augroup == NULL)
|
||||
deleted_augroup = (char_u *)_("--Deleted--");
|
||||
AUGROUP_NAME(i) = deleted_augroup;
|
||||
AUGROUP_NAME(i) = get_deleted_augroup();
|
||||
}
|
||||
else
|
||||
AUGROUP_NAME(i) = NULL;
|
||||
@@ -8086,7 +8095,7 @@ au_find_group(char_u *name)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < augroups.ga_len; ++i)
|
||||
if (AUGROUP_NAME(i) != NULL && AUGROUP_NAME(i) != deleted_augroup
|
||||
if (AUGROUP_NAME(i) != NULL && AUGROUP_NAME(i) != get_deleted_augroup()
|
||||
&& STRCMP(AUGROUP_NAME(i), name) == 0)
|
||||
return i;
|
||||
return AUGROUP_ERROR;
|
||||
@@ -8154,7 +8163,7 @@ free_all_autocmds(void)
|
||||
for (i = 0; i < augroups.ga_len; ++i)
|
||||
{
|
||||
s = ((char_u **)(augroups.ga_data))[i];
|
||||
if (s != deleted_augroup)
|
||||
if (s != get_deleted_augroup())
|
||||
vim_free(s);
|
||||
}
|
||||
ga_clear(&augroups);
|
||||
@@ -9903,7 +9912,7 @@ get_augroup_name(expand_T *xp UNUSED, int idx)
|
||||
return (char_u *)"END";
|
||||
if (idx >= augroups.ga_len) /* end of list */
|
||||
return NULL;
|
||||
if (AUGROUP_NAME(idx) == NULL || AUGROUP_NAME(idx) == deleted_augroup)
|
||||
if (AUGROUP_NAME(idx) == NULL || AUGROUP_NAME(idx) == get_deleted_augroup())
|
||||
/* skip deleted entries */
|
||||
return (char_u *)"";
|
||||
return AUGROUP_NAME(idx); /* return a name */
|
||||
@@ -9969,7 +9978,7 @@ get_event_name(expand_T *xp UNUSED, int idx)
|
||||
if (idx < augroups.ga_len) /* First list group names, if wanted */
|
||||
{
|
||||
if (!include_groups || AUGROUP_NAME(idx) == NULL
|
||||
|| AUGROUP_NAME(idx) == deleted_augroup)
|
||||
|| AUGROUP_NAME(idx) == get_deleted_augroup())
|
||||
return (char_u *)""; /* skip deleted entries */
|
||||
return AUGROUP_NAME(idx); /* return a name */
|
||||
}
|
||||
|
||||
+5
-1
@@ -6262,6 +6262,7 @@ nv_dollar(cmdarg_T *cap)
|
||||
nv_search(cmdarg_T *cap)
|
||||
{
|
||||
oparg_T *oap = cap->oap;
|
||||
pos_T save_cursor = curwin->w_cursor;
|
||||
|
||||
if (cap->cmdchar == '?' && cap->oap->op_type == OP_ROT13)
|
||||
{
|
||||
@@ -6272,6 +6273,8 @@ nv_search(cmdarg_T *cap)
|
||||
return;
|
||||
}
|
||||
|
||||
/* When using 'incsearch' the cursor may be moved to set a different search
|
||||
* start position. */
|
||||
cap->searchbuf = getcmdline(cap->cmdchar, cap->count1, 0);
|
||||
|
||||
if (cap->searchbuf == NULL)
|
||||
@@ -6281,7 +6284,8 @@ nv_search(cmdarg_T *cap)
|
||||
}
|
||||
|
||||
(void)normal_search(cap, cap->cmdchar, cap->searchbuf,
|
||||
(cap->arg ? 0 : SEARCH_MARK));
|
||||
(cap->arg || !equalpos(save_cursor, curwin->w_cursor))
|
||||
? 0 : SEARCH_MARK);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -3,6 +3,7 @@ char_u *getcmdline(int firstc, long count, int indent);
|
||||
char_u *getcmdline_prompt(int firstc, char_u *prompt, int attr, int xp_context, char_u *xp_arg);
|
||||
int text_locked(void);
|
||||
void text_locked_msg(void);
|
||||
char_u *get_text_locked_msg(void);
|
||||
int curbuf_locked(void);
|
||||
int allbuf_locked(void);
|
||||
char_u *getexline(int c, void *cookie, int indent);
|
||||
|
||||
@@ -174,6 +174,7 @@ NEW_TESTS = test_arglist.res \
|
||||
test_matchadd_conceal.res \
|
||||
test_nested_function.res \
|
||||
test_netbeans.res \
|
||||
test_normal.res \
|
||||
test_packadd.res \
|
||||
test_perl.res \
|
||||
test_quickfix.res \
|
||||
|
||||
@@ -121,7 +121,7 @@ nolog:
|
||||
RUN_VIMTEST = VIMRUNTIME=$(SCRIPTSOURCE); export VIMRUNTIME; $(VALGRIND) $(VIMPROG) -f $(GUI_FLAG) -u unix.vim $(NO_PLUGIN)
|
||||
|
||||
newtests: newtestssilent
|
||||
@/bin/sh -c "if test -f messages && grep -q 'FAILED' messages; then cat messages && cat test.log; fi"
|
||||
@/bin/sh -c "if test -f messages && grep -q 'SKIPPED\|FAILED' messages; then cat messages && if test -f test.log; then cat test.log; fi ; fi"
|
||||
|
||||
newtestssilent: $(NEW_TESTS)
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ TO ADD A NEW STYLE TEST:
|
||||
4) Also add an entry in src/Makefile.
|
||||
|
||||
What you can use (see test_assert.vim for an example):
|
||||
- Call assert_equal(), assert_true() and assert_false().
|
||||
- Call assert_equal(), assert_true(), assert_false(), etc.
|
||||
- Use try/catch to check for exceptions.
|
||||
- Use alloc_fail() to have memory allocation fail. This makes it possible
|
||||
to check memory allocation failures are handled gracefully. You need to
|
||||
@@ -29,6 +29,9 @@ What you can use (see test_assert.vim for an example):
|
||||
- Use disable_char_avail_for_testing(1) if char_avail() must return FALSE for
|
||||
a while. E.g. to trigger the CursorMovedI autocommand event.
|
||||
See test_cursor_func.vim for an example
|
||||
- If the bug that is being tested isn't fixed yet, you can throw an exception
|
||||
so that it's clear this still needs work. E.g.:
|
||||
throw "Skipped: Bug with <c-e> and popupmenu not fixed yet"
|
||||
- See the start of runtest.vim for more help.
|
||||
|
||||
|
||||
|
||||
@@ -96,6 +96,9 @@ function RunTheTest(test)
|
||||
let s:done += 1
|
||||
try
|
||||
exe 'call ' . a:test
|
||||
catch /^\cskipped/
|
||||
call add(s:messages, ' Skipped')
|
||||
call add(s:skipped, 'SKIPPED ' . a:test . ': ' . substitute(v:exception, '^\S*\s\+', '', ''))
|
||||
catch
|
||||
call add(v:errors, 'Caught exception in ' . a:test . ': ' . v:exception . ' @ ' . v:throwpoint)
|
||||
endtry
|
||||
@@ -127,6 +130,7 @@ let s:done = 0
|
||||
let s:fail = 0
|
||||
let s:errors = []
|
||||
let s:messages = []
|
||||
let s:skipped = []
|
||||
if expand('%') =~ 'test_viml.vim'
|
||||
" this test has intentional s:errors, don't use try/catch.
|
||||
source %
|
||||
@@ -200,7 +204,10 @@ if s:fail > 0
|
||||
call extend(s:messages, s:errors)
|
||||
endif
|
||||
|
||||
" Append messages to "messages"
|
||||
" Add SKIPPED messages
|
||||
call extend(s:messages, s:skipped)
|
||||
|
||||
" Append messages to the file "messages"
|
||||
split messages
|
||||
call append(line('$'), '')
|
||||
call append(line('$'), 'From ' . g:testname . ':')
|
||||
|
||||
@@ -182,4 +182,17 @@ func Test_augroup_warning()
|
||||
doautocmd VimEnter
|
||||
redir END
|
||||
call assert_true(match(res, "W19:") < 0)
|
||||
au! VimEnter
|
||||
endfunc
|
||||
|
||||
func Test_augroup_deleted()
|
||||
" This caused a crash before E936 was introduced
|
||||
augroup x
|
||||
call assert_fails('augroup! x', 'E936:')
|
||||
au VimEnter * echo
|
||||
augroup end
|
||||
augroup! x
|
||||
call assert_true(match(execute('au VimEnter'), "-Deleted-.*VimEnter") >= 0)
|
||||
au! VimEnter
|
||||
endfunc
|
||||
|
||||
|
||||
@@ -831,6 +831,7 @@ func Run_pipe_through_sort(all, use_buffer)
|
||||
call assert_equal("dead", job_status(g:job))
|
||||
|
||||
sp sortout
|
||||
call WaitFor('line("$") > 3')
|
||||
call assert_equal('Reading from channel output...', getline(1))
|
||||
if a:all
|
||||
call assert_equal(['aaa', 'bbb', 'ccc', 'ddd', 'eee'], getline(2, 6))
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -16,6 +16,21 @@ func! ListMonths()
|
||||
return ''
|
||||
endfunc
|
||||
|
||||
func! Test_popup_complete2()
|
||||
" Insert match immediately, if there is only one match
|
||||
" <c-e> Should select a character from the line below
|
||||
" TODO: test disabled because the code change has been reverted.
|
||||
throw "Skipped: Bug with <c-e> and popupmenu not fixed yet"
|
||||
new
|
||||
inoremap <f5> <c-r>=ListMonths()<cr>
|
||||
call append(1, ["December2015"])
|
||||
:1
|
||||
call feedkeys("aD\<f5>\<C-E>\<C-E>\<C-E>\<C-E>\<enter>\<esc>", 'tx')
|
||||
call assert_equal(["December2015", "", "December2015"], getline(1,3))
|
||||
%d
|
||||
bw!
|
||||
endfu
|
||||
|
||||
func! Test_popup_complete()
|
||||
new
|
||||
inoremap <f5> <c-r>=ListMonths()<cr>
|
||||
@@ -168,15 +183,6 @@ func! Test_popup_complete()
|
||||
call assert_equal(["December2015", "December2015", ""], getline(1,3))
|
||||
%d
|
||||
|
||||
" Insert match immediately, if there is only one match
|
||||
" <c-e> Should select a character from the line below
|
||||
" TODO: test disabled because the code change has been reverted.
|
||||
" call append(1, ["December2015"])
|
||||
" :1
|
||||
" call feedkeys("aD\<f5>\<C-E>\<C-E>\<C-E>\<C-E>\<enter>\<esc>", 'tx')
|
||||
" call assert_equal(["December2015", "", "December2015"], getline(1,3))
|
||||
" %d
|
||||
|
||||
" use menuone for 'completeopt'
|
||||
" Since for the first <c-y> the menu is still shown, will only select
|
||||
" three letters from the line above
|
||||
|
||||
@@ -31,6 +31,7 @@ func Test_search_cmdline()
|
||||
" second match
|
||||
call feedkeys("/the\<C-G>\<cr>", 'tx')
|
||||
call assert_equal(' 3 the', getline('.'))
|
||||
call assert_equal([0, 0, 0, 0], getpos('"'))
|
||||
:1
|
||||
" third match
|
||||
call feedkeys("/the".repeat("\<C-G>", 2)."\<cr>", 'tx')
|
||||
@@ -59,6 +60,7 @@ func Test_search_cmdline()
|
||||
" no further match
|
||||
call feedkeys("/the".repeat("\<C-G>", 8)."\<cr>", 'tx')
|
||||
call assert_equal(' 9 these', getline('.'))
|
||||
call assert_equal([0, 0, 0, 0], getpos('"'))
|
||||
|
||||
" Test 3
|
||||
" Ctrl-G goes from one match to the next
|
||||
@@ -180,11 +182,11 @@ func Test_search_cmdline()
|
||||
1
|
||||
" delete one char, add another
|
||||
call feedkeys("/thei\<bs>s\<cr>", 'tx')
|
||||
call assert_equal(' 9 these', getline('.'))
|
||||
call assert_equal(' 2 these', getline('.'))
|
||||
1
|
||||
" delete one char, add another, go to previous match, add one char
|
||||
call feedkeys("/thei\<bs>s\<bs>\<C-T>\<c-l>\<cr>", 'tx')
|
||||
call assert_equal(' 8 them', getline('.'))
|
||||
call assert_equal(' 9 these', getline('.'))
|
||||
1
|
||||
" delete all chars, start from the beginning again
|
||||
call feedkeys("/them". repeat("\<bs>",4).'the\>'."\<cr>", 'tx')
|
||||
@@ -236,7 +238,33 @@ func Test_search_cmdline2()
|
||||
call feedkeys("/the\<C-G>\<C-G>\<C-G>\<C-T>\<C-T>\<C-T>\<cr>", 'tx')
|
||||
call assert_equal(' 2 these', getline('.'))
|
||||
|
||||
" Test 2: keep the view,
|
||||
" after deleting a character from the search cmd
|
||||
call setline(1, [' 1', ' 2 these', ' 3 the', ' 4 their', ' 5 there', ' 6 their', ' 7 the', ' 8 them', ' 9 these', ' 10 foobar'])
|
||||
resize 5
|
||||
1
|
||||
call feedkeys("/foo\<bs>\<cr>", 'tx')
|
||||
redraw
|
||||
call assert_equal({'lnum': 10, 'leftcol': 0, 'col': 4, 'topfill': 0, 'topline': 6, 'coladd': 0, 'skipcol': 0, 'curswant': 4}, winsaveview())
|
||||
|
||||
" remove all history entries
|
||||
for i in range(10)
|
||||
call histdel('/')
|
||||
endfor
|
||||
|
||||
" Test 3: reset the view,
|
||||
" after deleting all characters from the search cmd
|
||||
norm! 1gg0
|
||||
" unfortunately, neither "/foo\<c-w>\<cr>", nor "/foo\<bs>\<bs>\<bs>\<cr>",
|
||||
" nor "/foo\<c-u>\<cr>" works to delete the commandline.
|
||||
" In that case Vim should return "E35 no previous regular expression",
|
||||
" but it looks like Vim still sees /foo and therefore the test fails.
|
||||
" Therefore, disableing this test
|
||||
"call assert_fails(feedkeys("/foo\<c-w>\<cr>", 'tx'), 'E35')
|
||||
"call assert_equal({'lnum': 1, 'leftcol': 0, 'col': 0, 'topfill': 0, 'topline': 1, 'coladd': 0, 'skipcol': 0, 'curswant': 0}, winsaveview())
|
||||
|
||||
" clean up
|
||||
set noincsearch
|
||||
call test_disable_char_avail(0)
|
||||
bw!
|
||||
endfunc
|
||||
|
||||
@@ -218,7 +218,7 @@ function Test_tabpage_with_tab_modifier()
|
||||
bw!
|
||||
endfunction
|
||||
|
||||
func Test_tabnext_on_buf_unload()
|
||||
func Test_tabnext_on_buf_unload1()
|
||||
" This once caused a crash
|
||||
new
|
||||
tabedit
|
||||
@@ -227,7 +227,19 @@ func Test_tabnext_on_buf_unload()
|
||||
q
|
||||
|
||||
while tabpagenr('$') > 1
|
||||
quit
|
||||
bwipe!
|
||||
endwhile
|
||||
endfunc
|
||||
|
||||
func Test_tabnext_on_buf_unload2()
|
||||
" This once caused a crash
|
||||
tabedit
|
||||
autocmd BufUnload <buffer> tabnext
|
||||
file x
|
||||
edit y
|
||||
|
||||
while tabpagenr('$') > 1
|
||||
bwipe!
|
||||
endwhile
|
||||
endfunc
|
||||
|
||||
|
||||
@@ -778,6 +778,26 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
2321,
|
||||
/**/
|
||||
2320,
|
||||
/**/
|
||||
2319,
|
||||
/**/
|
||||
2318,
|
||||
/**/
|
||||
2317,
|
||||
/**/
|
||||
2316,
|
||||
/**/
|
||||
2315,
|
||||
/**/
|
||||
2314,
|
||||
/**/
|
||||
2313,
|
||||
/**/
|
||||
2312,
|
||||
/**/
|
||||
2311,
|
||||
/**/
|
||||
|
||||
+1
-6
@@ -3917,12 +3917,7 @@ goto_tabpage(int n)
|
||||
if (text_locked())
|
||||
{
|
||||
/* Not allowed when editing the command line. */
|
||||
#ifdef FEAT_CMDWIN
|
||||
if (cmdwin_type != 0)
|
||||
EMSG(_(e_cmdwin));
|
||||
else
|
||||
#endif
|
||||
EMSG(_(e_secure));
|
||||
text_locked_msg();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user