]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.2.4535: filename modifer ":8" removes the filename v8.2.4535
authorChristian Brabandt <cb@256bit.org>
Thu, 10 Mar 2022 12:24:02 +0000 (12:24 +0000)
committerBram Moolenaar <Bram@vim.org>
Thu, 10 Mar 2022 12:24:02 +0000 (12:24 +0000)
Problem:    Filename modifer ":8" removes the filename.
Solution:   Use strncpy() instead of vim_strncpy(). (Christian Brabandt,
            closes #9918, closes #8600)

src/filepath.c
src/testdir/test_shortpathname.vim
src/version.c

index 7a5dae441fd55e55893f97a6c0a1c576cc50c4be..f0da60f4527c850c08c75d2132e885769615ed8b 100644 (file)
@@ -186,7 +186,7 @@ shortpath_for_invalid_fname(
            // unless get_short_pathname() did its work in-place.
            *fname = *bufp = save_fname;
            if (short_fname != save_fname)
-               vim_strncpy(save_fname, short_fname, len);
+               STRNCPY(save_fname, short_fname, len);
            save_fname = NULL;
        }
 
index f5fa1185a1fccd910463f8e6a3c872c70e97fb21..13fc07999dcbf0bdd57b76ca64e011ef1e821cfe 100644 (file)
@@ -88,4 +88,9 @@ func Test_ColonEight_MultiByte()
   call delete(dir, 'd')
 endfunc
 
+func Test_ColonEight_notexists()
+  let non_exists='C:\windows\newfile.txt'
+  call assert_equal(non_exists, fnamemodify(non_exists, ':p:8'))
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
index 5e5a2a8aa23bb13d685c07872550a27a09656d33..49810ea00f72f7bc7c2592c1c544b9437351a90b 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4535,
 /**/
     4534,
 /**/