Compare commits

..

53 Commits

Author SHA1 Message Date
Bjorn Winckler 04f77a4338 Snapshot 71 2013-09-06 18:00:40 +02:00
Bjorn Winckler 7574495bfe Merge branch 'vim' 2013-09-06 17:53:04 +02:00
Björn Winckler 0f3e96b8c5 Merge pull request #33 from Sidnicious/patch-1
Don't double-encode URLs before parsing them
2013-09-06 08:19:24 -07:00
Björn Winckler 52f4da8fe0 Merge pull request #34 from bdesham/patch-1
Use “noremap” in system gvimrc
2013-09-06 08:13:47 -07:00
Bram Moolenaar 25bd5e53f4 Added tag v7-4-022 for changeset 965044860b7f 2013-09-05 21:41:40 +02:00
Bram Moolenaar 842c4dd447 updated for version 7.4.022
Problem:    Deadlock while exiting, because of allocating memory.
Solution:   Do not use gettext() in deathtrap(). (James McCoy)
2013-09-05 21:41:39 +02:00
Bram Moolenaar c33239dbbb Added tag v7-4-021 for changeset c514693882b9 2013-09-05 21:15:44 +02:00
Bram Moolenaar ac58a6bcd4 updated for version 7.4.021
Problem:    NFA regexp: Using \ze in one branch which doesn't match may cause
	    end of another branch to be wrong. (William Fugh)
Solution:   Set end position if it wasn't set yet.
2013-09-05 21:15:44 +02:00
Benjamin Esham 010635f861 Use “noremap” for all other mappings too 2013-09-05 14:47:33 -04:00
Benjamin Esham c972338008 Use “inoremap” for <M-BS> and <D-BS>
As a Mac user I’m used to using Option-Delete to delete to the beginning of the previous word; MacVim sets up this behavior with its gvimrc. But I also like to use Control-W to delete to the beginning of the line. This change makes it possible for these two mappings to coexist without a problem.
2013-09-05 11:51:59 -04:00
Bram Moolenaar e14e2bd1fe Added tag v7-4-020 for changeset c1ae5baa41f4 2013-09-05 16:05:36 +02:00
Bram Moolenaar 4fafaa8b36 updated for version 7.4.020
Problem:    NFA engine matches too much with \@>. (John McGowan)
Solution:   When a whole pattern match is found stop searching.
2013-09-05 16:05:36 +02:00
Bram Moolenaar 1af6c83e0a Added tag v7-4-019 for changeset d5eb32dc231c 2013-09-05 13:50:53 +02:00
Bram Moolenaar 8e2a162bf8 updated for version 7.4.019
Problem:    MS-Windows: File name completion doesn't work properly with
	    Chinese characters. (Yue Wu)
Solution:   Take care of multi-byte characters when looking for the start of
	    the file name. (Ken Takata)
2013-09-05 13:50:53 +02:00
Bram Moolenaar 9297019ba6 Added tag v7-4-018 for changeset 460d5be9395e 2013-09-05 12:49:52 +02:00
Bram Moolenaar 777ae8ac47 updated for version 7.4.018
Problem:    When completing item becomes unselected. (Shougo Matsu)
Solution:   Revert patch 7.3.1269.
2013-09-05 12:49:52 +02:00
Bram Moolenaar 2a951b7156 Added tag v7-4-017 for changeset c47c8cd5fe5c 2013-09-05 12:06:33 +02:00
Bram Moolenaar 4a96bd0f33 updated for version 7.4.017
Problem:    ":help !!" does not find the "!!" tag in the help file. (Ben
	    Fritz)
Solution:   When reading the start of the tags file do parse lines that are
	    not header lines.
2013-09-05 12:06:33 +02:00
Bjorn Winckler c5c6bebf10 Merge branch 'vim' 2013-09-01 12:11:52 +02:00
Bram Moolenaar 3fd86dc03a Added tag v7-4-016 for changeset 8d5cd0ec3e71 2013-08-30 17:29:16 +02:00
Bram Moolenaar 4ff15ba7b6 updated for version 7.4.016
Problem:    MS-Windows: File name completion doesn't work properly with
	    Chinese characters. (Yue Wu)
Solution:   Add fname_casew(). (Ken Takata)
2013-08-30 17:29:16 +02:00
Bram Moolenaar abfb2163cb Added tag v7-4-015 for changeset a7478f9f2551 2013-08-30 17:11:33 +02:00
Bram Moolenaar aa8c48fe55 updated for version 7.4.015
Problem:    MS-Windows: Detecting node type does not work for multi-byte
	    characters.
Solution:   Use wide character function when needed. (Ken Takata)
2013-08-30 17:11:33 +02:00
Bram Moolenaar a573223877 Added tag v7-4-014 for changeset 9801d06e7b4c 2013-08-30 17:07:02 +02:00
Bram Moolenaar c643a48c39 updated for version 7.4.014
Problem:    MS-Windows: check for writing to device does not work.
Solution:   Fix #ifdefs. (Ken Takata)
2013-08-30 17:07:01 +02:00
Bram Moolenaar 5dcb84635f Added tag v7-4-013 for changeset 07737d3aa817 2013-08-30 16:51:19 +02:00
Bram Moolenaar be17bc2cc2 updated for version 7.4.013
Problem:    File name buffer too small for utf-8.
Solution:   Use character count instead of byte count. (Ken Takata)
2013-08-30 16:51:18 +02:00
Bram Moolenaar d7d89c9cad Added tag v7-4-012 for changeset 8e28c23e482c 2013-08-30 16:44:19 +02:00
Bram Moolenaar 554e2eab32 updated for version 7.4.012
Problem:    MS-Windows: resolving shortcut does not work properly with
	    multi-byte characters.
Solution:   Use wide system functions. (Ken Takata)
2013-08-30 16:44:19 +02:00
Bram Moolenaar 9eb60f358e Added tag v7-4-011 for changeset 54e66395831c 2013-08-30 16:35:45 +02:00
Bram Moolenaar cabbc20d87 updated for version 7.4.011
Problem:    Cannot find out if "acl" and "xpm" features are supported.
Solution:   Add "acl" and "xpm" to the list of features. (Ken Takata)
2013-08-30 16:35:44 +02:00
Bram Moolenaar 581b7aaaf9 Added tag v7-4-010 for changeset bb358cc41d92 2013-08-30 16:00:09 +02:00
Bram Moolenaar 35a70f5453 updated for version 7.4.010
Problem:    Crash with invalid argument to mkdir().
Solution:   Check for empty string. (lcd47)
2013-08-30 16:00:08 +02:00
Bram Moolenaar 3283d2bbe4 Added tag v7-4-009 for changeset 8b5d80861c5e 2013-08-25 17:46:08 +02:00
Bram Moolenaar cbeea0f01b updated for version 7.4.009
Problem:    When a file was not decrypted (yet), writing it may destroy the
	    contents.
Solution:   Mark the file as readonly until decryption was done. (Christian
	    Brabandt)
2013-08-25 17:46:08 +02:00
Bram Moolenaar 335193bd5a Added tag v7-4-008 for changeset b04bdb2c5fce 2013-08-25 17:01:42 +02:00
Bram Moolenaar 0d8dfc45e3 updated for version 7.4.008
Problem:    New regexp engine can't be interrupted.
Solution:   Check for CTRL-C pressed. (Yasuhiro Matsumoto)
2013-08-25 17:01:42 +02:00
Bjorn Winckler 6e441ac7a6 Merge branch 'vim' 2013-08-23 14:43:18 +02:00
Bram Moolenaar 320b379bb2 Added tag v7-4-007 for changeset 4fe1dfc7014e 2013-08-22 14:14:27 +02:00
Bram Moolenaar 56f7bc13ff updated for version 7.4.007
Problem:    Creating a preview window on startup leaves the screen layout in a
	    messed up state. (Marius Gedminas)
