To: vim_dev@googlegroups.com Subject: Patch 9.0.1438 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.1438 Problem: .fs files are falsely recognized as forth files. Solution: Check 100 lines for something that looks like forth. (Johan Kotlinski, closes #12219, closes #11988) Files: runtime/autoload/dist/ft.vim, src/testdir/test_filetype.vim *** ../vim-9.0.1437/runtime/autoload/dist/ft.vim 2022-12-14 16:42:11.286755477 +0000 --- runtime/autoload/dist/ft.vim 2023-04-02 20:24:35.673270770 +0100 *************** *** 307,320 **** if exists("g:filetype_fs") exe "setf " .. g:filetype_fs else ! var line = getline(nextnonblank(1)) ! # comments and colon definitions ! if line =~ '^\s*\.\=( ' || line =~ '^\s*\\G\= ' || line =~ '^\\$' ! \ || line =~ '^\s*: \S' ! setf forth ! else ! setf fsharp ! endif endif enddef --- 307,322 ---- if exists("g:filetype_fs") exe "setf " .. g:filetype_fs else ! var n = 1 ! while n < 100 && n <= line("$") ! # Forth comments and colon definitions ! if getline(n) =~ "^[:(\\\\] " ! setf forth ! return ! endif ! n += 1 ! endwhile ! setf fsharp endif enddef *** ../vim-9.0.1437/src/testdir/test_filetype.vim 2023-03-28 21:28:32.694343665 +0100 --- src/testdir/test_filetype.vim 2023-04-02 20:28:45.393550638 +0100 *************** *** 1212,1237 **** call assert_equal('forth', &filetype) bwipe! - call writefile(['.( Forth displayed inline comment )'], 'Xfile.fs') - split Xfile.fs - call assert_equal('forth', &filetype) - bwipe! - call writefile(['\ Forth line comment'], 'Xfile.fs') split Xfile.fs call assert_equal('forth', &filetype) bwipe! - - " empty line comment - no space required - call writefile(['\'], 'Xfile.fs') - split Xfile.fs - call assert_equal('forth', &filetype) - bwipe! - - call writefile(['\G Forth documentation comment '], 'Xfile.fs') - split Xfile.fs - call assert_equal('forth', &filetype) - bwipe! call writefile([': squared ( n -- n^2 )', 'dup * ;'], 'Xfile.fs') split Xfile.fs --- 1212,1221 ---- *** ../vim-9.0.1437/src/version.c 2023-04-01 22:24:15.213814387 +0100 --- src/version.c 2023-04-02 20:27:04.025445002 +0100 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 1438, /**/ -- ARTHUR: What? BLACK KNIGHT: None shall pass. ARTHUR: I have no quarrel with you, good Sir knight, but I must cross this bridge. BLACK KNIGHT: Then you shall die. The Quest for the Holy Grail (Monty Python) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///