Merge remote-tracking branch 'vim/master'

This commit is contained in:
Kazuki Sakamoto
2018-10-10 20:53:21 -07:00
24 changed files with 923 additions and 710 deletions
+4 -2
View File
@@ -102,8 +102,10 @@ Or:
This also contains tools xgettext, msgformat and others.
libintl.dll should be placed in same directory with (g)vim.exe, or some
place where PATH environment value describe. Vim also finds libintl-8.dll.
libintl.dll should be placed in same directory as (g)vim.exe, or one of the
directories listed in the PATH environment value. Vim also looks for the
alternate names "libintl-8.dll" and "intl.dll".
Message files (vim.mo) have to be placed in "$VIMRUNTIME/lang/xx/LC_MESSAGES",
where "xx" is the abbreviation of the language (mostly two letters).
+10 -9
View File
@@ -2848,18 +2848,19 @@ ex_diffgetput(exarg_T *eap)
theend:
diff_busy = FALSE;
if (diff_need_update)
{
diff_need_update = FALSE;
ex_diffupdate(NULL);
}
// Check that the cursor is on a valid character and update it's
// position. When there were filler lines the topline has become
// invalid.
check_cursor();
changed_line_abv_curs();
if (diff_need_update)
// redraw already done by ex_diffupdate()
diff_need_update = FALSE;
else
{
// Check that the cursor is on a valid character and update it's
// position. When there were filler lines the topline has become
// invalid.
check_cursor();
changed_line_abv_curs();
// Also need to redraw the other buffers.
diff_redraw(FALSE);
apply_autocmds(EVENT_DIFFUPDATED, NULL, NULL, FALSE, curbuf);
+10 -1
View File
@@ -9041,6 +9041,8 @@ assert_fails(typval_T *argvars)
char_u *cmd = get_tv_string_chk(&argvars[0]);
garray_T ga;
int ret = 0;
char_u numbuf[NUMBUFLEN];
char_u *tofree;
called_emsg = FALSE;
suppress_errthrow = TRUE;
@@ -9050,7 +9052,14 @@ assert_fails(typval_T *argvars)
{
prepare_assert_error(&ga);
ga_concat(&ga, (char_u *)"command did not fail: ");
ga_concat(&ga, cmd);
if (argvars[1].v_type != VAR_UNKNOWN
&& argvars[2].v_type != VAR_UNKNOWN)
{
ga_concat(&ga, echo_string(&argvars[2], &tofree, numbuf, 0));
vim_free(tofree);
}
else
ga_concat(&ga, cmd);
assert_error(&ga);
ga_clear(&ga);
ret = 1;
+2 -2
View File
@@ -512,7 +512,7 @@ static struct fst
{"assert_equal", 2, 3, f_assert_equal},
{"assert_equalfile", 2, 2, f_assert_equalfile},
{"assert_exception", 1, 2, f_assert_exception},
{"assert_fails", 1, 2, f_assert_fails},
{"assert_fails", 1, 3, f_assert_fails},
{"assert_false", 1, 2, f_assert_false},
{"assert_inrange", 3, 4, f_assert_inrange},
{"assert_match", 2, 3, f_assert_match},
@@ -1507,7 +1507,7 @@ f_assert_exception(typval_T *argvars, typval_T *rettv)
}
/*
* "assert_fails(cmd [, error])" function
* "assert_fails(cmd [, error[, msg]])" function
*/
static void
f_assert_fails(typval_T *argvars, typval_T *rettv)
+22 -2
View File
@@ -1676,6 +1676,26 @@ do_shell(
apply_autocmds(EVENT_SHELLCMDPOST, NULL, NULL, FALSE, curbuf);
}
#if !defined(UNIX)
static char_u *
find_pipe(char_u *cmd)
{
char_u *p;
int inquote = FALSE;
for (p = cmd; *p != NUL; ++p)
{
if (!inquote && *p == '|')
return p;
if (*p == '"')
inquote = !inquote;
else if (rem_backslash(p))
++p;
}
return NULL;
}
#endif
/*
* Create a shell command from a command string, input redirection file and
* output redirection file.
@@ -1746,7 +1766,7 @@ make_filter_cmd(
*/
if (*p_shq == NUL)
{
p = vim_strchr(buf, '|');
p = find_pipe(buf);
if (p != NULL)
*p = NUL;
}
@@ -1754,7 +1774,7 @@ make_filter_cmd(
STRCAT(buf, itmp);
if (*p_shq == NUL)
{
p = vim_strchr(cmd, '|');
p = find_pipe(cmd);
if (p != NULL)
{
STRCAT(buf, " "); /* insert a space before the '|' for DOS */
+20 -17
View File
@@ -438,7 +438,7 @@ typeahead_noflush(int c)
* flush all typeahead characters (used when interrupted by a CTRL-C).
*/
void
flush_buffers(int flush_typeahead)
flush_buffers(flush_buffers_T flush_typeahead)
{
init_typebuf();
@@ -446,15 +446,21 @@ flush_buffers(int flush_typeahead)
while (read_readbuffers(TRUE) != NUL)
;
if (flush_typeahead) /* remove all typeahead */
if (flush_typeahead == FLUSH_MINIMAL)
{
/*
* We have to get all characters, because we may delete the first part
* of an escape sequence.
* In an xterm we get one char at a time and we have to get them all.
*/
while (inchar(typebuf.tb_buf, typebuf.tb_buflen - 1, 10L) != 0)
;
// remove mapped characters at the start only
typebuf.tb_off += typebuf.tb_maplen;
typebuf.tb_len -= typebuf.tb_maplen;
}
else
{
// remove typeahead
if (flush_typeahead == FLUSH_INPUT)
// We have to get all characters, because we may delete the first
// part of an escape sequence. In an xterm we get one char at a
// time and we have to get them all.
while (inchar(typebuf.tb_buf, typebuf.tb_buflen - 1, 10L) != 0)
;
typebuf.tb_off = MAXMAPLEN;
typebuf.tb_len = 0;
#if defined(FEAT_CLIENTSERVER) || defined(FEAT_EVAL)
@@ -463,11 +469,6 @@ flush_buffers(int flush_typeahead)
typebuf_was_filled = FALSE;
#endif
}
else /* remove mapped characters at the start only */
{
typebuf.tb_off += typebuf.tb_maplen;
typebuf.tb_len -= typebuf.tb_maplen;
}
typebuf.tb_maplen = 0;
typebuf.tb_silent = 0;
cmd_silent = FALSE;
@@ -1858,6 +1859,7 @@ plain_vgetc(void)
* Check if a character is available, such that vgetc() will not block.
* If the next character is a special character or multi-byte, the returned
* character is not valid!.
* Returns NUL if no character is available.
*/
int
vpeekc(void)
@@ -1956,7 +1958,8 @@ vungetc(int c)
* KeyTyped is set to TRUE in the case the user typed the key.
* KeyStuffed is TRUE if the character comes from the stuff buffer.
* if "advance" is FALSE (vpeekc()):
* just look whether there is a character available.
* Just look whether there is a character available.
* Return NUL if not.
*
* When "no_mapping" is zero, checks for mappings in the current mode.
* Only returns one byte (of a multi-byte character).
@@ -2084,7 +2087,7 @@ vgetorpeek(int advance)
c = ESC;
else
c = Ctrl_C;
flush_buffers(TRUE); /* flush all typeahead */
flush_buffers(FLUSH_INPUT); // flush all typeahead
if (advance)
{
@@ -2510,7 +2513,7 @@ vgetorpeek(int advance)
redrawcmdline();
else
setcursor();
flush_buffers(FALSE);
flush_buffers(FLUSH_MINIMAL);
mapdepth = 0; /* for next one */
c = -1;
break;
+11 -7
View File
@@ -4506,19 +4506,23 @@ findswapname(
#endif
{
#ifdef FEAT_GUI
/* If we are supposed to start the GUI but it wasn't
* completely started yet, start it now. This makes
* the messages displayed in the Vim window when
* loading a session from the .gvimrc file. */
// If we are supposed to start the GUI but it wasn't
// completely started yet, start it now. This makes
// the messages displayed in the Vim window when
// loading a session from the .gvimrc file.
if (gui.starting && !gui.in_use)
gui_start();
#endif
/* Show info about the existing swap file. */
// Show info about the existing swap file.
attention_message(buf, fname);
/* We don't want a 'q' typed at the more-prompt
* interrupt loading a file. */
// We don't want a 'q' typed at the more-prompt
// interrupt loading a file.
got_int = FALSE;
// If vimrc has "simalt ~x" we don't want it to
// interfere with the prompt here.
flush_buffers(FLUSH_TYPEAHEAD);
}
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
+2 -2
View File
@@ -688,8 +688,8 @@ emsg(char_u *s)
if (p_eb)
beep_flush(); /* also includes flush_buffers() */
else
flush_buffers(FALSE); /* flush internal buffers */
did_emsg = TRUE; /* flag for DoOneCmd() */
flush_buffers(FLUSH_MINIMAL); // flush internal buffers
did_emsg = TRUE; // flag for DoOneCmd()
#ifdef FEAT_EVAL
did_uncaught_emsg = TRUE;
#endif
+1 -1
View File
@@ -3832,7 +3832,7 @@ beep_flush(void)
{
if (emsg_silent == 0)
{
flush_buffers(FALSE);
flush_buffers(FLUSH_MINIMAL);
vim_beep(BO_ERROR);
}
}
+4 -4
View File
@@ -6470,14 +6470,14 @@ mch_parse_cmd(char_u *cmd, int use_shcf, char ***argv, int *argc)
while (*p != NUL && (inquote || (*p != ' ' && *p != TAB)))
{
if (p[0] == '"')
/* quotes surrounding an argument and are dropped */
// quotes surrounding an argument and are dropped
inquote = !inquote;
else
{
if (p[0] == '\\' && p[1] != NUL)
if (rem_backslash(p))
{
/* First pass: skip over "\ " and "\"".
* Second pass: Remove the backslash. */
// First pass: skip over "\ " and "\"".
// Second pass: Remove the backslash.
++p;
}
if (i == 1)
+4 -4
View File
@@ -63,7 +63,7 @@ clip_mch_request_selection(VimClipboard *cbd)
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSPasteboard *pb = [NSPasteboard generalPasteboard];
#ifdef AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
NSArray *supportedTypes = [NSArray arrayWithObjects:VimPboardType,
NSPasteboardTypeString, nil];
#else
@@ -99,7 +99,7 @@ clip_mch_request_selection(VimClipboard *cbd)
{
/* Use NSPasteboardTypeString. The motion type is detected automatically.
*/
#ifdef AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
NSMutableString *mstring =
[[pb stringForType:NSPasteboardTypeString] mutableCopy];
#else
@@ -188,7 +188,7 @@ clip_mch_set_selection(VimClipboard *cbd)
/* See clip_mch_request_selection() for info on pasteboard types. */
NSPasteboard *pb = [NSPasteboard generalPasteboard];
#ifdef AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
NSArray *supportedTypes = [NSArray arrayWithObjects:VimPboardType,
NSPasteboardTypeString, nil];
#else
@@ -201,7 +201,7 @@ clip_mch_set_selection(VimClipboard *cbd)
NSArray *plist = [NSArray arrayWithObjects:motion, string, nil];
[pb setPropertyList:plist forType:VimPboardType];
#ifdef AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
[pb setString:string forType:NSPasteboardTypeString];
#else
[pb setString:string forType:NSStringPboardType];
+37 -2
View File
@@ -2324,6 +2324,41 @@ enumWindowsGetNames(HWND hwnd, LPARAM lparam)
return TRUE;
}
struct enum_windows_s
{
WNDENUMPROC lpEnumFunc;
LPARAM lParam;
};
static BOOL CALLBACK
enum_windows_child(HWND hwnd, LPARAM lParam)
{
struct enum_windows_s *ew = (struct enum_windows_s *)lParam;
return (ew->lpEnumFunc)(hwnd, ew->lParam);
}
static BOOL CALLBACK
enum_windows_toplevel(HWND hwnd, LPARAM lParam)
{
struct enum_windows_s *ew = (struct enum_windows_s *)lParam;
if ((ew->lpEnumFunc)(hwnd, ew->lParam))
return TRUE;
return EnumChildWindows(hwnd, enum_windows_child, lParam);
}
/* Enumerate all windows including children. */
static BOOL
enum_windows(WNDENUMPROC lpEnumFunc, LPARAM lParam)
{
struct enum_windows_s ew;
ew.lpEnumFunc = lpEnumFunc;
ew.lParam = lParam;
return EnumWindows(enum_windows_toplevel, (LPARAM)&ew);
}
static HWND
findServer(char_u *name)
{
@@ -2332,7 +2367,7 @@ findServer(char_u *name)
id.name = name;
id.hwnd = 0;
EnumWindows(enumWindowsGetServer, (LPARAM)(&id));
enum_windows(enumWindowsGetServer, (LPARAM)(&id));
return id.hwnd;
}
@@ -2395,7 +2430,7 @@ serverGetVimNames(void)
ga_init2(&ga, 1, 100);
EnumWindows(enumWindowsGetNames, (LPARAM)(&ga));
enum_windows(enumWindowsGetNames, (LPARAM)(&ga));
ga_append(&ga, NUL);
return ga.ga_data;
+95 -53
View File
@@ -573,7 +573,8 @@ get_dll_import_func(HINSTANCE hInst, const char *funcname)
#if defined(DYNAMIC_GETTEXT) || defined(PROTO)
# ifndef GETTEXT_DLL
# define GETTEXT_DLL "libintl.dll"
# define GETTEXT_DLL_ALT "libintl-8.dll"
# define GETTEXT_DLL_ALT1 "libintl-8.dll"
# define GETTEXT_DLL_ALT2 "intl.dll"
# endif
/* Dummy functions */
static char *null_libintl_gettext(const char *);
@@ -614,14 +615,18 @@ dyn_libintl_init(void)
};
HINSTANCE hmsvcrt;
/* No need to initialize twice. */
if (hLibintlDLL)
// No need to initialize twice.
if (hLibintlDLL != NULL)
return 1;
/* Load gettext library (libintl.dll) */
// Load gettext library (libintl.dll and other names).
hLibintlDLL = vimLoadLib(GETTEXT_DLL);
#ifdef GETTEXT_DLL_ALT
#ifdef GETTEXT_DLL_ALT1
if (!hLibintlDLL)
hLibintlDLL = vimLoadLib(GETTEXT_DLL_ALT);
hLibintlDLL = vimLoadLib(GETTEXT_DLL_ALT1);
#endif
#ifdef GETTEXT_DLL_ALT2
if (!hLibintlDLL)
hLibintlDLL = vimLoadLib(GETTEXT_DLL_ALT2);
#endif
if (!hLibintlDLL)
{
@@ -847,7 +852,7 @@ static const struct
int chAlt;
} VirtKeyMap[] =
{
/* Key ANSI alone shift ctrl alt */
// Key ANSI alone shift ctrl alt
{ VK_ESCAPE,FALSE, ESC, ESC, ESC, ESC, },
{ VK_F1, TRUE, ';', 'T', '^', 'h', },
@@ -860,49 +865,50 @@ static const struct
{ VK_F8, TRUE, 'B', '[', 'e', 'o', },
{ VK_F9, TRUE, 'C', '\\', 'f', 'p', },
{ VK_F10, TRUE, 'D', ']', 'g', 'q', },
{ VK_F11, TRUE, 0x85, 0x87, 0x89, 0x8B, },
{ VK_F12, TRUE, 0x86, 0x88, 0x8a, 0x8c, },
{ VK_F11, TRUE, '\205', '\207', '\211', '\213', },
{ VK_F12, TRUE, '\206', '\210', '\212', '\214', },
{ VK_HOME, TRUE, 'G', 0xc2, 'w', 0xc3, },
{ VK_UP, TRUE, 'H', 0xc4, 0xc5, 0xc6, },
{ VK_PRIOR, TRUE, 'I', 0xc7, 0x84, 0xc8, }, /*PgUp*/
{ VK_LEFT, TRUE, 'K', 0xc9, 's', 0xca, },
{ VK_RIGHT, TRUE, 'M', 0xcb, 't', 0xcc, },
{ VK_END, TRUE, 'O', 0xcd, 'u', 0xce, },
{ VK_DOWN, TRUE, 'P', 0xcf, 0xd0, 0xd1, },
{ VK_NEXT, TRUE, 'Q', 0xd2, 'v', 0xd3, }, /*PgDn*/
{ VK_INSERT,TRUE, 'R', 0xd4, 0xd5, 0xd6, },
{ VK_DELETE,TRUE, 'S', 0xd7, 0xd8, 0xd9, },
{ VK_HOME, TRUE, 'G', '\302', 'w', '\303', },
{ VK_UP, TRUE, 'H', '\304', '\305', '\306', },
{ VK_PRIOR, TRUE, 'I', '\307', '\204', '\310', }, // PgUp
{ VK_LEFT, TRUE, 'K', '\311', 's', '\312', },
{ VK_RIGHT, TRUE, 'M', '\313', 't', '\314', },
{ VK_END, TRUE, 'O', '\315', 'u', '\316', },
{ VK_DOWN, TRUE, 'P', '\317', '\320', '\321', },
{ VK_NEXT, TRUE, 'Q', '\322', 'v', '\323', }, // PgDn
{ VK_INSERT,TRUE, 'R', '\324', '\325', '\326', },
{ VK_DELETE,TRUE, 'S', '\327', '\330', '\331', },
{ VK_SNAPSHOT,TRUE, 0, 0, 0, 'r', }, /*PrtScrn*/
{ VK_SNAPSHOT,TRUE, 0, 0, 0, 'r', }, // PrtScrn
#if 0
/* Most people don't have F13-F20, but what the hell... */
{ VK_F13, TRUE, 0xda, 0xdb, 0xdc, 0xdd, },
{ VK_F14, TRUE, 0xde, 0xdf, 0xe0, 0xe1, },
{ VK_F15, TRUE, 0xe2, 0xe3, 0xe4, 0xe5, },
{ VK_F16, TRUE, 0xe6, 0xe7, 0xe8, 0xe9, },
{ VK_F17, TRUE, 0xea, 0xeb, 0xec, 0xed, },
{ VK_F18, TRUE, 0xee, 0xef, 0xf0, 0xf1, },
{ VK_F19, TRUE, 0xf2, 0xf3, 0xf4, 0xf5, },
{ VK_F20, TRUE, 0xf6, 0xf7, 0xf8, 0xf9, },
// Most people don't have F13-F20, but what the hell...
{ VK_F13, TRUE, '\332', '\333', '\334', '\335', },
{ VK_F14, TRUE, '\336', '\337', '\340', '\341', },
{ VK_F15, TRUE, '\342', '\343', '\344', '\345', },
{ VK_F16, TRUE, '\346', '\347', '\350', '\351', },
{ VK_F17, TRUE, '\352', '\353', '\354', '\355', },
{ VK_F18, TRUE, '\356', '\357', '\360', '\361', },
{ VK_F19, TRUE, '\362', '\363', '\364', '\365', },
{ VK_F20, TRUE, '\366', '\367', '\370', '\371', },
#endif
{ VK_ADD, TRUE, 'N', 'N', 'N', 'N', }, /* keyp '+' */
{ VK_SUBTRACT, TRUE,'J', 'J', 'J', 'J', }, /* keyp '-' */
/* { VK_DIVIDE, TRUE,'N', 'N', 'N', 'N', }, keyp '/' */
{ VK_MULTIPLY, TRUE,'7', '7', '7', '7', }, /* keyp '*' */
{ VK_ADD, TRUE, 'N', 'N', 'N', 'N', }, // keyp '+'
{ VK_SUBTRACT, TRUE,'J', 'J', 'J', 'J', }, // keyp '-'
// { VK_DIVIDE, TRUE,'N', 'N', 'N', 'N', }, // keyp '/'
{ VK_MULTIPLY, TRUE,'7', '7', '7', '7', }, // keyp '*'
{ VK_NUMPAD0,TRUE, '\332', '\333', '\334', '\335', },
{ VK_NUMPAD1,TRUE, '\336', '\337', '\340', '\341', },
{ VK_NUMPAD2,TRUE, '\342', '\343', '\344', '\345', },
{ VK_NUMPAD3,TRUE, '\346', '\347', '\350', '\351', },
{ VK_NUMPAD4,TRUE, '\352', '\353', '\354', '\355', },
{ VK_NUMPAD5,TRUE, '\356', '\357', '\360', '\361', },
{ VK_NUMPAD6,TRUE, '\362', '\363', '\364', '\365', },
{ VK_NUMPAD7,TRUE, '\366', '\367', '\370', '\371', },
{ VK_NUMPAD8,TRUE, '\372', '\373', '\374', '\375', },
// Sorry, out of number space! <negri>
{ VK_NUMPAD9,TRUE, '\376', '\377', '\377', '\367', },
{ VK_NUMPAD0,TRUE, 0xda, 0xdb, 0xdc, 0xdd, },
{ VK_NUMPAD1,TRUE, 0xde, 0xdf, 0xe0, 0xe1, },
{ VK_NUMPAD2,TRUE, 0xe2, 0xe3, 0xe4, 0xe5, },
{ VK_NUMPAD3,TRUE, 0xe6, 0xe7, 0xe8, 0xe9, },
{ VK_NUMPAD4,TRUE, 0xea, 0xeb, 0xec, 0xed, },
{ VK_NUMPAD5,TRUE, 0xee, 0xef, 0xf0, 0xf1, },
{ VK_NUMPAD6,TRUE, 0xf2, 0xf3, 0xf4, 0xf5, },
{ VK_NUMPAD7,TRUE, 0xf6, 0xf7, 0xf8, 0xf9, },
{ VK_NUMPAD8,TRUE, 0xfa, 0xfb, 0xfc, 0xfd, },
/* Sorry, out of number space! <negri>*/
{ VK_NUMPAD9,TRUE, 0xfe, 0xff, 0xff, 0xf7, },
};
@@ -1909,11 +1915,24 @@ mch_inchar(
typeahead[typeaheadlen] = c;
if (ch2 != NUL)
{
if (c == K_NUL && (ch2 & 0xff00) != 0)
if (c == K_NUL)
{
/* fAnsiKey with modifier keys */
typeahead[typeaheadlen + n] = (char_u)ch2;
n++;
switch (ch2)
{
case (WCHAR)'\324': // SHIFT+Insert
case (WCHAR)'\325': // CTRL+Insert
case (WCHAR)'\327': // SHIFT+Delete
case (WCHAR)'\330': // CTRL+Delete
typeahead[typeaheadlen + n] = (char_u)ch2;
n++;
break;
default:
typeahead[typeaheadlen + n] = 3;
typeahead[typeaheadlen + n + 1] = (char_u)ch2;
n += 2;
break;
}
}
else
{
@@ -3530,21 +3549,44 @@ mch_can_exe(char_u *name, char_u **path, int use_path)
{
char_u buf[_MAX_PATH];
int len = (int)STRLEN(name);
char_u *p;
char_u *p, *saved;
if (len >= _MAX_PATH) /* safety check */
return FALSE;
/* If there already is an extension try using the name directly. Also do
* this with a Unix-shell like 'shell'. */
if (vim_strchr(gettail(name), '.') != NULL
|| strstr((char *)gettail(p_sh), "sh") != NULL)
/* Ty using the name directly when a Unix-shell like 'shell'. */
if (strstr((char *)gettail(p_sh), "sh") != NULL)
if (executable_exists((char *)name, path, use_path))
return TRUE;
/*
* Loop over all extensions in $PATHEXT.
*/
p = mch_getenv("PATHEXT");
if (p == NULL)
p = (char_u *)".com;.exe;.bat;.cmd";
saved = vim_strsave(p);
if (saved == NULL)
return FALSE;
p = saved;
while (*p)
{
char_u *tmp = vim_strchr(p, ';');
if (tmp != NULL)
*tmp = NUL;
if (_stricoll((char *)name + len - STRLEN(p), (char *)p) == 0
&& executable_exists((char *)name, path, use_path))
{
vim_free(saved);
return TRUE;
}
if (tmp == NULL)
break;
p = tmp + 1;
}
vim_free(saved);
vim_strncpy(buf, name, _MAX_PATH - 1);
p = mch_getenv("PATHEXT");
if (p == NULL)
+1 -1
View File
@@ -5,7 +5,7 @@ char_u *get_inserted(void);
int stuff_empty(void);
int readbuf1_empty(void);
void typeahead_noflush(int c);
void flush_buffers(int flush_typeahead);
void flush_buffers(flush_buffers_T flush_typeahead);
void ResetRedobuff(void);
void CancelRedo(void);
void saveRedobuff(save_redo_T *save_redo);
+523 -601
View File
File diff suppressed because it is too large Load Diff
+4 -2
View File
@@ -9,8 +9,10 @@ XXDPROG = ../xxd/xxd
SCRIPTSOURCE = ../../runtime
# Change this to empty to see the verbose output of tests.
REDIR_TEST_TO_NULL = > /dev/null
# Comment out this line to see the verbose output of tests.
#
# Catches SwapExists to avoid hanging at the ATTENTION prompt.
REDIR_TEST_TO_NULL = --cmd 'au SwapExists * let v:swapchoice = "e"' > /dev/null
# Uncomment this line to use valgrind for memory leaks and extra warnings.
# The output goes into a file "valgrind.testN"
+14
View File
@@ -57,6 +57,19 @@ else
set encoding=latin1
endif
" REDIR_TEST_TO_NULL has a very permissive SwapExists autocommand which is for
" the test_name.vim file itself. Replace it here with a more restrictive one,
" so we still catch mistakes.
let s:test_script_fname = expand('%')
au! SwapExists * call HandleSwapExists()
func HandleSwapExists()
" Only ignore finding a swap file for the test script (the user might be
" editing it and do ":make test_name") and the output file.
if expand('<afile>') == 'messages' || expand('<afile>') =~ s:test_script_fname
let v:swapchoice = 'e'
endif
endfunc
" Avoid stopping at the "hit enter" prompt
set nomore
@@ -146,6 +159,7 @@ func RunTheTest(test)
" Clear any autocommands
au!
au SwapExists * call HandleSwapExists()
" Close any extra tab pages and windows and make the current one not modified.
while tabpagenr('$') > 1
+8
View File
@@ -152,6 +152,14 @@ func Test_assert_fail_fails()
call assert_equal(1, assert_fails('xxx', {}))
call assert_match("Expected {} but got 'E731:", v:errors[0])
call remove(v:errors, 0)
call assert_equal(1, assert_fails('xxx', {}, 'stupid'))
call assert_match("stupid: Expected {} but got 'E731:", v:errors[0])
call remove(v:errors, 0)
call assert_equal(1, assert_fails('echo', '', 'echo command'))
call assert_match("command did not fail: echo command", v:errors[0])
call remove(v:errors, 0)
endfunc
func Test_assert_beeps()
+16
View File
@@ -1721,6 +1721,22 @@ func Test_read_from_terminated_job()
call WaitForAssert({-> assert_equal(1, g:linecount)})
endfunc
func Test_job_start_windows()
if !has('job') || !has('win32')
return
endif
" Check that backslash in $COMSPEC is handled properly.
let g:echostr = ''
let cmd = $COMSPEC . ' /c echo 123'
let job = job_start(cmd, {'callback': {ch,msg -> execute(":let g:echostr .= msg")}})
let info = job_info(job)
call assert_equal([$COMSPEC, '/c', 'echo', '123'], info.cmd)
call WaitForAssert({-> assert_equal("123", g:echostr)})
unlet g:echostr
endfunc
func Test_env()
if !has('job')
return
+22
View File
@@ -277,6 +277,28 @@ func Test_dp_do_buffer()
%bwipe!
endfunc
func Test_do_lastline()
e! one
call setline(1, ['1','2','3','4','5','6'])
diffthis
new two
call setline(1, ['2','4','5'])
diffthis
1
norm dp]c
norm dp]c
wincmd w
call assert_equal(4, line('$'))
norm G
norm do
call assert_equal(3, line('$'))
windo diffoff
%bwipe!
endfunc
func Test_diffoff()
enew!
call setline(1, ['Two', 'Three'])
+13
View File
@@ -74,3 +74,16 @@ func Test_filter_cmd_completion()
call assert_equal('filter /pat/ print', s:complete_filter_cmd('filter /pat/ pri'))
call assert_equal('filter #pat# print', s:complete_filter_cmd('filter #pat# pri'))
endfunc
func Test_filter_cmd_with_filter()
new
set shelltemp
%!echo "a|b"
let out = getline(1)
bw!
if has('win32')
let out = trim(out, '" ')
endif
call assert_equal('a|b', out)
set shelltemp&
endfunction
+59
View File
@@ -190,6 +190,52 @@ func Test_strftime()
call assert_fails('call strftime("%Y", [])', 'E745:')
endfunc
func Test_resolve()
if !has('unix')
return
endif
" Xlink1 -> Xlink2
" Xlink2 -> Xlink3
silent !ln -s -f Xlink2 Xlink1
silent !ln -s -f Xlink3 Xlink2
call assert_equal('Xlink3', resolve('Xlink1'))
call assert_equal('./Xlink3', resolve('./Xlink1'))
call assert_equal('Xlink3/', resolve('Xlink2/'))
" FIXME: these tests result in things like "Xlink2/" instead of "Xlink3/"?!
"call assert_equal('Xlink3/', resolve('Xlink1/'))
"call assert_equal('./Xlink3/', resolve('./Xlink1/'))
"call assert_equal(getcwd() . '/Xlink3/', resolve(getcwd() . '/Xlink1/'))
call assert_equal(getcwd() . '/Xlink3', resolve(getcwd() . '/Xlink1'))
" Test resolve() with a symlink cycle.
" Xlink1 -> Xlink2
" Xlink2 -> Xlink3
" Xlink3 -> Xlink1
silent !ln -s -f Xlink1 Xlink3
call assert_fails('call resolve("Xlink1")', 'E655:')
call assert_fails('call resolve("./Xlink1")', 'E655:')
call assert_fails('call resolve("Xlink2")', 'E655:')
call assert_fails('call resolve("Xlink3")', 'E655:')
call delete('Xlink1')
call delete('Xlink2')
call delete('Xlink3')
silent !ln -s -f Xdir//Xfile Xlink
call assert_equal('Xdir/Xfile', resolve('Xlink'))
call delete('Xlink')
silent !ln -s -f Xlink2/ Xlink1
call assert_equal('Xlink2', resolve('Xlink1'))
call assert_equal('Xlink2/', resolve('Xlink1/'))
call delete('Xlink1')
silent !ln -s -f ./Xlink2 Xlink1
call assert_equal('Xlink2', resolve('Xlink1'))
call assert_equal('./Xlink2', resolve('./Xlink1'))
call delete('Xlink1')
endfunc
func Test_simplify()
call assert_equal('', simplify(''))
call assert_equal('/', simplify('/'))
@@ -800,6 +846,19 @@ func Test_filewritable()
bw!
endfunc
func Test_Executable()
if has('win32')
call assert_equal(1, executable('notepad'))
call assert_equal(1, executable('notepad.exe'))
call assert_equal(0, executable('notepad.exe.exe'))
call assert_equal(0, executable('shell32.dll'))
call assert_equal(0, executable('win.ini'))
elseif has('unix')
call assert_equal(1, executable('cat'))
call assert_equal(0, executable('nodogshere'))
endif
endfunc
func Test_hostname()
let hostname_vim = hostname()
if has('unix')
+34
View File
@@ -807,6 +807,40 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
468,
/**/
467,
/**/
466,
/**/
465,
/**/
464,
/**/
463,
/**/
462,
/**/
461,
/**/
460,
/**/
459,
/**/
458,
/**/
457,
/**/
456,
/**/
455,
/**/
454,
/**/
453,
/**/
452,
/**/
451,
/**/
+7
View File
@@ -2110,6 +2110,13 @@ typedef enum {
PASTE_ONE_CHAR /* return first character */
} paste_mode_T;
// Argument for flush_buffers().
typedef enum {
FLUSH_MINIMAL,
FLUSH_TYPEAHEAD, // flush current typebuf contents
FLUSH_INPUT // flush typebuf and inchar() input
} flush_buffers_T;
#include "ex_cmds.h" /* Ex command defines */
#include "spell.h" /* spell checking stuff */