Solution:   Don't change firstwin. (Christian Brabandt)
2013-08-22 14:14:27 +02:00
Bram Moolenaar d2935a0ed5 Added tag v7-4-006 for changeset 2374a05efe20 2013-08-22 12:06:56 +02:00
Bram Moolenaar 967d2256bc updated for version 7.4.006
Problem:    mkdir("foo/bar/", "p") gives an error message. (David Barnett)
Solution:   Remove the trailing slash. (lcd)
2013-08-22 12:06:55 +02:00
Bram Moolenaar b062f605aa Added tag v7-4-005 for changeset 3640cf4c0d4b 2013-08-14 17:45:29 +02:00
Bram Moolenaar bb1064ee26 updated for version 7.4.005
Problem:    Using "vaB" while 'virtualedit' is set selects the wrong area.
	    (Dimitar Dimitrov)
Solution:   Reset coladd when finding a match.
2013-08-14 17:45:29 +02:00
Bram Moolenaar de6127d9b4 Added tag v7-4-004 for changeset f6247eaf4e1d 2013-08-14 17:11:20 +02:00
Bram Moolenaar aedeb427ba updated for version 7.4.004
Problem:    When closing a window fails ":bwipe" may hang.
Solution:   Let win_close() return FAIL and break out of the loop.
2013-08-14 17:11:20 +02:00
Bram Moolenaar 00534f3d3f Added tag v7-4-003 for changeset 560a6a232950 2013-08-14 14:18:41 +02:00
Bram Moolenaar d14db7f619 updated for version 7.4.003
Problem:    Memory access error in Ruby syntax highlighting. (Christopher Chow)
Solution:   Refresh stale pointer. (James McCoy)
2013-08-14 14:18:40 +02:00
Bram Moolenaar c49e96b843 Added tag v7-4-002 for changeset e29f11399cce 2013-08-14 13:34:25 +02:00
Bram Moolenaar 308f3c53c5 updated for version 7.4.002
Problem:    Pattern with two alternative look-behind matches does not match.
	    (Amadeus Demarzi)
Solution:   When comparing PIMs also compare their state ID to see if they are
	    different.
2013-08-14 13:34:25 +02:00
Bram Moolenaar d3e0994de9 Added tag v7-4-001 for changeset 3e9107b86b68 2013-08-14 12:06:49 +02:00
Bram Moolenaar 960c71130d updated for version 7.4.001
Problem:    Character classes such as [a-z] to not react to 'ignorecase'.
	    Breaks man page highlighting. (Mario Grgic)
Solution:   Add separate items for classes that react to 'ignorecase'.  Clean
	    up logic handling character classes.  Add more tests.
2013-08-14 12:06:49 +02:00
Sidney San Martín fe5039c278 Don't double-encode URLs before parsing them
<https://code.google.com/p/macvim/issues/detail?id=316> wasn't a bug.

