patch 8.0.1231: expanding file name drops dash
Problem: Expanding file name drops dash. (stucki)
Solution: Use the right position. (Christian Brabandt, closes #2184)
diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim
index ff19082..832413e 100644
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -365,6 +365,27 @@
delcommand Foo
endfunc
+func Test_cmdline_write_alternatefile()
+ new
+ call setline('.', ['one', 'two'])
+ f foo.txt
+ new
+ f #-A
+ call assert_equal('foo.txt-A', expand('%'))
+ f #<-B.txt
+ call assert_equal('foo-B.txt', expand('%'))
+ f %<
+ call assert_equal('foo-B', expand('%'))
+ new
+ call assert_fails('f #<', 'E95')
+ bw!
+ f foo-B.txt
+ f %<-A
+ call assert_equal('foo-B-A', expand('%'))
+ bw!
+ bw!
+endfunc
+
" using a leading backslash here
set cpo+=C