changeset 28021:d4b549180a07 v8.2.4535

patch 8.2.4535: filename modifer ":8" removes the filename Commit: https://github.com/vim/vim/commit/81da16b53fbf804a3cd32bc15313c96444b71484 Author: Christian Brabandt <cb@256bit.org> Date: Thu Mar 10 12:24:02 2022 +0000 patch 8.2.4535: filename modifer ":8" removes the filename Problem: Filename modifer ":8" removes the filename. Solution: Use strncpy() instead of vim_strncpy(). (Christian Brabandt, closes #9918, closes #8600)
author Bram Moolenaar <Bram@vim.org>
date Thu, 10 Mar 2022 13:30:16 +0100
parents edaa0c170c11
children 48e44a36c25c
files src/filepath.c src/testdir/test_shortpathname.vim src/version.c
diffstat 3 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/filepath.c
+++ b/src/filepath.c
@@ -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;
 	}
 
--- a/src/testdir/test_shortpathname.vim
+++ b/src/testdir/test_shortpathname.vim
@@ -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
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    4535,
+/**/
     4534,
 /**/
     4533,