When you're constructing a URL, you *should* end up escaping URL-unsafe
characters twice: once for the `file:` URL and once for the `mvim:` URL.
Escaping it inside MacVim breaks legit URLs with escapes at the `mvim:` level.
2013-07-17 14:26:49 -04:00
23 changed files with 653 additions and 146 deletions
+22
View File
@@ -2723,3 +2723,25 @@ ba37e955913e85700677b89a720c6e5fc8d23cc3 v7-4b-016
059c8a4b103f6971276435127c7ad970a81b0b2c v7-4b-021
d5d6b78cff090e87d52924179e44131b5ba7436d v7-4b-022
359743c1f59af353454dd80a26d9f8c20ae6ee8e v7-4
3e9107b86b68d83bfa94e43afffbf17623afe55e v7-4-001
e29f11399ccec9215cc8cfab1f9307dea0567d70 v7-4-002
560a6a2329503d483db019a88cacc3307e5c30b7 v7-4-003
f6247eaf4e1d556f782321890d725663f74babe6 v7-4-004
3640cf4c0d4b6e5687bb7a31678fab70c88ed94b v7-4-005
2374a05efe20287d55bd824689a41becc7662505 v7-4-006
4fe1dfc7014e57b4beb5a01c9e94357265d19a92 v7-4-007
b04bdb2c5fce70a278d26c477debb65a388da0ca v7-4-008
8b5d80861c5e0403ea9f54ddddce2752a463c8a5 v7-4-009
bb358cc41d920983629ace62bcf26decbf06cab4 v7-4-010
54e66395831c1a58b4a9804e7884e505842157e8 v7-4-011
8e28c23e482c5b3c8296d8022271822886793456 v7-4-012
07737d3aa81725672796cbc9a010d63414ab6fea v7-4-013
9801d06e7b4ccdcd02cf40bee34eaaada0ca0409 v7-4-014
a7478f9f2551e95bff138cd658f7a86ced804ab1 v7-4-015
8d5cd0ec3e7183a289f9bac41d3981307cdc1fac v7-4-016
c47c8cd5fe5c014c141d9fb3fa8935b268436a4e v7-4-017
460d5be9395ef3e05f4b1397ea98a5b54d825fc5 v7-4-018
d5eb32dc231cd870c562e7b0be96fa994b505d9f v7-4-019
c1ae5baa41f47bbf96be81e0158707a88af48b34 v7-4-020
c514693882b9f1c7be2e76a0307926df799da3ea v7-4-021
965044860b7f4884657fcaa042853238c7b13e69 v7-4-022
+1 -1
View File
@@ -1232,7 +1232,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>70</string>
<string>71</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
+3 -6
View File
@@ -1659,12 +1659,9 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
- (void)handleGetURLEvent:(NSAppleEventDescriptor *)event
replyEvent:(NSAppleEventDescriptor *)reply
{
NSString *urlString = [[event paramDescriptorForKeyword:keyDirectObject]
stringValue];
// NOTE: URLWithString requires string to be percent escaped.
urlString = [urlString stringByAddingPercentEscapesUsingEncoding:
NSUTF8StringEncoding];
NSURL *url = [NSURL URLWithString:urlString];
NSURL *url = [NSURL URLWithString:[[event
paramDescriptorForKeyword:keyDirectObject]
stringValue]];
// We try to be compatible with TextMate's URL scheme here, as documented
// at http://blog.macromates.com/2007/the-textmate-url-scheme/ . Currently,
+2 -2
View File
@@ -614,7 +614,7 @@
buildSettings = {
ARCHS = "$(NATIVE_ARCH_ACTUAL)";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 70;
CURRENT_PROJECT_VERSION = 71;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
@@ -645,7 +645,7 @@
buildSettings = {
ARCHS = "$(NATIVE_ARCH_ACTUAL)";
COPY_PHASE_STRIP = YES;
CURRENT_PROJECT_VERSION = 70;
CURRENT_PROJECT_VERSION = 71;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
+6 -6
View File
@@ -55,16 +55,16 @@ if !exists("macvim_skip_cmd_opt_movement")
no <D-Up> <C-Home>
ino <D-Up> <C-Home>
map <M-Up> {
imap <M-Up> <C-o>{
no <M-Up> {
ino <M-Up> <C-o>{
no <D-Down> <C-End>
ino <D-Down> <C-End>
map <M-Down> }
imap <M-Down> <C-o>}
no <M-Down> }
ino <M-Down> <C-o>}
imap <M-BS> <C-w>
imap <D-BS> <C-u>
ino <M-BS> <C-w>
ino <D-BS> <C-u>
endif " !exists("macvim_skip_cmd_opt_movement")
+4 -1
View File
@@ -1190,7 +1190,10 @@ do_buffer(action, start, dir, count, forceit)
&& !(curwin->w_closing || curwin->w_buffer->b_closing)
# endif
&& (firstwin != lastwin || first_tabpage->tp_next != NULL))
win_close(curwin, FALSE);
{
if (win_close(curwin, FALSE) == FAIL)
break;
}
#endif
/*
+8 -3
View File
@@ -3477,7 +3477,6 @@ ins_compl_new_leader()
}
compl_enter_selects = !compl_used_match;
compl_shown_match = compl_curr_match = compl_first_match;
/* Show the popup menu with a different set of matches. */
ins_compl_show_pum();
@@ -5199,8 +5198,14 @@ ins_complete(c)
}
else if (ctrl_x_mode == CTRL_X_FILES)
{
while (--startcol >= 0 && vim_isfilec(line[startcol]))
;
char_u *p = line + startcol;
/* Go back to just before the first filename character. */
mb_ptr_back(line, p);
while (vim_isfilec(PTR2CHAR(p)) && p >= line)
mb_ptr_back(line, p);
startcol = p - line;
compl_col += ++startcol;
compl_length = (int)curs_col - startcol;
compl_pattern = addstar(line + compl_col, compl_length,
+24 -7
View File
@@ -12143,6 +12143,9 @@ f_has(argvars, rettv)
#ifndef CASE_INSENSITIVE_FILENAME
"fname_case",
#endif
#ifdef HAVE_ACL
"acl",
#endif
#ifdef FEAT_ARABIC
"arabic",
#endif
@@ -12558,7 +12561,12 @@ f_has(argvars, rettv)
"xfontset",
#endif
#ifdef FEAT_XPM_W32
"xpm_w32",
"xpm",
"xpm_w32", /* for backward compatibility */
#else
# if defined(HAVE_XPM)
"xpm",
# endif
#endif
#ifdef USE_XSMP
"xsmp",
@@ -14312,14 +14320,23 @@ f_mkdir(argvars, rettv)
return;
dir = get_tv_string_buf(&argvars[0], buf);
if (argvars[1].v_type != VAR_UNKNOWN)
if (*dir == NUL)
rettv->vval.v_number = FAIL;
else
{
if (argvars[2].v_type != VAR_UNKNOWN)
prot = get_tv_number_chk(&argvars[2], NULL);
if (prot != -1 && STRCMP(get_tv_string(&argvars[1]), "p") == 0)
mkdir_recurse(dir, prot);
if (*gettail(dir) == NUL)
/* remove trailing slashes */
*gettail_sep(dir) = NUL;
if (argvars[1].v_type != VAR_UNKNOWN)
{
if (argvars[2].v_type != VAR_UNKNOWN)
prot = get_tv_number_chk(&argvars[2], NULL);
if (prot != -1 && STRCMP(get_tv_string(&argvars[1]), "p") == 0)
mkdir_recurse(dir, prot);
}
rettv->vval.v_number = prot == -1 ? FAIL : vim_mkdir_emsg(dir, prot);
}
rettv->vval.v_number = prot != -1 ? vim_mkdir_emsg(dir, prot) : 0;
}
#endif
+15 -9
View File
@@ -428,13 +428,13 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags)
}
}
#ifdef UNIX
/*
* On Unix it is possible to read a directory, so we have to
* check for it before the mch_open().
*/
if (!read_stdin && !read_buffer)
{
#ifdef UNIX
/*
* On Unix it is possible to read a directory, so we have to
* check for it before the mch_open().
*/
perm = mch_getperm(fname);
if (perm >= 0 && !S_ISREG(perm) /* not a regular file ... */
# ifdef S_ISFIFO
@@ -457,8 +457,8 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags)
msg_scroll = msg_save;
return FAIL;
}
# if defined(MSDOS) || defined(MSWIN) || defined(OS2)
#endif
#if defined(MSDOS) || defined(MSWIN) || defined(OS2)
/*
* MS-Windows allows opening a device, but we will probably get stuck
* trying to read it.
@@ -470,9 +470,8 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags)
msg_scroll = msg_save;
return FAIL;
}
# endif
}
#endif
}
/* Set default or forced 'fileformat' and 'binary'. */
set_file_options(set_options, eap);
@@ -2926,9 +2925,14 @@ check_for_cryptkey(cryptkey, ptr, sizep, filesizep, newfile, fname, did_ask)
int *did_ask; /* flag: whether already asked for key */
{
int method = crypt_method_from_magic((char *)ptr, *sizep);
int b_p_ro = curbuf->b_p_ro;
if (method >= 0)
{
/* Mark the buffer as read-only until the decryption has taken place.
* Avoids accidentally overwriting the file with garbage. */
curbuf->b_p_ro = TRUE;
set_crypt_method(curbuf, method);
if (method > 0)
(void)blowfish_self_test();
@@ -2977,6 +2981,8 @@ check_for_cryptkey(cryptkey, ptr, sizep, filesizep, newfile, fname, did_ask)
*sizep -= CRYPT_MAGIC_LEN + salt_len + seed_len;
mch_memmove(ptr, ptr + CRYPT_MAGIC_LEN + salt_len + seed_len,
(size_t)*sizep);
/* Restore the read-only flag. */
curbuf->b_p_ro = b_p_ro;
}
}
/* When starting to edit a new file which does not have encryption, clear
+14 -15
View File
@@ -2816,6 +2816,7 @@ edit_buffers(parmp)
int arg_idx; /* index in argument list */
int i;
int advance = TRUE;
win_T *win;
# ifdef FEAT_AUTOCMD
/*
@@ -2905,24 +2906,22 @@ edit_buffers(parmp)
# ifdef FEAT_AUTOCMD
--autocmd_no_enter;
# endif
#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
/*
* Avoid making a preview window the current window.
*/
if (firstwin->w_p_pvw)
{
win_T *win;
for (win = firstwin; win != NULL; win = win->w_next)
if (!win->w_p_pvw)
{
firstwin = win;
break;
}
/* make the first window the current window */
win = firstwin;
#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
/* Avoid making a preview window the current window. */
while (win->w_p_pvw)
{
win = win->w_next;
if (win == NULL)
{
win = firstwin;
break;
}
}
#endif
/* make the first window the current window */
win_enter(firstwin, FALSE);
win_enter(win, FALSE);
# ifdef FEAT_AUTOCMD
--autocmd_no_leave;
+4 -2
View File
@@ -9180,6 +9180,8 @@ prepare_to_exit()
/*
* Preserve files and exit.
* When called IObuff must contain a message.
* NOTE: This may be called from deathtrap() in a signal handler, avoid unsafe
* functions, such as allocating memory.
*/
void
preserve_exit()
@@ -9202,7 +9204,7 @@ preserve_exit()
{
if (buf->b_ml.ml_mfp != NULL && buf->b_ml.ml_mfp->mf_fname != NULL)
{
OUT_STR(_("Vim: preserving files...\n"));
OUT_STR("Vim: preserving files...\n");
screen_start(); /* don't know where cursor is now */
out_flush();
ml_sync_all(FALSE, FALSE); /* preserve all swap files */
@@ -9212,7 +9214,7 @@ preserve_exit()
ml_close_all(FALSE); /* close all memfiles, without deleting */
OUT_STR(_("Vim: Finished.\n"));
OUT_STR("Vim: Finished.\n");
getout(1);
}
+76 -10
View File
@@ -456,7 +456,14 @@ mch_FullName(
int
mch_isFullName(char_u *fname)
{
#ifdef FEAT_MBYTE
/* WinNT and later can use _MAX_PATH wide characters for a pathname, which
* means that the maximum pathname is _MAX_PATH * 3 bytes when 'enc' is
* UTF-8. */
char szName[_MAX_PATH * 3 + 1];
#else
char szName[_MAX_PATH + 1];
#endif
/* A name like "d:/foo" and "//server/share" is absolute */
if ((fname[0] && fname[1] == ':' && (fname[2] == '/' || fname[2] == '\\'))
@@ -464,7 +471,7 @@ mch_isFullName(char_u *fname)
return TRUE;
/* A name that can't be made absolute probably isn't absolute. */
if (mch_FullName(fname, szName, _MAX_PATH, FALSE) == FAIL)
if (mch_FullName(fname, szName, sizeof(szName) - 1, FALSE) == FAIL)
return FALSE;
return pathcmp(fname, szName, -1) == 0;
@@ -498,10 +505,17 @@ slash_adjust(p)
int
vim_stat(const char *name, struct stat *stp)
{
#ifdef FEAT_MBYTE
/* WinNT and later can use _MAX_PATH wide characters for a pathname, which
* means that the maximum pathname is _MAX_PATH * 3 bytes when 'enc' is
* UTF-8. */
char buf[_MAX_PATH * 3 + 1];
#else
char buf[_MAX_PATH + 1];
#endif
char *p;
vim_strncpy((char_u *)buf, (char_u *)name, _MAX_PATH);
vim_strncpy((char_u *)buf, (char_u *)name, sizeof(buf) - 1);
p = buf + strlen(buf);
if (p > buf)
mb_ptr_back(buf, p);
@@ -1761,9 +1775,13 @@ mch_resolve_shortcut(char_u *fname)
IPersistFile *ppf = NULL;
OLECHAR wsz[MAX_PATH];
WIN32_FIND_DATA ffd; // we get those free of charge
TCHAR buf[MAX_PATH]; // could have simply reused 'wsz'...
CHAR buf[MAX_PATH]; // could have simply reused 'wsz'...
char_u *rfname = NULL;
int len;
# ifdef FEAT_MBYTE
IShellLinkW *pslw = NULL;
WIN32_FIND_DATAW ffdw; // we get those free of charge
# endif
/* Check if the file name ends in ".lnk". Avoid calling
* CoCreateInstance(), it's quite slow. */
@@ -1775,18 +1793,62 @@ mch_resolve_shortcut(char_u *fname)
CoInitialize(NULL);
# ifdef FEAT_MBYTE
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
{
// create a link manager object and request its interface
hr = CoCreateInstance(
&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
&IID_IShellLinkW, (void**)&pslw);
if (hr == S_OK)
{
WCHAR *p = enc_to_utf16(fname, NULL);
if (p != NULL)
{
// Get a pointer to the IPersistFile interface.
hr = pslw->lpVtbl->QueryInterface(
pslw, &IID_IPersistFile, (void**)&ppf);
if (hr != S_OK)
goto shortcut_errorw;
// "load" the name and resolve the link
hr = ppf->lpVtbl->Load(ppf, p, STGM_READ);
if (hr != S_OK)
goto shortcut_errorw;
# if 0 // This makes Vim wait a long time if the target does not exist.
hr = pslw->lpVtbl->Resolve(pslw, NULL, SLR_NO_UI);
if (hr != S_OK)
goto shortcut_errorw;
# endif
// Get the path to the link target.
ZeroMemory(wsz, MAX_PATH * sizeof(WCHAR));
hr = pslw->lpVtbl->GetPath(pslw, wsz, MAX_PATH, &ffdw, 0);
if (hr == S_OK && wsz[0] != NUL)
rfname = utf16_to_enc(wsz, NULL);
shortcut_errorw:
vim_free(p);
if (hr == S_OK)
goto shortcut_end;
}
}
/* Retry with non-wide function (for Windows 98). */
}
# endif
// create a link manager object and request its interface
hr = CoCreateInstance(
&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
&IID_IShellLink, (void**)&psl);
if (hr != S_OK)
goto shortcut_error;
goto shortcut_end;
// Get a pointer to the IPersistFile interface.
hr = psl->lpVtbl->QueryInterface(
psl, &IID_IPersistFile, (void**)&ppf);
if (hr != S_OK)
goto shortcut_error;
goto shortcut_end;
// full path string must be in Unicode.
MultiByteToWideChar(CP_ACP, 0, fname, -1, wsz, MAX_PATH);
@@ -1794,12 +1856,12 @@ mch_resolve_shortcut(char_u *fname)
// "load" the name and resolve the link
hr = ppf->lpVtbl->Load(ppf, wsz, STGM_READ);
if (hr != S_OK)
goto shortcut_error;
#if 0 // This makes Vim wait a long time if the target doesn't exist.
goto shortcut_end;
# if 0 // This makes Vim wait a long time if the target doesn't exist.
hr = psl->lpVtbl->Resolve(psl, NULL, SLR_NO_UI);
if (hr != S_OK)
goto shortcut_error;
#endif
goto shortcut_end;
# endif
// Get the path to the link target.
ZeroMemory(buf, MAX_PATH);
@@ -1807,12 +1869,16 @@ mch_resolve_shortcut(char_u *fname)
if (hr == S_OK && buf[0] != NUL)
rfname = vim_strsave(buf);
shortcut_error:
shortcut_end:
// Release all interface pointers (both belong to the same object)
if (ppf != NULL)
ppf->lpVtbl->Release(ppf);
if (psl != NULL)
psl->lpVtbl->Release(psl);
# ifdef FEAT_MBYTE
if (pslw != NULL)
pslw->lpVtbl->Release(pslw);
# endif
CoUninitialize();
return rfname;
+12 -5
View File
@@ -957,8 +957,10 @@ mch_didjmp()
/*
* This function handles deadly signals.
* It tries to preserve any swap file and exit properly.
* It tries to preserve any swap files and exit properly.
* (partly from Elvis).
* NOTE: Avoid unsafe functions, such as allocating memory, they can result in
* a deadlock.
*/
static RETSIGTYPE
deathtrap SIGDEFARG(sigarg)
@@ -1090,18 +1092,23 @@ deathtrap SIGDEFARG(sigarg)
}
if (entered == 2)
{
OUT_STR(_("Vim: Double signal, exiting\n"));
/* No translation, it may call malloc(). */
OUT_STR("Vim: Double signal, exiting\n");
out_flush();
getout(1);
}
/* No translation, it may call malloc(). */
#ifdef SIGHASARG
sprintf((char *)IObuff, _("Vim: Caught deadly signal %s\n"),
sprintf((char *)IObuff, "Vim: Caught deadly signal %s\n",
signal_info[i].name);
#else
sprintf((char *)IObuff, _("Vim: Caught deadly signal\n"));
sprintf((char *)IObuff, "Vim: Caught deadly signal\n");
#endif
preserve_exit(); /* preserve files and exit */
/* Preserve files and exit. This sets the really_exiting flag to prevent
* calling free(). */
preserve_exit();
#ifdef NBDEBUG
reset_signals();
+187 -8
View File
@@ -2500,9 +2500,125 @@ mch_check_win(
}
#ifdef FEAT_MBYTE
/*
* fname_casew(): Wide version of fname_case(). Set the case of the file name,
* if it already exists. When "len" is > 0, also expand short to long
* filenames.
* Return FAIL if wide functions are not available, OK otherwise.
* NOTE: much of this is identical to fname_case(), keep in sync!
*/
static int
fname_casew(
WCHAR *name,
int len)
{
WCHAR szTrueName[_MAX_PATH + 2];
WCHAR szTrueNameTemp[_MAX_PATH + 2];
WCHAR *ptrue, *ptruePrev;
WCHAR *porig, *porigPrev;
int flen;
WIN32_FIND_DATAW fb;
HANDLE hFind;
int c;
int slen;
flen = (int)wcslen(name);
if (flen > _MAX_PATH)
return OK;
/* slash_adjust(name) not needed, already adjusted by fname_case(). */
/* Build the new name in szTrueName[] one component at a time. */
porig = name;
ptrue = szTrueName;
if (iswalpha(porig[0]) && porig[1] == L':')
{
/* copy leading drive letter */
*ptrue++ = *porig++;
*ptrue++ = *porig++;
*ptrue = NUL; /* in case nothing follows */
}
while (*porig != NUL)
{
/* copy \ characters */
while (*porig == psepc)
*ptrue++ = *porig++;
ptruePrev = ptrue;
porigPrev = porig;
while (*porig != NUL && *porig != psepc)
{
*ptrue++ = *porig++;
}
*ptrue = NUL;
/* To avoid a slow failure append "\*" when searching a directory,
* server or network share. */
wcscpy(szTrueNameTemp, szTrueName);
slen = (int)wcslen(szTrueNameTemp);
if (*porig == psepc && slen + 2 < _MAX_PATH)
wcscpy(szTrueNameTemp + slen, L"\\*");
/* Skip "", "." and "..". */
if (ptrue > ptruePrev
&& (ptruePrev[0] != L'.'
|| (ptruePrev[1] != NUL
&& (ptruePrev[1] != L'.' || ptruePrev[2] != NUL)))
&& (hFind = FindFirstFileW(szTrueNameTemp, &fb))
!= INVALID_HANDLE_VALUE)
{
c = *porig;
*porig = NUL;
/* Only use the match when it's the same name (ignoring case) or
* expansion is allowed and there is a match with the short name
* and there is enough room. */
if (_wcsicoll(porigPrev, fb.cFileName) == 0
|| (len > 0
&& (_wcsicoll(porigPrev, fb.cAlternateFileName) == 0
&& (int)(ptruePrev - szTrueName)
+ (int)wcslen(fb.cFileName) < len)))
{
wcscpy(ptruePrev, fb.cFileName);
/* Look for exact match and prefer it if found. Must be a
* long name, otherwise there would be only one match. */
while (FindNextFileW(hFind, &fb))
{
if (*fb.cAlternateFileName != NUL
&& (wcscoll(porigPrev, fb.cFileName) == 0
|| (len > 0
&& (_wcsicoll(porigPrev,
fb.cAlternateFileName) == 0
&& (int)(ptruePrev - szTrueName)
+ (int)wcslen(fb.cFileName) < len))))
{
wcscpy(ptruePrev, fb.cFileName);
break;
}
}
}
FindClose(hFind);
*porig = c;
ptrue = ptruePrev + wcslen(ptruePrev);
}
else if (hFind == INVALID_HANDLE_VALUE
&& GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
return FAIL;
}
wcscpy(name, szTrueName);
return OK;
}
#endif
/*
* fname_case(): Set the case of the file name, if it already exists.
* When "len" is > 0, also expand short to long filenames.
* NOTE: much of this is identical to fname_casew(), keep in sync!
*/
void
fname_case(
@@ -2520,11 +2636,44 @@ fname_case(
int slen;
flen = (int)STRLEN(name);
if (flen == 0 || flen > _MAX_PATH)
if (flen == 0)
return;
slash_adjust(name);
#ifdef FEAT_MBYTE
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
{
WCHAR *p = enc_to_utf16(name, NULL);
if (p != NULL)
{
char_u *q;
WCHAR buf[_MAX_PATH + 2];
wcscpy(buf, p);
vim_free(p);
if (fname_casew(buf, (len > 0) ? _MAX_PATH : 0) == OK)
{
q = utf16_to_enc(buf, NULL);
if (q != NULL)
{
vim_strncpy(name, q, (len > 0) ? len - 1 : flen);
vim_free(q);
return;
}
}
}
/* Retry with non-wide function (for Windows 98). */
}
#endif
/* If 'enc' is utf-8, flen can be larger than _MAX_PATH.
* So we should check this after calling wide function. */
if (flen > _MAX_PATH)
return;
/* Build the new name in szTrueName[] one component at a time. */
porig = name;
ptrue = szTrueName;
@@ -3107,6 +3256,9 @@ mch_nodetype(char_u *name)
{
HANDLE hFile;
int type;
#ifdef FEAT_MBYTE
WCHAR *wn = NULL;
#endif
/* We can't open a file with a name "\\.\con" or "\\.\prn" and trying to
* read from it later will cause Vim to hang. Thus return NODE_WRITABLE
@@ -3114,14 +3266,41 @@ mch_nodetype(char_u *name)
if (STRNCMP(name, "\\\\.\\", 4) == 0)
return NODE_WRITABLE;
hFile = CreateFile(name, /* file name */
GENERIC_WRITE, /* access mode */
0, /* share mode */
NULL, /* security descriptor */
OPEN_EXISTING, /* creation disposition */
0, /* file attributes */
NULL); /* handle to template file */
#ifdef FEAT_MBYTE
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
{
wn = enc_to_utf16(name, NULL);
if (wn != NULL)
{
hFile = CreateFileW(wn, /* file name */
GENERIC_WRITE, /* access mode */
0, /* share mode */
NULL, /* security descriptor */
OPEN_EXISTING, /* creation disposition */
0, /* file attributes */
NULL); /* handle to template file */
if (hFile == INVALID_HANDLE_VALUE
&& GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
{
/* Retry with non-wide function (for Windows 98). */
vim_free(wn);
wn = NULL;
}
}
}
if (wn == NULL)
#endif
hFile = CreateFile(name, /* file name */
GENERIC_WRITE, /* access mode */
0, /* share mode */
NULL, /* security descriptor */
OPEN_EXISTING, /* creation disposition */
0, /* file attributes */
NULL); /* handle to template file */
#ifdef FEAT_MBYTE
vim_free(wn);
#endif
if (hFile == INVALID_HANDLE_VALUE)
return NODE_NORMAL;
+1 -1
View File
@@ -9,7 +9,7 @@ void win_move_after __ARGS((win_T *win1, win_T *win2));
void win_equal __ARGS((win_T *next_curwin, int current, int dir));
void close_windows __ARGS((buf_T *buf, int keep_curwin));
int one_window __ARGS((void));
void win_close __ARGS((win_T *win, int free_buf));
int win_close __ARGS((win_T *win, int free_buf));
void win_close_othertab __ARGS((win_T *win, int free_buf, tabpage_T *tp));
void win_free_all __ARGS((void));
win_T *winframe_remove __ARGS((win_T *win, int *dirp, tabpage_T *tp));
+2 -2
View File
@@ -4311,8 +4311,8 @@ regmatch(scan)
*/
for (;;)
{
/* Some patterns may cause a long time to match, even though they are not
* illegal. E.g., "\([a-z]\+\)\+Q". Allow breaking them with CTRL-C. */
/* Some patterns may take a long time to match, e.g., "\([a-z]\+\)\+Q".
* Allow interrupting them with CTRL-C. */
fast_breakcheck();
#ifdef DEBUG
+95 -25
View File
@@ -29,6 +29,9 @@
# define NFA_REGEXP_DEBUG_LOG "nfa_regexp_debug.log"
#endif
/* Added to NFA_ANY - NFA_NUPPER_IC to include a NL. */
#define NFA_ADD_NL 31
enum
{
NFA_SPLIT = -1024,
@@ -183,6 +186,13 @@ enum
NFA_NLOWER, /* Match non-lowercase char */
NFA_UPPER, /* Match uppercase char */
NFA_NUPPER, /* Match non-uppercase char */
NFA_LOWER_IC, /* Match [a-z] */
NFA_NLOWER_IC, /* Match [^a-z] */
NFA_UPPER_IC, /* Match [A-Z] */
NFA_NUPPER_IC, /* Match [^A-Z] */
NFA_FIRST_NL = NFA_ANY + NFA_ADD_NL,
NFA_LAST_NL = NFA_NUPPER_IC + NFA_ADD_NL,
NFA_CURSOR, /* Match cursor pos */
NFA_LNUM, /* Match line number */
@@ -199,9 +209,6 @@ enum
NFA_MARK_LT, /* Match < mark */
NFA_VISUAL, /* Match Visual area */
NFA_FIRST_NL = NFA_ANY + ADD_NL,
NFA_LAST_NL = NFA_NUPPER + ADD_NL,
/* Character classes [:alnum:] etc */
NFA_CLASS_ALNUM,
NFA_CLASS_ALPHA,
@@ -578,6 +585,8 @@ realloc_post_list()
* On failure, return 0 (=FAIL)
* Start points to the first char of the range, while end should point
* to the closing brace.
* Keep in mind that 'ignorecase' applies at execution time, thus [a-z] may
* need to be interpreted as [a-zA-Z].
*/
static int
nfa_recognize_char_class(start, end, extra_newl)
@@ -681,7 +690,7 @@ nfa_recognize_char_class(start, end, extra_newl)
return FAIL;
if (newl == TRUE)
extra_newl = ADD_NL;
extra_newl = NFA_ADD_NL;
switch (config)
{
@@ -710,13 +719,13 @@ nfa_recognize_char_class(start, end, extra_newl)
case CLASS_not | CLASS_az | CLASS_AZ:
return extra_newl + NFA_NALPHA;
case CLASS_az:
return extra_newl + NFA_LOWER;
return extra_newl + NFA_LOWER_IC;
case CLASS_not | CLASS_az:
return extra_newl + NFA_NLOWER;
return extra_newl + NFA_NLOWER_IC;
case CLASS_AZ:
return extra_newl + NFA_UPPER;
return extra_newl + NFA_UPPER_IC;
case CLASS_not | CLASS_AZ:
return extra_newl + NFA_NUPPER;
return extra_newl + NFA_NUPPER_IC;
}
return FAIL;
}
@@ -914,7 +923,7 @@ nfa_regatom()
break;
}
extra = ADD_NL;
extra = NFA_ADD_NL;
/* "\_[" is collection plus newline */
if (c == '[')
@@ -970,7 +979,7 @@ nfa_regatom()
}
#endif
EMIT(nfa_classcodes[p - classchars]);
if (extra == ADD_NL)
if (extra == NFA_ADD_NL)
{
EMIT(NFA_NEWL);
EMIT(NFA_OR);
@@ -1240,21 +1249,21 @@ collection:
{
/*
* Try to reverse engineer character classes. For example,
* recognize that [0-9] stands for \d and [A-Za-z_] with \h,
* recognize that [0-9] stands for \d and [A-Za-z_] for \h,
* and perform the necessary substitutions in the NFA.
*/
result = nfa_recognize_char_class(regparse, endp,
extra == ADD_NL);
extra == NFA_ADD_NL);
if (result != FAIL)
{
if (result >= NFA_DIGIT && result <= NFA_NUPPER)
EMIT(result);
else /* must be char class + newline */
if (result >= NFA_FIRST_NL && result <= NFA_LAST_NL)
{
EMIT(result - ADD_NL);
EMIT(result - NFA_ADD_NL);
EMIT(NFA_NEWL);
EMIT(NFA_OR);
}
else
EMIT(result);
regparse = endp;
mb_ptr_adv(regparse);
return OK;
@@ -1504,7 +1513,7 @@ collection:
* collection, add an OR below. But not for negated
* range. */
if (!negated)
extra = ADD_NL;
extra = NFA_ADD_NL;
}
else
{
@@ -1537,7 +1546,7 @@ collection:
EMIT(NFA_END_COLL);
/* \_[] also matches \n but it's not negated */
if (extra == ADD_NL)
if (extra == NFA_ADD_NL)
{
EMIT(reg_string ? NL : NFA_NEWL);
EMIT(NFA_OR);
@@ -2011,7 +2020,7 @@ nfa_set_code(c)
if (c >= NFA_FIRST_NL && c <= NFA_LAST_NL)
{
addnl = TRUE;
c -= ADD_NL;
c -= NFA_ADD_NL;
}
STRCPY(code, "");
@@ -2217,6 +2226,10 @@ nfa_set_code(c)
case NFA_NLOWER:STRCPY(code, "NFA_NLOWER"); break;
case NFA_UPPER: STRCPY(code, "NFA_UPPER"); break;
case NFA_NUPPER:STRCPY(code, "NFA_NUPPER"); break;
case NFA_LOWER_IC: STRCPY(code, "NFA_LOWER_IC"); break;
case NFA_NLOWER_IC: STRCPY(code, "NFA_NLOWER_IC"); break;
case NFA_UPPER_IC: STRCPY(code, "NFA_UPPER_IC"); break;
case NFA_NUPPER_IC: STRCPY(code, "NFA_NUPPER_IC"); break;
default:
STRCPY(code, "CHAR(x)");
@@ -2687,6 +2700,10 @@ nfa_max_width(startstate, depth)
case NFA_NLOWER:
case NFA_UPPER:
case NFA_NUPPER:
case NFA_LOWER_IC:
case NFA_NLOWER_IC:
case NFA_UPPER_IC:
case NFA_NUPPER_IC:
/* possibly non-ascii */
#ifdef FEAT_MBYTE
if (has_mbyte)
@@ -3765,6 +3782,9 @@ pim_equal(one, two)
if (two_unused)
/* one is used and two is not: not equal */
return FALSE;
/* compare the state id */
if (one->state->id != two->state->id)
return FALSE;
/* compare the position */
if (REG_MULTI)
return one->end.pos.lnum == two->end.pos.lnum
@@ -3841,6 +3861,10 @@ match_follows(startstate, depth)
case NFA_NLOWER:
case NFA_UPPER:
case NFA_NUPPER:
case NFA_LOWER_IC:
case NFA_NLOWER_IC:
case NFA_UPPER_IC:
case NFA_NUPPER_IC:
case NFA_START_COLL:
case NFA_START_NEG_COLL:
case NFA_NEWL:
@@ -4096,7 +4120,7 @@ skip_add:
sub = &subs->norm;
}
#ifdef FEAT_SYN_HL
else if (state->c >= NFA_ZOPEN)
else if (state->c >= NFA_ZOPEN && state->c <= NFA_ZOPEN9)
{
subidx = state->c - NFA_ZOPEN;
sub = &subs->synt;
@@ -4165,6 +4189,13 @@ skip_add:
}
subs = addstate(l, state->out, subs, pim, off);
/* "subs" may have changed, need to set "sub" again */
#ifdef FEAT_SYN_HL
if (state->c >= NFA_ZOPEN && state->c <= NFA_ZOPEN9)
sub = &subs->synt;
else
#endif
sub = &subs->norm;
if (save_in_use == -1)
{
@@ -4178,10 +4209,11 @@ skip_add:
break;
case NFA_MCLOSE:
if (nfa_has_zend)
if (nfa_has_zend && (REG_MULTI
? subs->norm.list.multi[0].end.lnum >= 0
: subs->norm.list.line[0].end != NULL))
{
/* Do not overwrite the position set by \ze. If no \ze
* encountered end will be set in nfa_regtry(). */
/* Do not overwrite the position set by \ze. */
subs = addstate(l, state->out, subs, pim, off);
break;
}
@@ -4213,7 +4245,7 @@ skip_add:
sub = &subs->norm;
}
#ifdef FEAT_SYN_HL
else if (state->c >= NFA_ZCLOSE)
else if (state->c >= NFA_ZCLOSE && state->c <= NFA_ZCLOSE9)
{
subidx = state->c - NFA_ZCLOSE;
sub = &subs->synt;
@@ -4257,6 +4289,13 @@ skip_add:
}
subs = addstate(l, state->out, subs, pim, off);
/* "subs" may have changed, need to set "sub" again */
#ifdef FEAT_SYN_HL
if (state->c >= NFA_ZCLOSE && state->c <= NFA_ZCLOSE9)
sub = &subs->synt;
else
#endif
sub = &subs->norm;
if (REG_MULTI)
sub->list.multi[subidx].end = save_lpos;
@@ -5051,6 +5090,12 @@ nfa_regmatch(prog, start, submatch, m)
return FALSE;
}
#endif
/* Some patterns may take a long time to match, especially when using
* recursive_regmatch(). Allow interrupting them with CTRL-C. */
fast_breakcheck();
if (got_int)
return FALSE;
nfa_match = FALSE;
/* Allocate memory for the lists of nodes. */
@@ -5278,7 +5323,10 @@ nfa_regmatch(prog, start, submatch, m)
log_subsexpr(m);
#endif
nfa_match = TRUE;
break;
/* See comment above at "goto nextchar". */
if (nextlist->n == 0)
clen = 0;
goto nextchar;
case NFA_START_INVISIBLE:
case NFA_START_INVISIBLE_FIRST:
@@ -5872,6 +5920,28 @@ nfa_regmatch(prog, start, submatch, m)
ADD_STATE_IF_MATCH(t->state);
break;
case NFA_LOWER_IC: /* [a-z] */
result = ri_lower(curc) || (ireg_ic && ri_upper(curc));
ADD_STATE_IF_MATCH(t->state);
break;
case NFA_NLOWER_IC: /* [^a-z] */
result = curc != NUL
&& !(ri_lower(curc) || (ireg_ic && ri_upper(curc)));
ADD_STATE_IF_MATCH(t->state);
break;
case NFA_UPPER_IC: /* [A-Z] */
result = ri_upper(curc) || (ireg_ic && ri_lower(curc));
ADD_STATE_IF_MATCH(t->state);
break;
case NFA_NUPPER_IC: /* ^[A-Z] */
result = curc != NUL
&& !(ri_upper(curc) || (ireg_ic && ri_lower(curc)));
ADD_STATE_IF_MATCH(t->state);
break;
case NFA_BACKREF1:
case NFA_BACKREF2:
case NFA_BACKREF3:
+3
View File
@@ -1769,6 +1769,9 @@ findmatchlimit(oap, initc, flags, maxtravel)
#endif
pos = curwin->w_cursor;
#ifdef FEAT_VIRTUALEDIT
pos.coladd = 0;
#endif
linep = ml_get(pos.lnum);
cpo_match = (vim_strchr(p_cpo, CPO_MATCH) != NULL);
+8 -4
View File
@@ -1797,13 +1797,16 @@ line_read_in:
*/
if (state == TS_START)
{
/* The header ends when the line sorts below "!_TAG_".
* There may be non-header items before the header though,
* e.g. "!" itself. When case is folded lower case letters
* sort before "_". */
/* The header ends when the line sorts below "!_TAG_". When
* case is folded lower case letters sort before "_". */
if (STRNCMP(lbuf, "!_TAG_", 6) <= 0
|| (lbuf[0] == '!' && ASCII_ISLOWER(lbuf[1])))
{
if (STRNCMP(lbuf, "!_TAG_", 6) != 0)
/* Non-header item before the header, e.g. "!" itself.
*/
goto parse_line;
/*
* Read header line.
*/
@@ -1898,6 +1901,7 @@ line_read_in:
#endif
}
parse_line:
/*
* Figure out where the different strings are in this line.
* For "normal" tags: Do a quick check if the tag matches.
+28 -9
View File
@@ -289,15 +289,29 @@ STARTTEST
:call add(tl, [2, '.a\%$', " a\n "])
:call add(tl, [2, '.a\%$', " a\n_a", "_a"])
:"
:"""" Test recognition of some character classes
:call add(tl, [2, '[0-9]', '8', '8'])
:call add(tl, [2, '[^0-9]', '8'])
:call add(tl, [2, '[0-9a-fA-F]*', '0a7', '0a7'])
:call add(tl, [2, '[^0-9A-Fa-f]\+', '0a7'])
:call add(tl, [2, '[a-z_A-Z0-9]\+', 'aso_sfoij', 'aso_sfoij'])
:call add(tl, [2, '[a-z]', 'a', 'a'])
:call add(tl, [2, '[a-zA-Z]', 'a', 'a'])
:call add(tl, [2, '[A-Z]', 'a'])
:"""" Test recognition of character classes
:call add(tl, [2, '[0-7]\+', 'x0123456789x', '01234567'])
:call add(tl, [2, '[^0-7]\+', '0a;X+% 897', 'a;X+% 89'])
:call add(tl, [2, '[0-9]\+', 'x0123456789x', '0123456789'])
:call add(tl, [2, '[^0-9]\+', '0a;X+% 9', 'a;X+% '])
:call add(tl, [2, '[0-9a-fA-F]\+', 'x0189abcdefg', '0189abcdef'])
:call add(tl, [2, '[^0-9A-Fa-f]\+', '0189g;X+% ab', 'g;X+% '])
:call add(tl, [2, '[a-z_A-Z0-9]\+', ';+aso_SfOij ', 'aso_SfOij'])
:call add(tl, [2, '[^a-z_A-Z0-9]\+', 'aSo_;+% sfOij', ';+% '])
:call add(tl, [2, '[a-z_A-Z]\+', '0abyz_ABYZ;', 'abyz_ABYZ'])
:call add(tl, [2, '[^a-z_A-Z]\+', 'abAB_09;+% yzYZ', '09;+% '])
:call add(tl, [2, '[a-z]\+', '0abcxyz1', 'abcxyz'])
:call add(tl, [2, '[a-z]\+', 'AabxyzZ', 'abxyz'])
:call add(tl, [2, '[^a-z]\+', 'a;X09+% x', ';X09+% '])
:call add(tl, [2, '[^a-z]\+', 'abX0;%yz', 'X0;%'])
:call add(tl, [2, '[a-zA-Z]\+', '0abABxzXZ9', 'abABxzXZ'])
:call add(tl, [2, '[^a-zA-Z]\+', 'ab09_;+ XZ', '09_;+ '])
:call add(tl, [2, '[A-Z]\+', 'aABXYZz', 'ABXYZ'])
:call add(tl, [2, '[^A-Z]\+', 'ABx0;%YZ', 'x0;%'])
:call add(tl, [2, '[a-z]\+\c', '0abxyzABXYZ;', 'abxyzABXYZ'])
:call add(tl, [2, '[A-Z]\+\c', '0abABxzXZ9', 'abABxzXZ'])
:call add(tl, [2, '\c[^a-z]\+', 'ab09_;+ XZ', '09_;+ '])
:call add(tl, [2, '\c[^A-Z]\+', 'ab09_;+ XZ', '09_;+ '])
:call add(tl, [2, '\C[^A-Z]\+', 'ABCOIJDEOIFNSD jsfoij sa', ' jsfoij sa'])
:"
:"""" Tests for \z features
@@ -314,6 +328,7 @@ STARTTEST
:call add(tl, [2, 'abc \zsmatch\ze abc', 'abc abc abc match abc abc', 'match'])
:call add(tl, [2, '\v(a \zsif .*){2}', 'a if then a if last', 'if last', 'a if last'])
:call add(tl, [2, '\>\zs.', 'aword. ', '.'])
:call add(tl, [2, '\s\+\ze\[/\|\s\zs\s\+', 'is [a t', ' '])
:"
:"""" Tests for \@= and \& features
:call add(tl, [2, 'abc\@=', 'abc', 'ab'])
@@ -407,9 +422,13 @@ STARTTEST
:call add(tl, [2, '\(foo\)\@<=\>', 'barfoo', '', 'foo'])
:call add(tl, [2, '\(foo\)\@<=.*', 'foobar', 'bar', 'foo'])
:"
:" complicated look-behind match
:call add(tl, [2, '\(r\@<=\|\w\@<!\)\/', 'x = /word/;', '/'])
:"
:""""" \@>
:call add(tl, [2, '\(a*\)\@>a', 'aaaa'])
:call add(tl, [2, '\(a*\)\@>b', 'aaab', 'aaab', 'aaa'])
:call add(tl, [2, '^\(.\{-}b\)\@>.', ' abcbd', ' abc', ' ab'])
:" TODO: BT engine does not restore submatch after failure
:call add(tl, [1, '\(a*\)\@>a\|a\+', 'aaaa', 'aaaa'])
:"
+69 -18
View File
@@ -650,30 +650,72 @@ OK 2 - .a\%$
OK 0 - .a\%$
OK 1 - .a\%$
OK 2 - .a\%$
OK 0 - [0-9]
OK 1 - [0-9]
OK 2 - [0-9]
OK 0 - [^0-9]
OK 1 - [^0-9]
OK 2 - [^0-9]
OK 0 - [0-9a-fA-F]*
OK 1 - [0-9a-fA-F]*
OK 2 - [0-9a-fA-F]*
OK 0 - [0-7]\+
OK 1 - [0-7]\+
OK 2 - [0-7]\+
OK 0 - [^0-7]\+
OK 1 - [^0-7]\+
OK 2 - [^0-7]\+
OK 0 - [0-9]\+
OK 1 - [0-9]\+
OK 2 - [0-9]\+
OK 0 - [^0-9]\+
OK 1 - [^0-9]\+
OK 2 - [^0-9]\+
OK 0 - [0-9a-fA-F]\+
OK 1 - [0-9a-fA-F]\+
OK 2 - [0-9a-fA-F]\+
OK 0 - [^0-9A-Fa-f]\+
OK 1 - [^0-9A-Fa-f]\+
OK 2 - [^0-9A-Fa-f]\+
OK 0 - [a-z_A-Z0-9]\+
OK 1 - [a-z_A-Z0-9]\+
OK 2 - [a-z_A-Z0-9]\+
OK 0 - [a-z]
OK 1 - [a-z]
OK 2 - [a-z]
OK 0 - [a-zA-Z]
OK 1 - [a-zA-Z]
OK 2 - [a-zA-Z]
OK 0 - [A-Z]
OK 1 - [A-Z]
OK 2 - [A-Z]
OK 0 - [^a-z_A-Z0-9]\+
OK 1 - [^a-z_A-Z0-9]\+
OK 2 - [^a-z_A-Z0-9]\+
OK 0 - [a-z_A-Z]\+
OK 1 - [a-z_A-Z]\+
OK 2 - [a-z_A-Z]\+
OK 0 - [^a-z_A-Z]\+
OK 1 - [^a-z_A-Z]\+
OK 2 - [^a-z_A-Z]\+
OK 0 - [a-z]\+
OK 1 - [a-z]\+
OK 2 - [a-z]\+
OK 0 - [a-z]\+
OK 1 - [a-z]\+
OK 2 - [a-z]\+
OK 0 - [^a-z]\+
OK 1 - [^a-z]\+
OK 2 - [^a-z]\+
OK 0 - [^a-z]\+
OK 1 - [^a-z]\+
OK 2 - [^a-z]\+
OK 0 - [a-zA-Z]\+
OK 1 - [a-zA-Z]\+
OK 2 - [a-zA-Z]\+
OK 0 - [^a-zA-Z]\+
OK 1 - [^a-zA-Z]\+
OK 2 - [^a-zA-Z]\+
OK 0 - [A-Z]\+
OK 1 - [A-Z]\+
OK 2 - [A-Z]\+
OK 0 - [^A-Z]\+
OK 1 - [^A-Z]\+
OK 2 - [^A-Z]\+
OK 0 - [a-z]\+\c
OK 1 - [a-z]\+\c
OK 2 - [a-z]\+\c
OK 0 - [A-Z]\+\c
OK 1 - [A-Z]\+\c
OK 2 - [A-Z]\+\c
OK 0 - \c[^a-z]\+
OK 1 - \c[^a-z]\+
OK 2 - \c[^a-z]\+
OK 0 - \c[^A-Z]\+
OK 1 - \c[^A-Z]\+
OK 2 - \c[^A-Z]\+
OK 0 - \C[^A-Z]\+
OK 1 - \C[^A-Z]\+
OK 2 - \C[^A-Z]\+
@@ -710,6 +752,9 @@ OK 2 - \v(a \zsif .*){2}
OK 0 - \>\zs.
OK 1 - \>\zs.
OK 2 - \>\zs.
OK 0 - \s\+\ze\[/\|\s\zs\s\+
OK 1 - \s\+\ze\[/\|\s\zs\s\+
OK 2 - \s\+\ze\[/\|\s\zs\s\+
OK 0 - abc\@=
OK 1 - abc\@=
OK 2 - abc\@=
@@ -932,12 +977,18 @@ OK 2 - \(foo\)\@<=\>
OK 0 - \(foo\)\@<=.*
OK 1 - \(foo\)\@<=.*
OK 2 - \(foo\)\@<=.*
OK 0 - \(r\@<=\|\w\@<!\)\/
OK 1 - \(r\@<=\|\w\@<!\)\/
OK 2 - \(r\@<=\|\w\@<!\)\/
OK 0 - \(a*\)\@>a
OK 1 - \(a*\)\@>a
OK 2 - \(a*\)\@>a
OK 0 - \(a*\)\@>b
OK 1 - \(a*\)\@>b
OK 2 - \(a*\)\@>b
OK 0 - ^\(.\{-}b\)\@>.
OK 1 - ^\(.\{-}b\)\@>.
OK 2 - ^\(.\{-}b\)\@>.
OK 0 - \(a*\)\@>a\|a\+
OK 2 - \(a*\)\@>a\|a\+
OK 0 - \_[^8-9]\+
+55
View File
@@ -60,6 +60,11 @@ static void version_msg __ARGS((char *s));
static char *(features[]) =
{
#ifdef HAVE_ACL
"+acl",
#else
"-acl",
#endif
#ifdef AMIGA /* only for Amiga systems */
# ifdef FEAT_ARP
"+ARP",
@@ -736,12 +741,62 @@ static char *(features[]) =
# else
"-xpm_w32",
# endif
#else
# ifdef HAVE_XPM
"+xpm",
# else
"-xpm",
# endif
#endif
NULL
};
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
22,
/**/
21,
/**/
20,
/**/
19,
/**/
18,
/**/
17,
/**/
16,
/**/
15,
/**/
14,
/**/
13,
/**/
12,
/**/
11,
/**/
10,
/**/
9,
/**/
8,
/**/
7,
/**/
6,
/**/
5,
/**/
4,
/**/
3,
/**/
2,
/**/
1,
/**/
0
};
+14 -12
View File
@@ -2177,8 +2177,9 @@ close_last_window_tabpage(win, free_buf, prev_curtab)
* If "free_buf" is TRUE related buffer may be unloaded.
*
* Called by :quit, :close, :xit, :wq and findtag().
* Returns FAIL when the window was not closed.
*/
void
int
win_close(win, free_buf)
win_T *win;
int free_buf;
@@ -2195,21 +2196,21 @@ win_close(win, free_buf)
if (last_window())
{
EMSG(_("E444: Cannot close last window"));
return;
return FAIL;
}
#ifdef FEAT_AUTOCMD
if (win->w_closing || (win->w_buffer != NULL && win->w_buffer->b_closing))
return; /* window is already being closed */
return FAIL; /* window is already being closed */
if (win == aucmd_win)
{
EMSG(_("E813: Cannot close autocmd window"));
return;
return FAIL;
}
if ((firstwin == aucmd_win || lastwin == aucmd_win) && one_window())
{
EMSG(_("E814: Cannot close window, only autocmd window would remain"));
return;
return FAIL;
}
#endif
@@ -2217,7 +2218,7 @@ win_close(win, free_buf)
* and then close the window and the tab page to avoid that curwin and
* curtab are invalid while we are freeing memory. */
if (close_last_window_tabpage(win, free_buf, prev_curtab))
return;
return FAIL;
/* When closing the help window, try restoring a snapshot after closing
* the window. Otherwise clear the snapshot, it's now invalid. */
@@ -2245,22 +2246,22 @@ win_close(win, free_buf)
win->w_closing = TRUE;
apply_autocmds(EVENT_BUFLEAVE, NULL, NULL, FALSE, curbuf);
if (!win_valid(win))
return;
return FAIL;
win->w_closing = FALSE;
if (last_window())
return;
return FAIL;
}
win->w_closing = TRUE;
apply_autocmds(EVENT_WINLEAVE, NULL, NULL, FALSE, curbuf);
if (!win_valid(win))
return;
return FAIL;
win->w_closing = FALSE;
if (last_window())
return;
return FAIL;
# ifdef FEAT_EVAL
/* autocmds may abort script processing */
if (aborting())
return;
return FAIL;
# endif
}
#endif
@@ -2308,7 +2309,7 @@ win_close(win, free_buf)
* other window or moved to another tab page. */
else if (!win_valid(win) || last_window() || curtab != prev_curtab
|| close_last_window_tabpage(win, free_buf, prev_curtab))
return;
return FAIL;
/* Free the memory used for the window and get the window that received
* the screen space. */
@@ -2388,6 +2389,7 @@ win_close(win, free_buf)
#endif
redraw_all_later(NOT_VALID);
return OK;
}
/*