From c12e4eecbb26cedca96e0810d3501043356eebaa Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 22 Jun 2023 12:18:57 +0100 Subject: patch 9.0.1643: filetype detection fails if file name ends in many '~' Problem: Filetype detection fails if file name ends in many '~'. Solution: Strip multiple '~' at the same time. (closes #12553) --- src/testdir/test_filetype.vim | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/testdir/test_filetype.vim') diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim index 41b9106136..9c1b11d2a0 100644 --- a/src/testdir/test_filetype.vim +++ b/src/testdir/test_filetype.vim @@ -1,5 +1,16 @@ " Test :setfiletype +func Test_backup_strip() + filetype on + let fname = 'Xdetect.js~~~~~~~~~~~' + call writefile(['one', 'two', 'three'], fname, 'D') + exe 'edit ' .. fname + call assert_equal('javascript', &filetype) + + bwipe! + filetype off +endfunc + func Test_detection() filetype on augroup filetypedetect -- cgit v1.2.3