With 'splitkeep' "screen" the scroll position is lost when splitting and
closing a window, win_fix_cursor() moves the cursor to another line.
-Check places that source "path/*.vim" to not match other extensions, e.g.
-.vim9, on MS-Windows (short file name match, gets expanded to long file name).
-E.g. for startup files, plugins, packs, etc.
-
When a help item can't be found, then open 'helpfile'. Search for the tag in
that file and gtive E149 only when not found. Helps for a tiny Vim installed
without all the help files.
char_u *matchname;
int ok;
char_u *p_alt;
+ int use_short_name;
// Expanding "**" may take a long time, check for CTRL-C.
if (stardepth > 0)
// remember the pattern or file name being looked for
matchname = vim_strsave(s);
+ // Only match against the alternate (8.3) file name when the pattern looks
+ // like a short name, it contains a '~'.
+ use_short_name = vim_strchr(s, '~') != NULL;
+
len = (size_t)(s - buf);
// If "**" is by itself, this is the first time we encounter it and more
// is following then find matches without any directory.
// Do not use the alternate filename when the file name ends in '~',
// because it picks up backup files: short name for "foo.vim~" is
// "foo~1.vim", which matches "*.vim".
- if (*wfb.cAlternateFileName == NUL || p[STRLEN(p) - 1] == '~')
+ if (!use_short_name || *wfb.cAlternateFileName == NUL
+ || p[STRLEN(p) - 1] == '~')
p_alt = NULL;
else
p_alt = utf16_to_enc(wfb.cAlternateFileName, NULL);
call assert_equal(fnamemodify(sfile, ':r'), fnamemodify(file, ':p:8:r'))
endfunc
+" A pattern must not match the short name of a file with a longer extension:
+" the short name of "foo.vim9" is "FOO~1.VIM", which matches "*.vim".
+func Test_glob_short_name_extension()
+ let dir = 'c:/Xtest_glob8'
+ call s:SetupDir(dir)
+ call mkdir(dir, 'D')
+
+ let file = dir . '/foo.vim9'
+ call writefile([], file, 'D')
+ if fnamemodify(file, ':p:8') ==? fnamemodify(file, ':p')
+ throw 'Skipped: 8.3 short names are not created on this volume'
+ endif
+ call writefile([], dir . '/bar.vim', 'D')
+
+ let matches = map(split(glob(dir . '/*.vim'), "\n"), {_, v -> fnamemodify(v, ':t')})
+ call assert_equal(['bar.vim'], matches)
+
+ " A pattern that is a short name still matches.
+ let short = fnamemodify(file, ':p:8:t')
+ call assert_equal([file], split(glob(dir . '/' . short), "\n"))
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 893,
/**/
892,
/**/