]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.0251: Filetype test fails v9.1.0251
authorzeertzjq <zeertzjq@outlook.com>
Mon, 1 Apr 2024 12:46:20 +0000 (14:46 +0200)
committerChristian Brabandt <cb@256bit.org>
Mon, 1 Apr 2024 12:46:20 +0000 (14:46 +0200)
Problem:  Filetype test fails.
Solution: Move detection by name before detection by extension.
          Improve TextChanged test and remove wrong test and fix
          a typo in a comment (zeertzjq).

closes: #14373

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/filetype.vim
src/edit.c
src/testdir/test_autocmd.vim
src/version.c

index 1545ea5ef133b816bc2bd0e276f425caaebd996b..077aa63e000c9b92ca5addc1c25b1e0aef552ece 100644 (file)
@@ -523,6 +523,10 @@ au BufNewFile,BufRead *.lrc                        setf lyrics
 au BufNewFile,BufRead *.quake,cm3.cfg          setf m3quake
 au BufNewFile,BufRead m3makefile,m3overrides   setf m3build
 
+" Many Python tools use dosini as their config, like setuptools, pudb, coverage
+" (must be before *.cfg)
+au BufNewFile,BufRead setup.cfg,pudb.cfg,.coveragerc   setf dosini
+
 " Quake
 au BufNewFile,BufRead *baseq[2-3]/*.cfg,*id1/*.cfg     setf quake
 au BufNewFile,BufRead *quake[1-3]/*.cfg                        setf quake
@@ -1045,9 +1049,6 @@ au BufNewFile,BufRead *.4gl,*.4gh,*.m4gl  setf fgl
 " .INI file for MSDOS
 au BufNewFile,BufRead *.ini,*.INI              setf dosini
 
-" Many python tools use dosini as their config, such as setuptools, pudb, coverage
-au BufNewFile,BufRead setup.cfg,pudb.cfg,.coveragerc   setf dosini
-
 " SysV Inittab
 au BufNewFile,BufRead inittab                  setf inittab
 
@@ -1182,6 +1183,9 @@ au BufNewFile,BufRead *.sig                       call dist#ft#FTsig()
 " LDAP LDIF
 au BufNewFile,BufRead *.ldif                   setf ldif
 
+" Luadoc, Ldoc (must be before *.ld)
+au BufNewFile,BufRead config.ld                        setf lua
+
 " Ld loader
 au BufNewFile,BufRead *.ld,*/ldscripts/*       setf ld
 
@@ -1271,9 +1275,6 @@ au BufNewFile,BufRead .luacheckrc         setf lua
 " Luarocks
 au BufNewFile,BufRead *.rockspec,rock_manifest setf lua
 
-" Luadoc, Ldoc
-au BufNewFile,BufRead config.ld                        setf lua
-
 " Linden Scripting Language (Second Life)
 au BufNewFile,BufRead *.lsl                    call dist#ft#FTlsl()
 
index 2f28562086cb3a5390ce40d50c61a5326612b959..075b39bff0d943ec393b7c8a56d84a176bbeca89 100644 (file)
@@ -847,7 +847,7 @@ doESCkey:
                // ins_redraw() triggers TextChangedI only when no characters
                // are in the typeahead buffer, so reset curbuf->b_last_changedtick only
                // if the TextChangedI was not blocked by char_avail() (e.g. using :norm!)
-               // and the TextChangeDI autocommand has been trigered
+               // and the TextChangedI autocommand has been triggered.
                if (!char_avail() && curbuf->b_last_changedtick_i == CHANGEDTICK(curbuf))
                    curbuf->b_last_changedtick = CHANGEDTICK(curbuf);
                return (c == Ctrl_O);
index e69a3f60e7ea8e4ad55106e86d747e865a9c6e14..7d0adf9c2c3ae7668e95103db09bc0a91665e0ee 100644 (file)
@@ -3734,11 +3734,6 @@ func Test_Changed_ChangedI()
   call feedkeys("yypi\<esc>", 'tnix')
   call assert_equal('', g:autocmd_i)
 
-  " TextChanged should only trigger if change was done in Normal mode
-  let g:autocmd_n = ''
-  call feedkeys("ibar\<esc>", 'tnix')
-  call assert_equal('', g:autocmd_n)
-
   " If change is a mix of Normal and Insert modes, TextChangedI should trigger
   func s:validate_mixed_textchangedi(keys)
     call feedkeys("ifoo\<esc>", 'tnix')
@@ -4532,20 +4527,30 @@ endfunc
 
 " Test TextChangedI and TextChanged
 func Test_Changed_ChangedI_2()
+  " Run this test in a terminal because it requires running the main loop.
   CheckRunVimInTerminal
   call writefile(['one', 'two', 'three'], 'XTextChangedI2', 'D')
   let before =<< trim END
-      autocmd TextChanged,TextChangedI * call writefile([b:changedtick], 'XTextChangedI3')
+      let [g:autocmd_n, g:autocmd_i] = ['','']
+
+      func TextChangedAutocmd(char)
+        let g:autocmd_{tolower(a:char)} = a:char .. b:changedtick
+        call writefile([g:autocmd_n, g:autocmd_i], 'XTextChangedI3')
+      endfunc
+
+      au TextChanged  <buffer> :call TextChangedAutocmd('N')
+      au TextChangedI <buffer> :call TextChangedAutocmd('I')
+
       nnoremap <CR> o<Esc>
       call writefile([], 'XTextChangedI3')
   END
 
   call writefile(before, 'Xinit', 'D')
   let buf = RunVimInTerminal('-S Xinit XtextChangedI2', {})
+  call WaitForAssert({-> assert_true(filereadable('XTextChangedI3'))})
   call term_sendkeys(buf, "\<cr>")
-  call term_wait(buf)
+  call WaitForAssert({-> assert_equal(['N4', ''], readfile('XTextChangedI3'))})
   call StopVimInTerminal(buf)
-  call assert_equal(['4'], readfile('XTextChangedI3'))
 
   call delete('XTextChangedI3')
 endfunc
index 42a9a1adad8a7e8f5ea553270101d4cba55dc0a9..ee7c3ec861eba4b69a48b8c2fd1c8ad5ec7f71f8 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    251,
 /**/
     250,
 /**/