File tree Expand file tree Collapse file tree 3 files changed +29
-1
lines changed
Expand file tree Collapse file tree 3 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -10715,9 +10715,12 @@ eval_vars(
1071510715 if (* s == '<' ) /* "#<99" uses v:oldfiles */
1071610716 ++ s ;
1071710717 i = (int )getdigits (& s );
10718+ if (s == src + 2 && src [1 ] == '-' )
10719+ /* just a minus sign, don't skip over it */
10720+ s -- ;
1071810721 * usedlen = (int )(s - src ); /* length of what we expand */
1071910722
10720- if (src [1 ] == '<' )
10723+ if (src [1 ] == '<' && i != 0 )
1072110724 {
1072210725 if (* usedlen < 2 )
1072310726 {
@@ -10740,6 +10743,8 @@ eval_vars(
1074010743 }
1074110744 else
1074210745 {
10746+ if (i == 0 && src [1 ] == '<' && * usedlen > 1 )
10747+ * usedlen = 1 ;
1074310748 buf = buflist_findnr (i );
1074410749 if (buf == NULL )
1074510750 {
Original file line number Diff line number Diff line change @@ -365,6 +365,27 @@ func Test_cmdline_complete_user_cmd()
365365 delcommand Foo
366366endfunc
367367
368+ func Test_cmdline_write_alternatefile ()
369+ new
370+ call setline (' .' , [' one' , ' two' ])
371+ f foo.txt
372+ new
373+ f #- A
374+ call assert_equal (' foo.txt-A' , expand (' %' ))
375+ f #<- B.txt
376+ call assert_equal (' foo-B.txt' , expand (' %' ))
377+ f % <
378+ call assert_equal (' foo-B' , expand (' %' ))
379+ new
380+ call assert_fails (' f #<' , ' E95' )
381+ bw !
382+ f foo- B.txt
383+ f % <- A
384+ call assert_equal (' foo-B-A' , expand (' %' ))
385+ bw !
386+ bw !
387+ endfunc
388+
368389" using a leading backslash here
369390set cpo += C
370391
Original file line number Diff line number Diff line change @@ -761,6 +761,8 @@ static char *(features[]) =
761761
762762static int included_patches [] =
763763{ /* Add new patch number below this line */
764+ /**/
765+ 1231 ,
764766/**/
765767 1230 ,
766768/**/
You can’t perform that action at this time.
0 commit comments