From de9ed1ca5478481679df23f894b92b6756be7aed Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 19 Nov 2024 22:29:18 +0100 Subject: vim-patch:9.1.0874: filetype: karel files are not detected Problem: filetype: karel files are not detected Solution: detect '*.kl' files as karel filetype, include syntax and filetype plugin (Kirill Morozov) closes: vim/vim#16075 https://github.com/vim/vim/commit/fdac54d7bbf6d68a8bf741e734b86d0f1998ac86 Co-authored-by: Kirill Morozov Co-authored-by: KnoP-01 --- test/old/testdir/test_filetype.vim | 1 + 1 file changed, 1 insertion(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 19b7d41552..2749a6a200 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -392,6 +392,7 @@ func s:GetFilenameChecks() abort \ 'jsp': ['file.jsp'], \ 'julia': ['file.jl'], \ 'just': ['justfile', 'Justfile', '.justfile', 'config.just'], + \ 'karel': ['file.kl', 'file.KL'], \ 'kconfig': ['Kconfig', 'Kconfig.debug', 'Kconfig.file', 'Config.in', 'Config.in.host'], \ 'kdl': ['file.kdl'], \ 'kivy': ['file.kv'], -- cgit From 4c85c217d384c79013401f09b329467c53c8a01c Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 19 Nov 2024 22:30:50 +0100 Subject: vim-patch:9.1.0875: filetype: hyprlang detection can be improved Problem: filetype: hyprlang detection can be improved Solution: detect '/hypr/*.conf' files as hyprlang filetype, include basic syntax highlighting (Luca Saccarola) fixes: vim/vim#15875 closes: vim/vim#16064 https://github.com/vim/vim/commit/a13bd294ab2d9ab38634c9ec51fa76205af6eb62 Co-authored-by: Luca Saccarola --- test/old/testdir/test_filetype.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 2749a6a200..889386ae5b 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -353,7 +353,7 @@ func s:GetFilenameChecks() abort \ 'htmlm4': ['file.html.m4'], \ 'httest': ['file.htt', 'file.htb'], \ 'hurl': ['file.hurl'], - \ 'hyprlang': ['hyprlock.conf', 'hyprland.conf', 'hypridle.conf', 'hyprpaper.conf'], + \ 'hyprlang': ['hyprlock.conf', 'hyprland.conf', 'hypridle.conf', 'hyprpaper.conf', '/hypr/foo.conf'], \ 'i3config': ['/home/user/.i3/config', '/home/user/.config/i3/config', '/etc/i3/config', '/etc/xdg/i3/config'], \ 'ibasic': ['file.iba', 'file.ibi'], \ 'icemenu': ['/.icewm/menu', 'any/.icewm/menu'], -- cgit From 23ead4f2cb19b05d83f1c515b35bd5896ee77365 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 19 Nov 2024 22:33:30 +0100 Subject: vim-patch:9.1.0876: filetype: openCL files are not recognized Problem: filetype: openCL files are not recognized Solution: detect '*.cl' files as opencl or lisp filetype, include a opencl syntax and filetype plugin (Wu, Zhenyu) closes: vim/vim#15825 https://github.com/vim/vim/commit/e2c27ca8eff7cc8ec852b531d5a7f328a343a761 Co-authored-by: Wu, Zhenyu --- test/old/testdir/test_filetype.vim | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 889386ae5b..1caed9a9da 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -422,7 +422,7 @@ func s:GetFilenameChecks() abort \ 'limits': ['/etc/limits', '/etc/anylimits.conf', '/etc/anylimits.d/file.conf', '/etc/limits.conf', '/etc/limits.d/file.conf', '/etc/some-limits.conf', '/etc/some-limits.d/file.conf', 'any/etc/limits', 'any/etc/limits.conf', 'any/etc/limits.d/file.conf', 'any/etc/some-limits.conf', 'any/etc/some-limits.d/file.conf'], \ 'liquidsoap': ['file.liq'], \ 'liquid': ['file.liquid'], - \ 'lisp': ['file.lsp', 'file.lisp', 'file.asd', 'file.el', 'file.cl', '.emacs', '.sawfishrc', 'sbclrc', '.sbclrc', 'file.stsg', 'any/local/share/supertux2/config'], + \ 'lisp': ['file.lsp', 'file.lisp', 'file.asd', 'file.el', '.emacs', '.sawfishrc', 'sbclrc', '.sbclrc', 'file.stsg', 'any/local/share/supertux2/config'], \ 'lite': ['file.lite', 'file.lt'], \ 'litestep': ['/LiteStep/any/file.rc', 'any/LiteStep/any/file.rc'], \ 'logcheck': ['/etc/logcheck/file.d-some/file', '/etc/logcheck/file.d/file', 'any/etc/logcheck/file.d-some/file', 'any/etc/logcheck/file.d/file'], @@ -1192,6 +1192,22 @@ func Test_cfg_file() filetype off endfunc +func Test_cl_file() + filetype on + + call writefile(['/*', ' * Xfile.cl', ' */', 'int f() {}'], 'Xfile.cl') + split Xfile.cl + call assert_equal('opencl', &filetype) + bwipe! + + call writefile(['()'], 'Xfile.cl') + split Xfile.cl + call assert_equal('lisp', &filetype) + bwipe! + + filetype off +endfunc + func Test_d_file() filetype on -- cgit From f55c842ec7eabd2e12749411babdcadba47438bc Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 20 Nov 2024 08:51:39 +0100 Subject: vim-patch:9.1.0880: filetype: C3 files are not recognized Problem: filetype: C3 files are not recognized Solution: detect '*.c3*' files as c3 filetype (Turiiya) closes: vim/vim#16087 https://github.com/vim/vim/commit/c8dfcfc53ba5ed69b5d4e534fd7e8694de014e6a Co-authored-by: Turiiya <34311583+ttytm@users.noreply.github.com> --- test/old/testdir/test_filetype.vim | 1 + 1 file changed, 1 insertion(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 1caed9a9da..62e339c1ca 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -144,6 +144,7 @@ func s:GetFilenameChecks() abort \ 'bzl': ['file.bazel', 'file.bzl', 'WORKSPACE', 'WORKSPACE.bzlmod'], \ 'bzr': ['bzr_log.any', 'bzr_log.file'], \ 'c': ['enlightenment/file.cfg', 'file.qc', 'file.c', 'some-enlightenment/file.cfg', 'file.mdh', 'file.epro'], + \ 'c3': ['file.c3', 'file.c3i', 'file.c3t'], \ 'cabal': ['file.cabal'], \ 'cabalconfig': ['cabal.config', expand("$HOME/.config/cabal/config")] + s:WhenConfigHome('$XDG_CONFIG_HOME/cabal/config'), \ 'cabalproject': ['cabal.project', 'cabal.project.local'], -- cgit From 5c603064421b8829cf106c845902fcc41d3e31f2 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 24 Nov 2024 22:36:33 +0800 Subject: vim-patch:9.1.0883: message history cleanup is missing some tests (#31331) Problem: message history cleanup is missing some tests Solution: Add tests, refactor common code into did_set_msghistory() (Shougo Matsushita) closes: vim/vim#16078 https://github.com/vim/vim/commit/9f860a14c308f7a9a27a6850d36790615717a710 Co-authored-by: Shougo Matsushita Co-authored-by: Milly --- test/old/testdir/test_cmdline.vim | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_cmdline.vim b/test/old/testdir/test_cmdline.vim index 290af4a4ca..6fa3ee5250 100644 --- a/test/old/testdir/test_cmdline.vim +++ b/test/old/testdir/test_cmdline.vim @@ -4160,4 +4160,30 @@ func Test_cd_bslash_completion_windows() let &shellslash = save_shellslash endfunc +func Test_msghistory() + " After setting 'msghistory' to 2 and outputting a message 4 times with + " :echomsg, is the number of output lines of :messages 2? + set msghistory=2 + echomsg 'foo' + echomsg 'bar' + echomsg 'baz' + echomsg 'foobar' + call assert_equal(['baz', 'foobar'], GetMessages()) + + " When the number of messages is 10 and 'msghistory' is changed to 5, is the + " number of output lines of :messages 5? + set msghistory=10 + for num in range(1, 10) + echomsg num + endfor + set msghistory=5 + call assert_equal(5, len(GetMessages())) + + " Check empty list + set msghistory=0 + call assert_true(empty(GetMessages())) + + set msghistory& +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From ff00d583af8f1ce21a508d701d09c54d2621b16e Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 24 Nov 2024 15:05:48 +0100 Subject: vim-patch:9.1.0886: filetype: debian control file not detected Problem: filetype: debian control file not detected Solution: detect 'debian/control' files as debcontrol filetype (author) closes: vim/vim#16067 https://github.com/vim/vim/commit/57b947e3c3b8d52b914158979263855d785445d5 Co-authored-by: Wu, Zhenyu --- test/old/testdir/test_filetype.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 62e339c1ca..58064ea412 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -211,7 +211,7 @@ func s:GetFilenameChecks() abort \ 'datascript': ['file.ds'], \ 'dcd': ['file.dcd'], \ 'debchangelog': ['changelog.Debian', 'changelog.dch', 'NEWS.Debian', 'NEWS.dch', '/debian/changelog'], - \ 'debcontrol': ['/debian/control', 'any/debian/control'], + \ 'debcontrol': ['/debian/control', 'any/debian/control', 'any/DEBIAN/control'], \ 'debcopyright': ['/debian/copyright', 'any/debian/copyright'], \ 'debsources': ['/etc/apt/sources.list', '/etc/apt/sources.list.d/file.list', 'any/etc/apt/sources.list', 'any/etc/apt/sources.list.d/file.list'], \ 'deb822sources': ['/etc/apt/sources.list.d/file.sources', 'any/etc/apt/sources.list.d/file.sources'], -- cgit From 66bb1e577c96d8eb63c04dcc737394b4ce2b0f5d Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 26 Nov 2024 07:53:07 +0800 Subject: vim-patch:9.1.0888: leftcol property not available in getwininfo() (#31349) Problem: leftcol property not available in getwininfo() Solution: add leftcol property property (glepnir) closes: vim/vim#16119 https://github.com/vim/vim/commit/0a850673e3d4193d55f47bcbbc0b0da5f155307d Co-authored-by: glepnir --- test/old/testdir/test_bufwintabinfo.vim | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_bufwintabinfo.vim b/test/old/testdir/test_bufwintabinfo.vim index 57492e07c9..0a4bd0b674 100644 --- a/test/old/testdir/test_bufwintabinfo.vim +++ b/test/old/testdir/test_bufwintabinfo.vim @@ -114,6 +114,18 @@ func Test_getbufwintabinfo() wincmd t | only endfunc +function Test_get_wininfo_leftcol() + set nowrap + set winwidth=10 + vsp + call setline(1, ['abcdefghijklmnopqrstuvwxyz']) + norm! 5zl + call assert_equal(5, getwininfo()[0].leftcol) + bwipe! + set wrap& + set winwidth& +endfunc + function Test_get_buf_options() let opts = bufnr()->getbufvar('&') call assert_equal(v:t_dict, type(opts)) -- cgit From 5897994cb75b5b64a34017873119c87a75c42375 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 28 Nov 2024 09:02:10 +0800 Subject: vim-patch:9.1.0890: %! item not allowed for 'rulerformat' (#31369) Problem: %! item not allowed for 'rulerformat' (yatinlala) Solution: also allow to use %! for rulerformat option (Yegappan Lakshmanan) fixes: vim/vim#16091 closes: vim/vim#16118 https://github.com/vim/vim/commit/ac023e8baae65584537aa3c11494dad6f71770af Co-authored-by: Yegappan Lakshmanan --- test/old/testdir/test_cmdline.vim | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_cmdline.vim b/test/old/testdir/test_cmdline.vim index 6fa3ee5250..2f34ecb414 100644 --- a/test/old/testdir/test_cmdline.vim +++ b/test/old/testdir/test_cmdline.vim @@ -4036,6 +4036,27 @@ func Test_rulerformat_position() call StopVimInTerminal(buf) endfunc +" Test for using "%!" in 'rulerformat' to use a function +func Test_rulerformat_function() + CheckScreendump + + let lines =<< trim END + func TestRulerFn() + return '10,20%=30%%' + endfunc + END + call writefile(lines, 'Xrulerformat_function', 'D') + + let buf = RunVimInTerminal('-S Xrulerformat_function', #{rows: 2, cols: 40}) + call term_sendkeys(buf, ":set ruler rulerformat=%!TestRulerFn()\") + call term_sendkeys(buf, ":redraw!\") + call term_wait(buf) + call VerifyScreenDump(buf, 'Test_rulerformat_function', {}) + + " clean up + call StopVimInTerminal(buf) +endfunc + func Test_getcompletion_usercmd() command! -nargs=* -complete=command TestCompletion echo -- cgit From cfa8418c21133af5562ab56f0b2e9d48ce8b2096 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 29 Nov 2024 08:58:08 +0800 Subject: vim-patch:9.1.0894: No test for what the spotbug compiler parses Problem: No test for what the spotbug compiler parses (after commit: 65311c6f472de67b368) Solution: Test &makeprg for the SpotBugs compiler plugin (Aliaksei Budavei) closes: vim/vim#16096 https://github.com/vim/vim/commit/60ddb1a14025dc061908a1b7a0a3a82b4bbed223 Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com> --- test/old/testdir/test_compiler.vim | 194 +++++++++++++++++++++++++++++++++++++ 1 file changed, 194 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_compiler.vim b/test/old/testdir/test_compiler.vim index 07b57b76d9..6b195b5efa 100644 --- a/test/old/testdir/test_compiler.vim +++ b/test/old/testdir/test_compiler.vim @@ -78,3 +78,197 @@ func Test_compiler_error() call assert_fails('compiler! doesnotexist', 'E666:') unlet! g:current_compiler endfunc + +func s:SpotBugsParseFilterMakePrg(dirname, makeprg) + let result = {} + let result.sourcepath = '' + let result.classfiles = [] + + " Get the argument after the rightmost occurrence of "-sourcepath". + let offset = strridx(a:makeprg, '-sourcepath') + if offset < 0 + return result + endif + let offset += 1 + strlen('-sourcepath') + let result.sourcepath = matchstr(strpart(a:makeprg, offset), '.\{-}\ze[ \t]') + + " Get the class file arguments, dropping the pathname prefix. + let offset = stridx(a:makeprg, a:dirname, offset) + if offset < 0 + return result + endif + + while offset > -1 + let candidate = matchstr(a:makeprg, '[^ \t]\{-}\.class\>', offset) + if empty(candidate) + break + endif + call add(result.classfiles, candidate) + let offset = stridx(a:makeprg, a:dirname, (1 + strlen(candidate) + offset)) + endwhile + + call sort(result.classfiles) + return result +endfunc + +func Test_compiler_spotbugs_makeprg() + let save_shellslash = &shellslash + set shellslash + + call assert_true(mkdir('Xspotbugs/src/tests/α/β/γ/δ', 'pR')) + call assert_true(mkdir('Xspotbugs/tests/α/β/γ/δ', 'pR')) + + let lines =<< trim END + // EOL comment. /* + abstract class + 𐌂1 /* Multiline comment. */ { + /* Multiline comment. */ // EOL comment. /* + static final String COMMENT_A_LIKE = "/*"; + { new Object() {/* Try globbing. */}; } + static { interface 𐌉𐌉1 {} } + static class 𐌂11 { interface 𐌉𐌉2 {} } + } + /* Multiline comment. */ // EOL comment. /* + final class 𐌂2 { + public static void main(String... aa) { + record 𐌓() {} + enum 𐌄 {} + } + } // class + END + + " THE EXPECTED RESULTS. + let results = {} + let results['Xspotbugs/src/tests/𐌂1.java'] = { + \ 'sourcepath': '%:p:h:S', + \ 'classfiles': sort([ + \ 'Xspotbugs/tests/𐌂1$1.class', + \ 'Xspotbugs/tests/𐌂1$1𐌉𐌉1.class', + \ 'Xspotbugs/tests/𐌂1$𐌂11$𐌉𐌉2.class', + \ 'Xspotbugs/tests/𐌂1$𐌂11.class', + \ 'Xspotbugs/tests/𐌂1.class', + \ 'Xspotbugs/tests/𐌂2$1𐌄.class', + \ 'Xspotbugs/tests/𐌂2$1𐌓.class', + \ 'Xspotbugs/tests/𐌂2.class']), + \ } + " No class file for an empty source file even with "-Xpkginfo:always". + let results['Xspotbugs/src/tests/package-info.java'] = { + \ 'sourcepath': '', + \ 'classfiles': [], + \ } + let results['Xspotbugs/src/tests/α/𐌂1.java'] = { + \ 'sourcepath': '%:p:h:h:S', + \ 'classfiles': sort([ + \ 'Xspotbugs/tests/α/𐌂1$1.class', + \ 'Xspotbugs/tests/α/𐌂1$1𐌉𐌉1.class', + \ 'Xspotbugs/tests/α/𐌂1$𐌂11$𐌉𐌉2.class', + \ 'Xspotbugs/tests/α/𐌂1$𐌂11.class', + \ 'Xspotbugs/tests/α/𐌂1.class', + \ 'Xspotbugs/tests/α/𐌂2$1𐌄.class', + \ 'Xspotbugs/tests/α/𐌂2$1𐌓.class', + \ 'Xspotbugs/tests/α/𐌂2.class']), + \ } + let results['Xspotbugs/src/tests/α/package-info.java'] = { + \ 'sourcepath': '%:p:h:S', + \ 'classfiles': ['Xspotbugs/tests/α/package-info.class'], + \ } + let results['Xspotbugs/src/tests/α/β/𐌂1.java'] = { + \ 'sourcepath': '%:p:h:h:h:S', + \ 'classfiles': sort([ + \ 'Xspotbugs/tests/α/β/𐌂1$1.class', + \ 'Xspotbugs/tests/α/β/𐌂1$1𐌉𐌉1.class', + \ 'Xspotbugs/tests/α/β/𐌂1$𐌂11$𐌉𐌉2.class', + \ 'Xspotbugs/tests/α/β/𐌂1$𐌂11.class', + \ 'Xspotbugs/tests/α/β/𐌂1.class', + \ 'Xspotbugs/tests/α/β/𐌂2$1𐌄.class', + \ 'Xspotbugs/tests/α/β/𐌂2$1𐌓.class', + \ 'Xspotbugs/tests/α/β/𐌂2.class']), + \ } + let results['Xspotbugs/src/tests/α/β/package-info.java'] = { + \ 'sourcepath': '%:p:h:S', + \ 'classfiles': ['Xspotbugs/tests/α/β/package-info.class'], + \ } + let results['Xspotbugs/src/tests/α/β/γ/𐌂1.java'] = { + \ 'sourcepath': '%:p:h:h:h:h:S', + \ 'classfiles': sort([ + \ 'Xspotbugs/tests/α/β/γ/𐌂1$1.class', + \ 'Xspotbugs/tests/α/β/γ/𐌂1$1𐌉𐌉1.class', + \ 'Xspotbugs/tests/α/β/γ/𐌂1$𐌂11$𐌉𐌉2.class', + \ 'Xspotbugs/tests/α/β/γ/𐌂1$𐌂11.class', + \ 'Xspotbugs/tests/α/β/γ/𐌂1.class', + \ 'Xspotbugs/tests/α/β/γ/𐌂2$1𐌄.class', + \ 'Xspotbugs/tests/α/β/γ/𐌂2$1𐌓.class', + \ 'Xspotbugs/tests/α/β/γ/𐌂2.class']), + \ } + let results['Xspotbugs/src/tests/α/β/γ/package-info.java'] = { + \ 'sourcepath': '%:p:h:S', + \ 'classfiles': ['Xspotbugs/tests/α/β/γ/package-info.class'], + \ } + let results['Xspotbugs/src/tests/α/β/γ/δ/𐌂1.java'] = { + \ 'sourcepath': '%:p:h:h:h:h:h:S', + \ 'classfiles': sort([ + \ 'Xspotbugs/tests/α/β/γ/δ/𐌂1$1.class', + \ 'Xspotbugs/tests/α/β/γ/δ/𐌂1$1𐌉𐌉1.class', + \ 'Xspotbugs/tests/α/β/γ/δ/𐌂1$𐌂11$𐌉𐌉2.class', + \ 'Xspotbugs/tests/α/β/γ/δ/𐌂1$𐌂11.class', + \ 'Xspotbugs/tests/α/β/γ/δ/𐌂1.class', + \ 'Xspotbugs/tests/α/β/γ/δ/𐌂2$1𐌄.class', + \ 'Xspotbugs/tests/α/β/γ/δ/𐌂2$1𐌓.class', + \ 'Xspotbugs/tests/α/β/γ/δ/𐌂2.class']), + \ } + let results['Xspotbugs/src/tests/α/β/γ/δ/package-info.java'] = { + \ 'sourcepath': '%:p:h:S', + \ 'classfiles': ['Xspotbugs/tests/α/β/γ/δ/package-info.class'], + \ } + + " MAKE CLASS FILES DISCOVERABLE! + let g:spotbugs_properties = { + \ 'sourceDirPath': 'src/tests', + \ 'classDirPath': 'tests', + \ } + + call assert_true(has_key(s:SpotBugsParseFilterMakePrg('Xspotbugs', ''), 'sourcepath')) + call assert_true(has_key(s:SpotBugsParseFilterMakePrg('Xspotbugs', ''), 'classfiles')) + + " Write 45 mock-up class files for 10 source files. + for [class_dir, src_dir, package] in [ + \ ['Xspotbugs/tests/', 'Xspotbugs/src/tests/', ''], + \ ['Xspotbugs/tests/α/', 'Xspotbugs/src/tests/α/', 'package α;'], + \ ['Xspotbugs/tests/α/β/', 'Xspotbugs/src/tests/α/β/', 'package α.β;'], + \ ['Xspotbugs/tests/α/β/γ/', 'Xspotbugs/src/tests/α/β/γ/', 'package α.β.γ;'], + \ ['Xspotbugs/tests/α/β/γ/δ/', 'Xspotbugs/src/tests/α/β/γ/δ/', 'package α.β.γ.δ;']] + for class_file in ['𐌂1$1.class', '𐌂1$1𐌉𐌉1.class', '𐌂1$𐌂11$𐌉𐌉2.class', + \ '𐌂1$𐌂11.class', '𐌂1.class', '𐌂2$1𐌄.class', '𐌂2$1𐌓.class', '𐌂2.class'] + call writefile(0zcafe.babe.0000.0041, class_dir .. class_file) + endfor + call writefile(0zcafe.babe.0000.0041, class_dir .. 'package-info.class') + + " Write Java source files. + let type_file = src_dir .. '𐌂1.java' + call writefile(insert(copy(lines), package), type_file) + let package_file = src_dir .. 'package-info.java' + call writefile([package], src_dir .. 'package-info.java') + + for s in ['on', 'off'] + execute 'syntax ' .. s + + execute 'edit ' .. type_file + compiler spotbugs + let result = s:SpotBugsParseFilterMakePrg('Xspotbugs', &l:makeprg) + call assert_equal(results[type_file].sourcepath, result.sourcepath) + call assert_equal(results[type_file].classfiles, result.classfiles) + bwipeout + + execute 'edit ' .. package_file + compiler spotbugs + let result = s:SpotBugsParseFilterMakePrg('Xspotbugs', &l:makeprg) + call assert_equal(results[package_file].sourcepath, result.sourcepath) + call assert_equal(results[package_file].classfiles, result.classfiles) + bwipeout + endfor + endfor + + let &shellslash = save_shellslash +endfunc + +" vim: shiftwidth=2 sts=2 expandtab -- cgit From 1536f79d86b9edac1100e58ad5fbc421d14bfaa1 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 29 Nov 2024 10:06:12 +0800 Subject: vim-patch:8.2.2993: 'fileencodings' default value should depend on 'encoding' (#31379) Problem: 'fileencodings' default value should depend on 'encoding'. (Gary Johnson) Solution: When 'encoding' is "utf-8" use a different default value for 'fileencodings'. https://github.com/vim/vim/commit/5ffefbb35aba2448099314a9e09714d2f3b2b1bd Co-authored-by: Bram Moolenaar --- test/old/testdir/test_options.vim | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_options.vim b/test/old/testdir/test_options.vim index b6bdb1be52..caafd9d820 100644 --- a/test/old/testdir/test_options.vim +++ b/test/old/testdir/test_options.vim @@ -2252,6 +2252,14 @@ func Test_opt_default() call assert_equal('vt', &formatoptions) set formatoptions&vim call assert_equal('tcq', &formatoptions) + + call assert_equal('ucs-bom,utf-8,default,latin1', &fencs) + set fencs=latin1 + set fencs& + call assert_equal('ucs-bom,utf-8,default,latin1', &fencs) + set fencs=latin1 + set all& + call assert_equal('ucs-bom,utf-8,default,latin1', &fencs) endfunc " Test for the 'cmdheight' option -- cgit From b1c907f21916dd3b16baeae9f68b1c3bcb3dcfd3 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 29 Nov 2024 10:12:30 +0800 Subject: vim-patch:9.1.0892: the max value of 'cmdheight' is limited by other tabpages (#31378) Problem: the max value of 'cmdheight' is limited by other tabpages Solution: Limit the maximum value of 'cmdheight' to the current tabpage only. (Milly) The Help says that cmdheight is local to the tab page, but says nothing about the maximum value depending on the state of all tab pages. Users may wonder why they can't increase cmdheight when there are still rows available on the current tab page. This PR changes the behavior of cmdheight so that its maximum value depends only on the state of the current tab page. Also, since magic numbers were embedded in various places with the minimum value of cmdheight being 1, we defined a constant to make it easier to understand. closes: vim/vim#16131 https://github.com/vim/vim/commit/2cddf0e85a7f8304476397e1c51dcd0e41835ac3 Cherry-pick Test_cmdheight_not_changed() from patch 9.0.0187. Co-authored-by: Milly --- test/old/testdir/test_options.vim | 35 ++++++++++++++++++++++++++++++++++- test/old/testdir/test_window_cmd.vim | 21 +++++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_options.vim b/test/old/testdir/test_options.vim index caafd9d820..c948846819 100644 --- a/test/old/testdir/test_options.vim +++ b/test/old/testdir/test_options.vim @@ -2263,13 +2263,46 @@ func Test_opt_default() endfunc " Test for the 'cmdheight' option -func Test_cmdheight() +func Test_opt_cmdheight() %bw! let ht = &lines set cmdheight=9999 call assert_equal(1, winheight(0)) call assert_equal(ht - 1, &cmdheight) set cmdheight& + + " The status line should be taken into account. + set laststatus=2 + set cmdheight=9999 + call assert_equal(ht - 2, &cmdheight) + set cmdheight& laststatus=1 " Accommodate Nvim default + + " The tabline should be taken into account only non-GUI. + set showtabline=2 + set cmdheight=9999 + if has('gui_running') + call assert_equal(ht - 1, &cmdheight) + else + call assert_equal(ht - 2, &cmdheight) + endif + set cmdheight& showtabline& + + " The 'winminheight' should be taken into account. + set winheight=3 winminheight=3 + split + set cmdheight=9999 + call assert_equal(ht - 8, &cmdheight) + %bw! + set cmdheight& winminheight& winheight& + + " Only the windows in the current tabpage are taken into account. + set winheight=3 winminheight=3 showtabline=0 + split + tabnew + set cmdheight=9999 + call assert_equal(ht - 3, &cmdheight) + %bw! + set cmdheight& winminheight& winheight& showtabline& endfunc " To specify a control character as an option value, '^' can be used diff --git a/test/old/testdir/test_window_cmd.vim b/test/old/testdir/test_window_cmd.vim index 8048fa6ff8..e173aa1e73 100644 --- a/test/old/testdir/test_window_cmd.vim +++ b/test/old/testdir/test_window_cmd.vim @@ -55,6 +55,27 @@ func Test_window_cmd_cmdwin_with_vsp() set ls&vim endfunc +func Test_cmdheight_not_changed() + throw 'Skipped: N/A' + set cmdheight=2 + set winminheight=0 + augroup Maximize + autocmd WinEnter * wincmd _ + augroup END + split + tabnew + tabfirst + call assert_equal(2, &cmdheight) + + tabonly! + only + set winminheight& cmdheight& + augroup Maximize + au! + augroup END + augroup! Maximize +endfunc + " Test for jumping to windows func Test_window_jump() new -- cgit From 4426a326e2441326e280a0478f83128e09305806 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 30 Nov 2024 11:17:59 +0100 Subject: vim-patch:9.1.0897: filetype: pyrex files are not detected Problem: filetype: pyrex files are not detected Solution: detect '*.pxi' and '*.pyx+' as pyrex filetype (user202729) References: https://cython.readthedocs.io/en/latest/src/userguide/language_basics.html#cython-file-types https://www.csse.canterbury.ac.nz/greg.ewing/python/Pyrex/version/Doc/Manual/using_with_c++.html closes: vim/vim#16136 https://github.com/vim/vim/commit/aa16b30552f0c6a00dcc761e3954cd5266bf106a Co-authored-by: user202729 <25191436+user202729@users.noreply.github.com> --- test/old/testdir/test_filetype.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 58064ea412..06ac59de20 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -610,7 +610,7 @@ func s:GetFilenameChecks() abort \ 'purescript': ['file.purs'], \ 'pymanifest': ['MANIFEST.in'], \ 'pyret': ['file.arr'], - \ 'pyrex': ['file.pyx', 'file.pxd'], + \ 'pyrex': ['file.pyx', 'file.pxd', 'file.pxi', 'file.pyx+'], \ 'python': ['file.py', 'file.pyw', '.pythonstartup', '.pythonrc', '.python_history', '.jline-jython.history', 'file.ptl', 'file.pyi', 'SConstruct'], \ 'ql': ['file.ql', 'file.qll'], \ 'qml': ['file.qml', 'file.qbs'], -- cgit From 1af1e918d30c062dfcb7d4ce2f4cfbca1d11e2ab Mon Sep 17 00:00:00 2001 From: glepnir Date: Sat, 30 Nov 2024 18:24:31 +0800 Subject: vim-patch:9.1.0896: completion list wrong after v9.1.0891 Problem: completion list wrong after v9.1.0891 Solution: update compl_mach_array after leader change (glepnir) compl_shown_match update not correct after refactoring in v9.1.0891 Unfortunately, this regressed what item is selected after leader change. So generate compl_match_array before updating compl_shown_match range, and split generate compl_match_array into range match_head fixes: https://github.com/vim/vim/issues/16128 closes: https://github.com/vim/vim/pull/16129 https://github.com/vim/vim/commit/a49c077a883b2566882df9069385ed1e1277ca64 --- test/old/testdir/test_popup.vim | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_popup.vim b/test/old/testdir/test_popup.vim index 601ba6c688..33e86678c8 100644 --- a/test/old/testdir/test_popup.vim +++ b/test/old/testdir/test_popup.vim @@ -1675,4 +1675,29 @@ func Test_pum_completeitemalign() call StopVimInTerminal(buf) endfunc +func Test_pum_keep_select() + CheckScreendump + let lines =<< trim END + set completeopt=menu,menuone,noinsert + END + call writefile(lines, 'Xscript', 'D') + let buf = RunVimInTerminal('-S Xscript', {}) + call TermWait(buf) + + call term_sendkeys(buf, "ggSFab\Five\find\film\\\") + call TermWait(buf, 50) + call VerifyScreenDump(buf, 'Test_pum_keep_select_01', {}) + call term_sendkeys(buf, "\\") + call TermWait(buf, 50) + + call term_sendkeys(buf, "S\\") + call TermWait(buf, 50) + call term_sendkeys(buf, "F") + call VerifyScreenDump(buf, 'Test_pum_keep_select_02', {}) + call term_sendkeys(buf, "\\") + + call TermWait(buf, 50) + call StopVimInTerminal(buf) +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From 9d174a7dace3004a069f474ed9c8ba4f3b97c5d8 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 30 Nov 2024 12:08:46 +0100 Subject: vim-patch:9.1.0898: runtime(compiler): pytest compiler not included Problem: runtime(compiler): pytest compiler not included Solution: include pytest compiler, update the compiler completion test (Konfekt) closes: vim/vim#16130 https://github.com/vim/vim/commit/3c2596a9e967910143d41fbb9615614ab36d43a7 Co-authored-by: Konfekt --- test/old/testdir/test_compiler.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_compiler.vim b/test/old/testdir/test_compiler.vim index 6b195b5efa..3ad6b365de 100644 --- a/test/old/testdir/test_compiler.vim +++ b/test/old/testdir/test_compiler.vim @@ -65,10 +65,10 @@ func Test_compiler_completion() call assert_match('^"compiler ' .. clist .. '$', @:) call feedkeys(":compiler p\\\"\", 'tx') - call assert_match('"compiler pandoc pbx perl\( p[a-z_]\+\)\+ pylint pyunit', @:) + call assert_match('"compiler pandoc pbx perl\( p[a-z_]\+\)\+ pyunit', @:) call feedkeys(":compiler! p\\\"\", 'tx') - call assert_match('"compiler! pandoc pbx perl\( p[a-z_]\+\)\+ pylint pyunit', @:) + call assert_match('"compiler! pandoc pbx perl\( p[a-z_]\+\)\+ pyunit', @:) endfunc func Test_compiler_error() -- cgit From fb689d7ebd680c4921f4ec617fe5e01cd09ba96c Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 2 Dec 2024 08:06:57 +0800 Subject: vim-patch:9.1.0899: default for 'backspace' can be set in C code (#31416) Problem: default for 'backspace' can be set in C code Solution: promote the default for 'backspace' from defaults.vim to the C code (Luca Saccarola) closes: vim/vim#16143 https://github.com/vim/vim/commit/959ef61430bdd8fb982b38bd3347d90251255cfc N/A patches: vim-patch:9.1.0895: default history value is too small vim-patch:075aeea: runtime(doc): document changed default value for 'history' Co-authored-by: Luca Saccarola --- test/old/testdir/setup.vim | 1 - test/old/testdir/test_autocmd.vim | 4 ++-- test/old/testdir/test_digraph.vim | 3 +++ test/old/testdir/test_ins_complete.vim | 2 +- test/old/testdir/test_options.vim | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/setup.vim b/test/old/testdir/setup.vim index e7b4bb1a88..b104d733f0 100644 --- a/test/old/testdir/setup.vim +++ b/test/old/testdir/setup.vim @@ -1,6 +1,5 @@ if exists('s:did_load') " Align Nvim defaults to Vim. - set backspace= set commentstring=/*\ %s\ */ set complete=.,w,b,u,t,i set define=^\\s*#\\s*define diff --git a/test/old/testdir/test_autocmd.vim b/test/old/testdir/test_autocmd.vim index 64599c869a..40c09e61ac 100644 --- a/test/old/testdir/test_autocmd.vim +++ b/test/old/testdir/test_autocmd.vim @@ -1198,8 +1198,8 @@ func Test_OptionSet() call assert_equal(g:opt[0], g:opt[1]) " 14: Setting option backspace through :let" - let g:options = [['backspace', '', '', '', 'eol,indent,start', 'global', 'set']] - let &bs = "eol,indent,start" + let g:options = [['backspace', 'indent,eol,start', 'indent,eol,start', 'indent,eol,start', '', 'global', 'set']] + let &bs = '' call assert_equal([], g:options) call assert_equal(g:opt[0], g:opt[1]) diff --git a/test/old/testdir/test_digraph.vim b/test/old/testdir/test_digraph.vim index 8fbcd4d8ca..ce5e1b2055 100644 --- a/test/old/testdir/test_digraph.vim +++ b/test/old/testdir/test_digraph.vim @@ -250,9 +250,12 @@ func Test_digraphs_option() call Put_Dig_BS("P","=") call assert_equal(['Р']+repeat(["₽"],2)+['П'], getline(line('.')-3,line('.'))) " Not a digraph: this is different from ! + let _bs = &bs + set bs= call Put_Dig_BS("a","\") call Put_Dig_BS("\","a") call assert_equal(['','a'], getline(line('.')-1,line('.'))) + let &bs = _bs " Grave call Put_Dig_BS("a","!") call Put_Dig_BS("!","e") diff --git a/test/old/testdir/test_ins_complete.vim b/test/old/testdir/test_ins_complete.vim index c02aa1db62..6cc894c28c 100644 --- a/test/old/testdir/test_ins_complete.vim +++ b/test/old/testdir/test_ins_complete.vim @@ -1509,7 +1509,7 @@ func Test_complete_item_refresh_always() set completefunc=Tcomplete exe "normal! iup\\\\\\\" call assert_equal('up', getline(1)) - call assert_equal(2, g:CallCount) + call assert_equal(6, g:CallCount) set completeopt& set completefunc& bw! diff --git a/test/old/testdir/test_options.vim b/test/old/testdir/test_options.vim index c948846819..3773775564 100644 --- a/test/old/testdir/test_options.vim +++ b/test/old/testdir/test_options.vim @@ -496,7 +496,7 @@ func Test_set_completion_string_values() " but don't exhaustively validate their results. call assert_equal('single', getcompletion('set ambw=', 'cmdline')[0]) call assert_match('light\|dark', getcompletion('set bg=', 'cmdline')[1]) - call assert_equal('indent', getcompletion('set backspace=', 'cmdline')[0]) + call assert_equal('indent,eol,start', getcompletion('set backspace=', 'cmdline')[0]) call assert_equal('yes', getcompletion('set backupcopy=', 'cmdline')[1]) call assert_equal('backspace', getcompletion('set belloff=', 'cmdline')[1]) call assert_equal('min:', getcompletion('set briopt=', 'cmdline')[1]) -- cgit From 3d3a99e69cda365cae9ad65831712301807a772b Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 3 Dec 2024 08:32:23 +0800 Subject: vim-patch:9.1.0900: Vim9: digraph_getlist() does not accept bool arg (#31431) Problem: Vim9: digraph_getlist() does not accept bool argument (Maxim Kim) Solution: accept boolean as first argument (Yegappan Lakshmanan) fixes: vim/vim#16154 closes: vim/vim#16159 https://github.com/vim/vim/commit/198ada3d9f48c6556d20c4115ec500555b118aad Co-authored-by: Yegappan Lakshmanan --- test/old/testdir/test_digraph.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_digraph.vim b/test/old/testdir/test_digraph.vim index ce5e1b2055..9c32b85f61 100644 --- a/test/old/testdir/test_digraph.vim +++ b/test/old/testdir/test_digraph.vim @@ -607,8 +607,10 @@ func Test_digraph_getlist_function() " of digraphs returned. call assert_equal(digraph_getlist()->len(), digraph_getlist(0)->len()) call assert_notequal(digraph_getlist()->len(), digraph_getlist(1)->len()) + call assert_equal(digraph_getlist()->len(), digraph_getlist(v:false)->len()) + call assert_notequal(digraph_getlist()->len(), digraph_getlist(v:true)->len()) - call assert_fails('call digraph_getlist(0z12)', 'E974: Using a Blob as a Number') + call assert_fails('call digraph_getlist(0z12)', 'E1212: Bool required for argument 1') endfunc -- cgit From b079a9d2e76062ee7275e35a4623108550e836a5 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 4 Dec 2024 17:49:12 +0800 Subject: vim-patch:9.1.0902: filetype: Conda configuration files are not recognized (#31445) Problem: filetype: Conda configuration files are not recognized Solution: detect '.condarc' and 'condarc' files as yaml filetype. (zeertzjq) closes: vim/vim#16162 https://github.com/vim/vim/commit/876de275cb3affa5910664cc52a5177c214313e8 --- test/old/testdir/test_filetype.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 06ac59de20..5a38f26902 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -886,7 +886,7 @@ func s:GetFilenameChecks() abort \ 'xslt': ['file.xsl', 'file.xslt'], \ 'yacc': ['file.yy', 'file.yxx', 'file.y++'], \ 'yaml': ['file.yaml', 'file.yml', 'file.eyaml', 'any/.bundle/config', '.clangd', '.clang-format', '.clang-tidy', 'file.mplstyle', 'matplotlibrc', 'yarn.lock', - \ '/home/user/.kube/config'], + \ '/home/user/.kube/config', '.condarc', 'condarc'], \ 'yang': ['file.yang'], \ 'yuck': ['file.yuck'], \ 'z8a': ['file.z8a'], -- cgit From 2f5e7cbac49ed2fde571c5bf85619afec624f8e8 Mon Sep 17 00:00:00 2001 From: glepnir Date: Thu, 5 Dec 2024 17:49:39 +0800 Subject: vim-patch:9.1.0905: Missing information in CompleteDone event (#31455) Problem: Missing information in CompleteDone event Solution: add complete_word and complete_type to v:event dict (glepnir) closes: vim/vim#16153 https://github.com/vim/vim/commit/1c5a120a701fcf558617c4e70b5a447778f0e51d --- test/old/testdir/test_ins_complete.vim | 85 ++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_ins_complete.vim b/test/old/testdir/test_ins_complete.vim index 6cc894c28c..bf7477f088 100644 --- a/test/old/testdir/test_ins_complete.vim +++ b/test/old/testdir/test_ins_complete.vim @@ -253,6 +253,91 @@ func Test_CompleteDoneNone() au! CompleteDone endfunc +func Test_CompleteDone_vevent_keys() + func OnDone() + let g:complete_word = get(v:event, 'complete_word', v:null) + let g:complete_type = get(v:event, 'complete_type', v:null) + endfunction + + autocmd CompleteDone * :call OnDone() + + func CompleteFunc(findstart, base) + if a:findstart + return col(".") + endif + return [#{word: "foo"}, #{word: "bar"}] + endfunc + set omnifunc=CompleteFunc + set completefunc=CompleteFunc + set completeopt+=menuone + + new + call feedkeys("A\\\", 'tx') + call assert_equal('', g:complete_word) + call assert_equal('omni', g:complete_type) + + call feedkeys("S\\\\", 'tx') + call assert_equal('foo', g:complete_word) + call assert_equal('omni', g:complete_type) + + call feedkeys("S\\\\\0", 'tx') + call assert_equal('bar', g:complete_word) + call assert_equal('omni', g:complete_type) + + call feedkeys("Shello vim visual v\\\", 'tx') + call assert_equal('', g:complete_word) + call assert_equal('keyword', g:complete_type) + + call feedkeys("Shello vim visual v\\\", 'tx') + call assert_equal('vim', g:complete_word) + call assert_equal('keyword', g:complete_type) + + call feedkeys("Shello vim visual v\\\", 'tx') + call assert_equal('vim', g:complete_word) + call assert_equal('keyword', g:complete_type) + + call feedkeys("Shello vim\completion test\\\\", 'tx') + call assert_equal('completion test', g:complete_word) + call assert_equal('whole_line', g:complete_type) + + call feedkeys("S\\\", 'tx') + call assert_equal('foo', g:complete_word) + call assert_equal('function', g:complete_type) + + inoremap call complete(1, ["red", "blue"]) + call feedkeys("S\\", 'tx') + call assert_equal('red', g:complete_word) + call assert_equal('eval', g:complete_type) + + call feedkeys("S\\\", 'tx') + call assert_equal('!', g:complete_word) + call assert_equal('cmdline', g:complete_type) + + call writefile([''], 'foo_test', 'D') + call feedkeys("Sfoo\\\\", 'tx') + call assert_equal('foo_test', g:complete_word) + call assert_equal('files', g:complete_type) + + call writefile(['hello help'], 'test_case.txt', 'D') + set dictionary=test_case.txt + call feedkeys("ggdGSh\\\\", 'tx') + call assert_equal('hello', g:complete_word) + call assert_equal('dictionary', g:complete_type) + + set spell spelllang=en_us + call feedkeys("STheatre\s\\", 'tx') + call assert_equal('Theater', g:complete_word) + call assert_equal('spell', g:complete_type) + + bwipe! + set completeopt& omnifunc& completefunc& spell& spelllang& dictionary& + autocmd! CompleteDone + delfunc OnDone + delfunc CompleteFunc + unlet g:complete_word + unlet g:complete_type +endfunc + func Test_CompleteDoneDict() au CompleteDonePre * :call CompleteDone_CheckCompletedItemDict(1) au CompleteDone * :call CompleteDone_CheckCompletedItemDict(0) -- cgit From 812d02970206d5a65819e076bcddedd92e083a19 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 6 Dec 2024 09:20:32 +0100 Subject: vim-patch:9.1.0906: filetype: Nvidia PTX files are not recognized Problem: filetype: Nvidia PTX files are not recognized Solution: detect '*.ptx' files as ptx filetype (Yinzuo Jiang) Reference: https://docs.nvidia.com/cuda/parallel-thread-execution/ closes: vim/vim#16171 https://github.com/vim/vim/commit/bdb5f85a5189534653f36e92b1bc780ca8d25218 Co-authored-by: Yinzuo Jiang --- test/old/testdir/test_filetype.vim | 1 + 1 file changed, 1 insertion(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 5a38f26902..7e6a6dfac5 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -605,6 +605,7 @@ func s:GetFilenameChecks() abort \ 'ps1xml': ['file.ps1xml'], \ 'psf': ['file.psf'], \ 'psl': ['file.psl'], + \ 'ptx': ['file.ptx'], \ 'pug': ['file.pug'], \ 'puppet': ['file.pp'], \ 'purescript': ['file.purs'], -- cgit From ec94c2704f5059794923777ed51412d80bd26b5b Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 7 Dec 2024 10:17:36 +0800 Subject: vim-patch:9.1.0908: not possible to configure :messages (#31492) Problem: not possible to configure :messages Solution: add the 'messagesopt' option (Shougo Matsushita) closes: vim/vim#16068 https://github.com/vim/vim/commit/51d4d84d6a7159c6ce9e04b36f8edc105ca3794b Co-authored-by: Shougo Matsushita Co-authored-by: h_east --- test/old/testdir/gen_opt_test.vim | 6 ++++- test/old/testdir/test_cmdline.vim | 26 --------------------- test/old/testdir/test_messages.vim | 47 ++++++++++++++++++++++++++++++++++++++ test/old/testdir/test_options.vim | 7 ++++-- 4 files changed, 57 insertions(+), 29 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/gen_opt_test.vim b/test/old/testdir/gen_opt_test.vim index be5a7e6ee4..74aea93ee9 100644 --- a/test/old/testdir/gen_opt_test.vim +++ b/test/old/testdir/gen_opt_test.vim @@ -117,7 +117,6 @@ let test_values = { "\ 'imstyle': [[0, 1], [-1, 2, 999]], \ 'lines': [[2, 24, 1000], [-1, 0, 1]], \ 'linespace': [[-1, 0, 2, 4, 999], ['']], - \ 'msghistory': [[0, 1, 100, 10000], [-1, 10001]], \ 'numberwidth': [[1, 4, 8, 10, 11, 20], [-1, 0, 21]], \ 'regexpengine': [[0, 1, 2], [-1, 3, 999]], \ 'report': [[0, 1, 2, 9999], [-1]], @@ -264,6 +263,11 @@ let test_values = { \ 'eol:\\u21b5', 'eol:\\U000021b5', 'eol:x,space:y'], \ ['xxx', 'eol:']], \ 'matchpairs': [['', '(:)', '(:),<:>'], ['xxx']], + \ 'messagesopt': [['hit-enter,history:1', 'hit-enter,history:10000', + \ 'history:100,wait:100', 'history:0,wait:0', + \ 'hit-enter,history:1,wait:1'], + \ ['xxx', 'history:500', 'hit-enter,history:-1', + \ 'hit-enter,history:10001', 'hit-enter']], \ 'mkspellmem': [['10000,100,12'], ['', 'xxx', '10000,100']], \ 'mouse': [['', 'n', 'v', 'i', 'c', 'h', 'a', 'r', 'nvi'], \ ['xxx', 'n,v,i']], diff --git a/test/old/testdir/test_cmdline.vim b/test/old/testdir/test_cmdline.vim index 2f34ecb414..cbce0e908d 100644 --- a/test/old/testdir/test_cmdline.vim +++ b/test/old/testdir/test_cmdline.vim @@ -4181,30 +4181,4 @@ func Test_cd_bslash_completion_windows() let &shellslash = save_shellslash endfunc -func Test_msghistory() - " After setting 'msghistory' to 2 and outputting a message 4 times with - " :echomsg, is the number of output lines of :messages 2? - set msghistory=2 - echomsg 'foo' - echomsg 'bar' - echomsg 'baz' - echomsg 'foobar' - call assert_equal(['baz', 'foobar'], GetMessages()) - - " When the number of messages is 10 and 'msghistory' is changed to 5, is the - " number of output lines of :messages 5? - set msghistory=10 - for num in range(1, 10) - echomsg num - endfor - set msghistory=5 - call assert_equal(5, len(GetMessages())) - - " Check empty list - set msghistory=0 - call assert_true(empty(GetMessages())) - - set msghistory& -endfunc - " vim: shiftwidth=2 sts=2 expandtab diff --git a/test/old/testdir/test_messages.vim b/test/old/testdir/test_messages.vim index ac5184645f..d79bc0fae7 100644 --- a/test/old/testdir/test_messages.vim +++ b/test/old/testdir/test_messages.vim @@ -216,6 +216,7 @@ endfunc " Test more-prompt (see :help more-prompt). func Test_message_more() CheckRunVimInTerminal + let buf = RunVimInTerminal('', {'rows': 6}) call term_sendkeys(buf, ":call setline(1, range(1, 100))\n") @@ -611,4 +612,50 @@ func Test_cmdheight_zero() tabonly endfunc +func Test_messagesopt_history() + " After setting 'messagesopt' "history" to 2 and outputting a message 4 times + " with :echomsg, is the number of output lines of :messages 2? + set messagesopt=hit-enter,history:2 + echomsg 'foo' + echomsg 'bar' + echomsg 'baz' + echomsg 'foobar' + call assert_equal(['baz', 'foobar'], GetMessages()) + + " When the number of messages is 10 and 'messagesopt' "history" is changed to + " 5, is the number of output lines of :messages 5? + set messagesopt=hit-enter,history:10 + for num in range(1, 10) + echomsg num + endfor + set messagesopt=hit-enter,history:5 + call assert_equal(5, len(GetMessages())) + + " Check empty list + set messagesopt=hit-enter,history:0 + call assert_true(empty(GetMessages())) + + set messagesopt& +endfunc + +func Test_messagesopt_wait() + CheckRunVimInTerminal + + let buf = RunVimInTerminal('', {'rows': 6, 'cols': 45}) + call term_sendkeys(buf, ":set cmdheight=1\n") + + " Check hit-enter prompt + call term_sendkeys(buf, ":set messagesopt=hit-enter,history:500\n") + call term_sendkeys(buf, ":echo 'foo' | echo 'bar' echo 'baz'\n") + call WaitForAssert({-> assert_equal('Press ENTER or type command to continue', term_getline(buf, 6))}) + + " Check no hit-enter prompt when "wait:" is set + call term_sendkeys(buf, ":set messagesopt=wait:100,history:500\n") + call term_sendkeys(buf, ":echo 'foo' | echo 'bar' echo 'baz'\n") + call WaitForAssert({-> assert_equal(' 0,0-1 All', term_getline(buf, 6))}) + + " clean up + call StopVimInTerminal(buf) +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/test/old/testdir/test_options.vim b/test/old/testdir/test_options.vim index 3773775564..d090186b62 100644 --- a/test/old/testdir/test_options.vim +++ b/test/old/testdir/test_options.vim @@ -644,6 +644,10 @@ func Test_set_completion_string_values() " call feedkeys(":set hl=8b i\\\\\"\", 'xt') " call assert_equal("\"set hl=8bi i", @:) + " messagesopt + call assert_equal(['history:', 'hit-enter', 'wait:'], + \ getcompletion('set messagesopt+=', 'cmdline')->sort()) + " " Test flag lists " @@ -743,7 +747,6 @@ func Test_set_option_errors() call assert_fails('set backupcopy=', 'E474:') call assert_fails('set regexpengine=3', 'E474:') call assert_fails('set history=10001', 'E474:') - call assert_fails('set msghistory=10001', 'E474:') call assert_fails('set numberwidth=21', 'E474:') call assert_fails('set colorcolumn=-a', 'E474:') call assert_fails('set colorcolumn=a', 'E474:') @@ -757,7 +760,6 @@ func Test_set_option_errors() endif call assert_fails('set helpheight=-1', 'E487:') call assert_fails('set history=-1', 'E487:') - call assert_fails('set msghistory=-1', 'E487:') call assert_fails('set report=-1', 'E487:') call assert_fails('set shiftwidth=-1', 'E487:') call assert_fails('set sidescroll=-1', 'E487:') @@ -2517,6 +2519,7 @@ func Test_string_option_revert_on_failure() \ ['lispoptions', 'expr:1', 'a123'], \ ['listchars', 'tab:->', 'tab:'], \ ['matchpairs', '<:>', '<:'], + \ ['messagesopt', 'hit-enter,history:100', 'a123'], \ ['mkspellmem', '100000,1000,100', '100000'], \ ['mouse', 'nvi', 'z'], \ ['mousemodel', 'extend', 'a123'], -- cgit From f3fa6507f2473d66a4c6172c82dec43bf55f8df6 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 8 Dec 2024 07:00:17 +0800 Subject: vim-patch:9.1.0910: 'messagesopt' does not check max wait time Problem: 'messagesopt' does not check max wait time (after v9.1.0908) Solution: Check for max wait value (Shougo Matsushita) closes: vim/vim#16183 https://github.com/vim/vim/commit/d9e9f89e0ffd6e7ce5e2a7f8f1ace5471e37c210 Co-authored-by: Shougo Matsushita --- test/old/testdir/gen_opt_test.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/gen_opt_test.vim b/test/old/testdir/gen_opt_test.vim index 74aea93ee9..22ffde5269 100644 --- a/test/old/testdir/gen_opt_test.vim +++ b/test/old/testdir/gen_opt_test.vim @@ -267,7 +267,8 @@ let test_values = { \ 'history:100,wait:100', 'history:0,wait:0', \ 'hit-enter,history:1,wait:1'], \ ['xxx', 'history:500', 'hit-enter,history:-1', - \ 'hit-enter,history:10001', 'hit-enter']], + \ 'hit-enter,history:10001', 'history:0,wait:10001', + \ 'hit-enter']], \ 'mkspellmem': [['10000,100,12'], ['', 'xxx', '10000,100']], \ 'mouse': [['', 'n', 'v', 'i', 'c', 'h', 'a', 'r', 'nvi'], \ ['xxx', 'n,v,i']], -- cgit From 96329910b011414758380e3c27e32c0ae7f43e1e Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 8 Dec 2024 07:01:59 +0800 Subject: vim-patch:9.1.0911: Variable name for 'messagesopt' doesn't match short name Problem: Variable name for 'messagesopt' doesn't match short name (after v9.1.0908) Solution: Change p_meo to p_mopt. Add more details to docs. closes: vim/vim#16182 https://github.com/vim/vim/commit/8cc43daee1f485c9abf1de3c638cce7835b9f861 --- test/old/testdir/test_messages.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_messages.vim b/test/old/testdir/test_messages.vim index d79bc0fae7..bfead20142 100644 --- a/test/old/testdir/test_messages.vim +++ b/test/old/testdir/test_messages.vim @@ -646,12 +646,12 @@ func Test_messagesopt_wait() " Check hit-enter prompt call term_sendkeys(buf, ":set messagesopt=hit-enter,history:500\n") - call term_sendkeys(buf, ":echo 'foo' | echo 'bar' echo 'baz'\n") + call term_sendkeys(buf, ":echo 'foo' | echo 'bar' | echo 'baz'\n") call WaitForAssert({-> assert_equal('Press ENTER or type command to continue', term_getline(buf, 6))}) " Check no hit-enter prompt when "wait:" is set call term_sendkeys(buf, ":set messagesopt=wait:100,history:500\n") - call term_sendkeys(buf, ":echo 'foo' | echo 'bar' echo 'baz'\n") + call term_sendkeys(buf, ":echo 'foo' | echo 'bar' | echo 'baz'\n") call WaitForAssert({-> assert_equal(' 0,0-1 All', term_getline(buf, 6))}) " clean up -- cgit From ca4f688ad4d6160e0ec0cb858a6559eb8a39b594 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 8 Dec 2024 17:53:01 +0800 Subject: vim-patch:9.1.0913: no error check for neg values for 'messagesopt' (#31511) Problem: no error check for neg values for 'messagesopt' (after v9.1.0908) Solution: add additional error checks and tests (h-east) closes: vim/vim#16187 https://github.com/vim/vim/commit/65be834c30fb43abb2e41585b41eefcd2ae06c01 Nvim's getdigits() checks for overflow, so the code change isn't needed. Co-authored-by: h-east --- test/old/testdir/gen_opt_test.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/gen_opt_test.vim b/test/old/testdir/gen_opt_test.vim index 22ffde5269..a2ad1eb8b4 100644 --- a/test/old/testdir/gen_opt_test.vim +++ b/test/old/testdir/gen_opt_test.vim @@ -268,7 +268,9 @@ let test_values = { \ 'hit-enter,history:1,wait:1'], \ ['xxx', 'history:500', 'hit-enter,history:-1', \ 'hit-enter,history:10001', 'history:0,wait:10001', - \ 'hit-enter']], + \ 'hit-enter', 'history:10,wait:99999999999999999999', + \ 'history:99999999999999999999,wait:10', 'wait:10', + \ 'history:-10', 'history:10,wait:-10']], \ 'mkspellmem': [['10000,100,12'], ['', 'xxx', '10000,100']], \ 'mouse': [['', 'n', 'v', 'i', 'c', 'h', 'a', 'r', 'nvi'], \ ['xxx', 'n,v,i']], -- cgit From 84d9f4f9f9efbfc72630f01f5f837c50fd7020d4 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 8 Dec 2024 20:29:25 +0800 Subject: vim-patch:9.1.0915: GVim: default font size a bit too small (#31516) Problem: GVim: default font size a bit too small Solution: increase guifont size to 12 pt on GTK builds of gVim (matveyt). fixes: vim/vim#16172 closes: vim/vim#16178 https://github.com/vim/vim/commit/ad3b6a3340a4ab02c1e5bc4a6d6a5fb858b671d3 Co-authored-by: matveyt --- test/old/testdir/runtest.vim | 4 ++++ test/old/testdir/test_highlight.vim | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/runtest.vim b/test/old/testdir/runtest.vim index 058635c332..3d210695c4 100644 --- a/test/old/testdir/runtest.vim +++ b/test/old/testdir/runtest.vim @@ -55,6 +55,10 @@ silent! endwhile " In the GUI we can always change the screen size. if has('gui_running') + if has('gui_gtk') + " to keep screendump size unchanged + set guifont=Monospace\ 10 + endif set columns=80 lines=25 endif diff --git a/test/old/testdir/test_highlight.vim b/test/old/testdir/test_highlight.vim index 0a64c63d30..56c7a9656f 100644 --- a/test/old/testdir/test_highlight.vim +++ b/test/old/testdir/test_highlight.vim @@ -785,8 +785,8 @@ func Test_1_highlight_Normalgroup_exists() if !has('gui_running') call assert_match('hi Normal\s*clear', hlNormal) elseif has('gui_gtk2') || has('gui_gnome') || has('gui_gtk3') - " expect is DEFAULT_FONT of gui_gtk_x11.c - call assert_match('hi Normal\s*font=Monospace 10', hlNormal) + " expect is DEFAULT_FONT of gui_gtk_x11.c (any size) + call assert_match('hi Normal\s*font=Monospace\>', hlNormal) elseif has('gui_motif') " expect is DEFAULT_FONT of gui_x11.c call assert_match('hi Normal\s*font=7x13', hlNormal) -- cgit From 2336389d236f3d80575a5139e92c551c005b0eff Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 10 Dec 2024 13:24:54 +0800 Subject: vim-patch:9.0.2112: [security]: overflow in shift_line Problem: [security]: overflow in shift_line Solution: allow a max indent of INT_MAX [security]: overflow in shift_line When shifting lines in operator pending mode and using a very large value, we may overflow the size of integer. Fix this by using a long variable, testing if the result would be larger than INT_MAX and if so, indent by INT_MAX value. Special case: We cannot use long here, since on 32bit architectures (or on Windows?), it typically cannot take larger values than a plain int, so we have to use long long count, decide whether the resulting multiplication of the shiftwidth value * amount is larger than INT_MAX and if so, we will store INT_MAX as possible larges value in the long long count variable. Then we can safely cast it back to int when calling the functions to set the indent (set_indent() or change_indent()). So this should be safe. Add a test that when using a huge value in operator pending mode for shifting, we will shift by INT_MAX closes: vim/vim#13535 https://github.com/vim/vim/commit/6bf131888a3d1de62bbfa8a7ea03c0ddccfd496e Skip the test for now, as it takes too long and requires other fixes. Co-authored-by: Christian Brabandt --- test/old/testdir/test_indent.vim | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_indent.vim b/test/old/testdir/test_indent.vim index dcacc11663..6afc3ff405 100644 --- a/test/old/testdir/test_indent.vim +++ b/test/old/testdir/test_indent.vim @@ -276,4 +276,16 @@ func Test_formatting_keeps_first_line_indent() bwipe! endfunc +" Test for indenting with large amount, causes overflow +func Test_indent_overflow_count() + throw 'skipped: TODO: ' + new + setl sw=8 + call setline(1, "abc") + norm! V2147483647> + " indents by INT_MAX + call assert_equal(2147483647, indent(1)) + close! +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From 7a7ed0c8ac2d66d695da5bd3f90536e8c5c11ccc Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 10 Dec 2024 13:52:40 +0800 Subject: vim-patch:9.0.2122: [security]: prevent overflow in indenting Problem: [security]: prevent overflow in indenting Solution: use long long and remove cast to (int) The shiftwidth option values are defined as being long. However, when calculating the actual amount of indent, we cast down to (int), which may cause the shiftwidth value to become negative and later it may even cause Vim to try to allocate a huge amount of memory. We already use long and long long variable types to calculate the indent (and detect possible overflows), so the cast to (int) seems superfluous and can be safely removed. So let's just remove the (int) cast and calculate the indent using longs. Additionally, the 'shiftwidth' option value is also used when determining the actual 'cino' options. There it can again cause another overflow, so make sure it is safe in parse_cino() as well. fixes: vim/vim#13554 closes: vim/vim#13555 https://github.com/vim/vim/commit/3770574e4a70e810add9929973c51f9070c8c851 Co-authored-by: Christian Brabandt --- test/old/testdir/test_indent.vim | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_indent.vim b/test/old/testdir/test_indent.vim index 6afc3ff405..0998b04443 100644 --- a/test/old/testdir/test_indent.vim +++ b/test/old/testdir/test_indent.vim @@ -288,4 +288,19 @@ func Test_indent_overflow_count() close! endfunc +func Test_indent_overflow_count2() + throw 'skipped: Nvim does not support 64-bit number options' + new + " this only works, when long is 64bits + try + setl sw=0x180000000 + catch /^Vim\%((\a\+)\)\=:E487:/ + throw 'Skipped: value negative on this platform' + endtry + call setline(1, "\tabc") + norm! << + call assert_equal(0, indent(1)) + close! +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From e4bb185441ca57b739775d3f01a13419d9299f29 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 10 Dec 2024 14:05:39 +0800 Subject: vim-patch:9.1.0917: various vartabstop and shiftround bugs when shifting lines Problem: various vartabstop and shiftround bugs when shifting lines Solution: Fix the bugs, add new tests for shifting lines in various ways (Gary Johnson) fixes: vim/vim#14891 closes: vim/vim#16193 https://github.com/vim/vim/commit/eed63f96d26723ff31a9728647eed526d06a553d Co-authored-by: Gary Johnson --- test/old/testdir/test_shift.vim | 807 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 803 insertions(+), 4 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_shift.vim b/test/old/testdir/test_shift.vim index ec357dac88..f31c5a11e6 100644 --- a/test/old/testdir/test_shift.vim +++ b/test/old/testdir/test_shift.vim @@ -108,10 +108,809 @@ func Test_ex_shift_errors() call assert_fails('>!', 'E477:') call assert_fails('', 'E493:') - call assert_fails('execute "2,1>"', 'E493:') - " call assert_fails('2,1<', 'E493:') - call assert_fails('execute "2,1<"', 'E493:') + call assert_fails('2,1>', 'E493:') + call assert_fails('2,1<', 'E493:') +endfunc + +" Test inserting a backspace at the start of a line. +" +" This is to verify the proper behavior of tabstop_start() as called from +" ins_bs(). +" +func Test_shift_ins_bs() + set backspace=indent,start + set softtabstop=11 + + call setline(1, repeat(" ", 33) . "word") + exe "norm! I\" + call assert_equal(repeat(" ", 22) . "word", getline(1)) + call setline(1, repeat(" ", 23) . "word") + exe "norm! I\" + call assert_equal(repeat(" ", 22) . "word", getline(1)) + exe "norm! I\" + call assert_equal(repeat(" ", 11) . "word", getline(1)) + + set backspace& softtabstop& + bw! +endfunc + +" Test inserting a backspace at the start of a line, with 'varsofttabstop'. +" +func Test_shift_ins_bs_vartabs() + CheckFeature vartabs + set backspace=indent,start + set varsofttabstop=13,11,7 + + call setline(1, repeat(" ", 44) . "word") + exe "norm! I\" + call assert_equal(repeat(" ", 38) . "word", getline(1)) + call setline(1, repeat(" ", 39) . "word") + exe "norm! I\" + call assert_equal(repeat(" ", 38) . "word", getline(1)) + exe "norm! I\" + call assert_equal(repeat(" ", 31) . "word", getline(1)) + exe "norm! I\" + call assert_equal(repeat(" ", 24) . "word", getline(1)) + exe "norm! I\" + call assert_equal(repeat(" ", 13) . "word", getline(1)) + exe "norm! I\" + call assert_equal( "word", getline(1)) + exe "norm! I\" + call assert_equal( "word", getline(1)) + + set backspace& varsofttabstop& + bw! +endfunc + +" Test the >> and << normal-mode commands. +" +func Test_shift_norm() + set expandtab " Don't want to worry about tabs vs. spaces in + " results. + + set shiftwidth=5 + set tabstop=7 + + call setline(1, " word") + + " Shift by 'shiftwidth' right and left. + + norm! >> + call assert_equal(repeat(" ", 7) . "word", getline(1)) + norm! >> + call assert_equal(repeat(" ", 12) . "word", getline(1)) + norm! >> + call assert_equal(repeat(" ", 17) . "word", getline(1)) + + norm! << + call assert_equal(repeat(" ", 12) . "word", getline(1)) + norm! << + call assert_equal(repeat(" ", 7) . "word", getline(1)) + norm! << + call assert_equal(repeat(" ", 2) . "word", getline(1)) + norm! << + call assert_equal(repeat(" ", 0) . "word", getline(1)) + + " Shift by 'tabstop' right and left. + + set shiftwidth=0 + call setline(1, " word") + + norm! >> + call assert_equal(repeat(" ", 9) . "word", getline(1)) + norm! >> + call assert_equal(repeat(" ", 16) . "word", getline(1)) + norm! >> + call assert_equal(repeat(" ", 23) . "word", getline(1)) + + norm! << + call assert_equal(repeat(" ", 16) . "word", getline(1)) + norm! << + call assert_equal(repeat(" ", 9) . "word", getline(1)) + norm! << + call assert_equal(repeat(" ", 2) . "word", getline(1)) + norm! << + call assert_equal(repeat(" ", 0) . "word", getline(1)) + + set expandtab& shiftwidth& tabstop& + bw! +endfunc + +" Test the >> and << normal-mode commands, with 'vartabstop'. +" +func Test_shift_norm_vartabs() + CheckFeature vartabs + set expandtab " Don't want to worry about tabs vs. spaces in + " results. + + set shiftwidth=0 + set vartabstop=19,17,11 + + " Shift by 'vartabstop' right and left. + + call setline(1, " word") + + norm! >> + call assert_equal(repeat(" ", 21) . "word", getline(1)) + norm! >> + call assert_equal(repeat(" ", 38) . "word", getline(1)) + norm! >> + call assert_equal(repeat(" ", 49) . "word", getline(1)) + norm! >> + call assert_equal(repeat(" ", 60) . "word", getline(1)) + + norm! << + call assert_equal(repeat(" ", 49) . "word", getline(1)) + norm! << + call assert_equal(repeat(" ", 38) . "word", getline(1)) + norm! << + call assert_equal(repeat(" ", 21) . "word", getline(1)) + norm! << + call assert_equal(repeat(" ", 2) . "word", getline(1)) + norm! << + call assert_equal(repeat(" ", 0) . "word", getline(1)) + + set expandtab& shiftwidth& vartabstop& + bw! +endfunc + +" Test the >> and << normal-mode commands with 'shiftround'. +" +func Test_shift_norm_round() + set expandtab " Don't want to worry about tabs vs. spaces in + " results. + + set shiftround + set shiftwidth=5 + set tabstop=7 + + call setline(1, "word") + + " Shift by 'shiftwidth' right and left. + + exe "norm! I " + norm! >> + call assert_equal(repeat(" ", 5) . "word", getline(1)) + exe "norm! I " + norm! >> + call assert_equal(repeat(" ", 10) . "word", getline(1)) + exe "norm! I " + norm! >> + call assert_equal(repeat(" ", 15) . "word", getline(1)) + norm! >> + call assert_equal(repeat(" ", 20) . "word", getline(1)) + norm! >> + call assert_equal(repeat(" ", 25) . "word", getline(1)) + + norm! << + call assert_equal(repeat(" ", 20) . "word", getline(1)) + norm! << + call assert_equal(repeat(" ", 15) . "word", getline(1)) + norm! << + call assert_equal(repeat(" ", 10) . "word", getline(1)) + exe "norm! I " + norm! << + call assert_equal(repeat(" ", 10) . "word", getline(1)) + + call setline(1, repeat(" ", 7) . "word") + norm! << + call assert_equal(repeat(" ", 5) . "word", getline(1)) + norm! << + call assert_equal(repeat(" ", 0) . "word", getline(1)) + norm! << + call assert_equal(repeat(" ", 0) . "word", getline(1)) + call setline(1, repeat(" ", 2) . "word") + norm! << + call assert_equal(repeat(" ", 0) . "word", getline(1)) + + " Shift by 'tabstop' right and left. + + set shiftwidth=0 + call setline(1, "word") + + exe "norm! I " + norm! >> + call assert_equal(repeat(" ", 7) . "word", getline(1)) + exe "norm! I " + norm! >> + call assert_equal(repeat(" ", 14) . "word", getline(1)) + exe "norm! I " + norm! >> + call assert_equal(repeat(" ", 21) . "word", getline(1)) + norm! >> + call assert_equal(repeat(" ", 28) . "word", getline(1)) + norm! >> + call assert_equal(repeat(" ", 35) . "word", getline(1)) + + norm! << + call assert_equal(repeat(" ", 28) . "word", getline(1)) + norm! << + call assert_equal(repeat(" ", 21) . "word", getline(1)) + norm! << + call assert_equal(repeat(" ", 14) . "word", getline(1)) + exe "norm! I " + norm! << + call assert_equal(repeat(" ", 14) . "word", getline(1)) + + call setline(1, repeat(" ", 9) . "word") + norm! << + call assert_equal(repeat(" ", 7) . "word", getline(1)) + norm! << + call assert_equal(repeat(" ", 0) . "word", getline(1)) + norm! << + call assert_equal(repeat(" ", 0) . "word", getline(1)) + call setline(1, repeat(" ", 2) . "word") + norm! << + call assert_equal(repeat(" ", 0) . "word", getline(1)) + + set expandtab& shiftround& shiftwidth& tabstop& + bw! +endfunc + +" Test the >> and << normal-mode commands with 'shiftround' and 'vartabstop'. +" +func Test_shift_norm_round_vartabs() + CheckFeature vartabs + set expandtab " Don't want to worry about tabs vs. spaces in + " results. + + set shiftround + set shiftwidth=0 + set vartabstop=19,17,11 + + " Shift by 'vartabstop' right and left. + + call setline(1, "word") + + exe "norm! I " + norm! >> + call assert_equal(repeat(" ", 19) . "word", getline(1)) + exe "norm! I " + norm! >> + call assert_equal(repeat(" ", 36) . "word", getline(1)) + exe "norm! I " + norm! >> + call assert_equal(repeat(" ", 47) . "word", getline(1)) + exe "norm! I " + norm! >> + call assert_equal(repeat(" ", 58) . "word", getline(1)) + + exe "norm! I " + norm! << + call assert_equal(repeat(" ", 58) . "word", getline(1)) + norm! << + call assert_equal(repeat(" ", 47) . "word", getline(1)) + norm! << + call assert_equal(repeat(" ", 36) . "word", getline(1)) + norm! << + call assert_equal(repeat(" ", 19) . "word", getline(1)) + exe "norm! I " + norm! << + call assert_equal(repeat(" ", 19) . "word", getline(1)) + norm! << + call assert_equal(repeat(" ", 0) . "word", getline(1)) + exe "norm! I " + call assert_equal(repeat(" ", 2) . "word", getline(1)) + norm! << + call assert_equal(repeat(" ", 0) . "word", getline(1)) + norm! << + call assert_equal(repeat(" ", 0) . "word", getline(1)) + + set expandtab& shiftround& shiftwidth& vartabstop& + bw! +endfunc + +" Test the V> and V< visual-mode commands. +" +" See ":help v_<" and ":help v_>". See also the last paragraph of "3. Simple +" changes", ":help simple-change", immediately above "4. Complex changes", +" ":help complex-change". +" +func Test_shift_vis() + set expandtab " Don't want to worry about tabs vs. spaces in + " results. + + set shiftwidth=5 + set tabstop=7 + + call setline(1, " word") + + " Shift by 'shiftwidth' right and left. + + norm! V> + call assert_equal(repeat(" ", 7) . "word", getline(1)) + norm! V2> + call assert_equal(repeat(" ", 17) . "word", getline(1)) + norm! V3> + call assert_equal(repeat(" ", 32) . "word", getline(1)) + + norm! V< + call assert_equal(repeat(" ", 27) . "word", getline(1)) + norm! V2< + call assert_equal(repeat(" ", 17) . "word", getline(1)) + norm! V3< + call assert_equal(repeat(" ", 2) . "word", getline(1)) + norm! V< + call assert_equal(repeat(" ", 0) . "word", getline(1)) + norm! V3< + call assert_equal(repeat(" ", 0) . "word", getline(1)) + + " Shift by 'tabstop' right and left. + + set shiftwidth=0 + call setline(1, " word") + + norm! V> + call assert_equal(repeat(" ", 9) . "word", getline(1)) + norm! V2> + call assert_equal(repeat(" ", 23) . "word", getline(1)) + norm! V3> + call assert_equal(repeat(" ", 44) . "word", getline(1)) + + norm! V< + call assert_equal(repeat(" ", 37) . "word", getline(1)) + norm! V2< + call assert_equal(repeat(" ", 23) . "word", getline(1)) + norm! V3< + call assert_equal(repeat(" ", 2) . "word", getline(1)) + norm! V< + call assert_equal(repeat(" ", 0) . "word", getline(1)) + norm! V3< + call assert_equal(repeat(" ", 0) . "word", getline(1)) + + set expandtab& shiftwidth& tabstop& + bw! +endfunc + +" Test the V> and V< visual-mode commands, with 'vartabstop'. +" +" See ":help v_<" and ":help v_>". See also the last paragraph of "3. Simple +" changes", ":help simple-change", immediately above "4. Complex changes", +" ":help complex-change". +" +func Test_shift_vis_vartabs() + CheckFeature vartabs + set expandtab " Don't want to worry about tabs vs. spaces in + " results. + + set shiftwidth=0 + set vartabstop=19,17,11 + + " Shift by 'vartabstop' right and left. + + call setline(1, " word") + + norm! V> + call assert_equal(repeat(" ", 21) . "word", getline(1)) + norm! V2> + call assert_equal(repeat(" ", 49) . "word", getline(1)) + norm! V3> + call assert_equal(repeat(" ", 82) . "word", getline(1)) + + norm! V< + call assert_equal(repeat(" ", 71) . "word", getline(1)) + norm! V2< + call assert_equal(repeat(" ", 49) . "word", getline(1)) + norm! V3< + call assert_equal(repeat(" ", 2) . "word", getline(1)) + norm! V< + call assert_equal(repeat(" ", 0) . "word", getline(1)) + norm! V3< + call assert_equal(repeat(" ", 0) . "word", getline(1)) + + set expandtab& shiftwidth& vartabstop& + bw! +endfunc + +" Test the V> and V< visual-mode commands with 'shiftround'. +" +func Test_shift_vis_round() + set expandtab " Don't want to worry about tabs vs. spaces in + " results. + + set shiftround + set shiftwidth=5 + set tabstop=7 + + call setline(1, "word") + + " Shift by 'shiftwidth' right and left. + + exe "norm! I " + norm! V> + call assert_equal(repeat(" ", 5) . "word", getline(1)) + exe "norm! I " + norm! V2> + call assert_equal(repeat(" ", 15) . "word", getline(1)) + exe "norm! I " + norm! V3> + call assert_equal(repeat(" ", 30) . "word", getline(1)) + + exe "norm! I " + norm! V2< + call assert_equal(repeat(" ", 25) . "word", getline(1)) + norm! V3< + call assert_equal(repeat(" ", 10) . "word", getline(1)) + norm! V< + call assert_equal(repeat(" ", 5) . "word", getline(1)) + norm! V< + call assert_equal(repeat(" ", 0) . "word", getline(1)) + norm! V3< + call assert_equal(repeat(" ", 0) . "word", getline(1)) + + " Shift by 'tabstop' right and left. + + set shiftwidth=0 + call setline(1, "word") + + exe "norm! I " + norm! V> + call assert_equal(repeat(" ", 7) . "word", getline(1)) + exe "norm! I " + norm! V2> + call assert_equal(repeat(" ", 21) . "word", getline(1)) + exe "norm! I " + norm! V3> + call assert_equal(repeat(" ", 42) . "word", getline(1)) + + exe "norm! I " + norm! V< + call assert_equal(repeat(" ", 42) . "word", getline(1)) + norm! V< + call assert_equal(repeat(" ", 35) . "word", getline(1)) + norm! V2< + call assert_equal(repeat(" ", 21) . "word", getline(1)) + norm! V3< + call assert_equal(repeat(" ", 0) . "word", getline(1)) + norm! V< + call assert_equal(repeat(" ", 0) . "word", getline(1)) + norm! V3< + call assert_equal(repeat(" ", 0) . "word", getline(1)) + + call setline(1, " word") + norm! V< + call assert_equal(repeat(" ", 0) . "word", getline(1)) + + + set expandtab& shiftround& shiftwidth& tabstop& + bw! +endfunc + +" Test the V> and V< visual-mode commands with 'shiftround' and 'vartabstop'. +" +func Test_shift_vis_round_vartabs() + CheckFeature vartabs + set expandtab " Don't want to worry about tabs vs. spaces in + " results. + + set shiftround + set shiftwidth=0 + set vartabstop=19,17,11 + + " Shift by 'vartabstop' right and left. + + call setline(1, "word") + + exe "norm! I " + norm! V> + call assert_equal(repeat(" ", 19) . "word", getline(1)) + exe "norm! I " + norm! V3> + call assert_equal(repeat(" ", 58) . "word", getline(1)) + + exe "norm! I " + norm! V2< + call assert_equal(repeat(" ", 47) . "word", getline(1)) + exe "norm! I " + norm! V3< + call assert_equal(repeat(" ", 19) . "word", getline(1)) + exe "norm! I " + norm! V3< + call assert_equal(repeat(" ", 0) . "word", getline(1)) + exe "norm! I " + norm! V< + call assert_equal(repeat(" ", 0) . "word", getline(1)) + + set expandtab& shiftround& shiftwidth& vartabstop& + bw! +endfunc + +" Test the :> and :< ex-mode commands. +" +func Test_shift_ex() + set expandtab " Don't want to worry about tabs vs. spaces in + " results. + + set shiftwidth=5 + set tabstop=7 + + call setline(1, " word") + + " Shift by 'shiftwidth' right and left. + + > + call assert_equal(repeat(" ", 7) . "word", getline(1)) + >> + call assert_equal(repeat(" ", 17) . "word", getline(1)) + >>> + call assert_equal(repeat(" ", 32) . "word", getline(1)) + + <<<< + call assert_equal(repeat(" ", 12) . "word", getline(1)) + < + call assert_equal(repeat(" ", 7) . "word", getline(1)) + < + call assert_equal(repeat(" ", 2) . "word", getline(1)) + < + call assert_equal(repeat(" ", 0) . "word", getline(1)) + + " Shift by 'tabstop' right and left. + + set shiftwidth=0 + call setline(1, " word") + + > + call assert_equal(repeat(" ", 9) . "word", getline(1)) + >> + call assert_equal(repeat(" ", 23) . "word", getline(1)) + >>> + call assert_equal(repeat(" ", 44) . "word", getline(1)) + + <<<< + call assert_equal(repeat(" ", 16) . "word", getline(1)) + << + call assert_equal(repeat(" ", 2) . "word", getline(1)) + < + call assert_equal(repeat(" ", 0) . "word", getline(1)) + + set expandtab& shiftwidth& tabstop& + bw! +endfunc + +" Test the :> and :< ex-mode commands, with vartabstop. +" +func Test_shift_ex_vartabs() + CheckFeature vartabs + set expandtab " Don't want to worry about tabs vs. spaces in + " results. + + set shiftwidth=0 + set vartabstop=19,17,11 + + " Shift by 'vartabstop' right and left. + + call setline(1, " word") + + > + call assert_equal(repeat(" ", 21) . "word", getline(1)) + >> + call assert_equal(repeat(" ", 49) . "word", getline(1)) + >>> + call assert_equal(repeat(" ", 82) . "word", getline(1)) + + <<<< + call assert_equal(repeat(" ", 38) . "word", getline(1)) + << + call assert_equal(repeat(" ", 2) . "word", getline(1)) + < + call assert_equal(repeat(" ", 0) . "word", getline(1)) + + set expandtab& shiftwidth& vartabstop& + bw! +endfunc + +" Test the :> and :< ex-mode commands with 'shiftround'. +" +func Test_shift_ex_round() + set expandtab " Don't want to worry about tabs vs. spaces in + " results. + + set shiftround + set shiftwidth=5 + set tabstop=7 + + call setline(1, "word") + + " Shift by 'shiftwidth' right and left. + + exe "norm! I " + > + call assert_equal(repeat(" ", 5) . "word", getline(1)) + exe "norm! I " + >> + call assert_equal(repeat(" ", 15) . "word", getline(1)) + exe "norm! I " + >>> + call assert_equal(repeat(" ", 30) . "word", getline(1)) + + exe "norm! I " + <<<< + call assert_equal(repeat(" ", 15) . "word", getline(1)) + exe "norm! I " + << + call assert_equal(repeat(" ", 10) . "word", getline(1)) + << + call assert_equal(repeat(" ", 0) . "word", getline(1)) + >> + <<< + call assert_equal(repeat(" ", 0) . "word", getline(1)) + + " Shift by 'tabstop' right and left. + + set shiftwidth=0 + call setline(1, "word") + + exe "norm! I " + > + call assert_equal(repeat(" ", 7) . "word", getline(1)) + exe "norm! I " + >> + call assert_equal(repeat(" ", 21) . "word", getline(1)) + exe "norm! I " + >>> + call assert_equal(repeat(" ", 42) . "word", getline(1)) + + exe "norm! I " + <<<< + call assert_equal(repeat(" ", 21) . "word", getline(1)) + exe "norm! I " + << + call assert_equal(repeat(" ", 14) . "word", getline(1)) + exe "norm! I " + <<< + call assert_equal(repeat(" ", 0) . "word", getline(1)) + >> + <<< + call assert_equal(repeat(" ", 0) . "word", getline(1)) + + set expandtab& shiftround& shiftwidth& tabstop& + bw! +endfunc + +" Test the :> and :< ex-mode commands with 'shiftround' and 'vartabstop'. +" +func Test_shift_ex_round_vartabs() + CheckFeature vartabs + set expandtab " Don't want to worry about tabs vs. spaces in + " results. + + set shiftround + set shiftwidth=0 + set vartabstop=19,17,11 + + " Shift by 'vartabstop' right and left. + + call setline(1, "word") + + exe "norm! I " + > + call assert_equal(repeat(" ", 19) . "word", getline(1)) + exe "norm! I " + >> + call assert_equal(repeat(" ", 47) . "word", getline(1)) + >>> + call assert_equal(repeat(" ", 80) . "word", getline(1)) + + <<<< + call assert_equal(repeat(" ", 36) . "word", getline(1)) + exe "norm! I " + << + call assert_equal(repeat(" ", 19) . "word", getline(1)) + exe "norm! I " + << + call assert_equal(repeat(" ", 0) . "word", getline(1)) + < + call assert_equal(repeat(" ", 0) . "word", getline(1)) + + set expandtab& shiftround& shiftwidth& vartabstop& + bw! +endfunc + +" Test shifting lines with and . +" +func Test_shift_ins() + set expandtab " Don't want to worry about tabs vs. spaces in + " results. + + set shiftwidth=5 + set tabstop=7 + + " Shift by 'shiftwidth' right and left. + + call setline(1, repeat(" ", 7) . "word") + exe "norm! 9|i\" + call assert_equal(repeat(" ", 10) . "word", getline(1)) + exe "norm! A\" + call assert_equal(repeat(" ", 15) . "word", getline(1)) + exe "norm! I \" + call assert_equal(repeat(" ", 20) . "word", getline(1)) + + exe "norm! I \" + call assert_equal(repeat(" ", 20) . "word", getline(1)) + exe "norm! I " + exe "norm! 24|i\" + call assert_equal(repeat(" ", 20) . "word", getline(1)) + exe "norm! A\" + call assert_equal(repeat(" ", 15) . "word", getline(1)) + exe "norm! I " + exe "norm! A\\" + call assert_equal(repeat(" ", 10) . "word", getline(1)) + exe "norm! I\\\" + call assert_equal(repeat(" ", 0) . "word", getline(1)) + exe "norm! I\" + call assert_equal(repeat(" ", 0) . "word", getline(1)) + + " Shift by 'tabstop' right and left. + + set shiftwidth=0 + call setline(1, "word") + + call setline(1, repeat(" ", 9) . "word") + exe "norm! 11|i\" + call assert_equal(repeat(" ", 14) . "word", getline(1)) + exe "norm! A\" + call assert_equal(repeat(" ", 21) . "word", getline(1)) + exe "norm! I \" + call assert_equal(repeat(" ", 28) . "word", getline(1)) + + exe "norm! I \" + call assert_equal(repeat(" ", 28) . "word", getline(1)) + exe "norm! I " + exe "norm! 32|i\" + call assert_equal(repeat(" ", 28) . "word", getline(1)) + exe "norm! A\" + call assert_equal(repeat(" ", 21) . "word", getline(1)) + exe "norm! I " + exe "norm! A\\" + call assert_equal(repeat(" ", 14) . "word", getline(1)) + exe "norm! I\\\" + call assert_equal(repeat(" ", 0) . "word", getline(1)) + exe "norm! I\" + call assert_equal(repeat(" ", 0) . "word", getline(1)) + + set expandtab& shiftwidth& tabstop& + bw! +endfunc + +" Test shifting lines with and , with 'vartabstop'. +" +func Test_shift_ins_vartabs() + CheckFeature vartabs + set expandtab " Don't want to worry about tabs vs. spaces in + " results. + + set shiftwidth=0 + set vartabstop=19,17,11 + + " Shift by 'vartabstop' right and left. + + call setline(1, "word") + + call setline(1, repeat(" ", 9) . "word") + exe "norm! 11|i\" + call assert_equal(repeat(" ", 19) . "word", getline(1)) + exe "norm! A\" + call assert_equal(repeat(" ", 36) . "word", getline(1)) + exe "norm! I \" + call assert_equal(repeat(" ", 47) . "word", getline(1)) + + exe "norm! I \" + call assert_equal(repeat(" ", 47) . "word", getline(1)) + exe "norm! I " + exe "norm! 51|i\" + call assert_equal(repeat(" ", 47) . "word", getline(1)) + exe "norm! A\" + call assert_equal(repeat(" ", 36) . "word", getline(1)) + exe "norm! I " + exe "norm! A\\" + call assert_equal(repeat(" ", 19) . "word", getline(1)) + exe "norm! I\\\" + call assert_equal(repeat(" ", 0) . "word", getline(1)) + exe "norm! I\" + call assert_equal(repeat(" ", 0) . "word", getline(1)) + + set expandtab& shiftwidth& vartabstop& + bw! endfunc " vim: shiftwidth=2 sts=2 expandtab -- cgit From 2e73ba102ac65f08fdbb6d2b87e90390abdca10c Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Thu, 12 Dec 2024 22:16:05 +0100 Subject: vim-patch:9.1.0919: filetype: some assembler files are not recognized Problem: filetype: some assembler are files not recognized Solution: detect '*.nasm' files as nasm filetype and '*.masm' as masm filetype (Wu, Zhenyu) closes: vim/vim#16194 https://github.com/vim/vim/commit/d66d68763d0947c292a9fdda4da6fda3650fa563 Co-authored-by: Wu, Zhenyu --- test/old/testdir/test_filetype.vim | 3 +++ 1 file changed, 3 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 7e6a6dfac5..d1551885b1 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -114,6 +114,7 @@ func s:GetFilenameChecks() abort \ 'arduino': ['file.ino', 'file.pde'], \ 'art': ['file.art'], \ 'asciidoc': ['file.asciidoc', 'file.adoc'], + \ 'asm': ['file.s', 'file.S', 'file.a', 'file.A'], \ 'asn': ['file.asn', 'file.asn1'], \ 'asterisk': ['asterisk/file.conf', 'asterisk/file.conf-file', 'some-asterisk/file.conf', 'some-asterisk/file.conf-file'], \ 'astro': ['file.astro'], @@ -453,6 +454,7 @@ func s:GetFilenameChecks() abort \ 'map': ['file.map'], \ 'maple': ['file.mv', 'file.mpl', 'file.mws'], \ 'markdown': ['file.markdown', 'file.mdown', 'file.mkd', 'file.mkdn', 'file.mdwn', 'file.md'], + \ 'masm': ['file.masm'], \ 'mason': ['file.mason', 'file.mhtml'], \ 'master': ['file.mas', 'file.master'], \ 'matlab': ['file.m'], @@ -529,6 +531,7 @@ func s:GetFilenameChecks() abort \ 'n1ql': ['file.n1ql', 'file.nql'], \ 'named': ['namedfile.conf', 'rndcfile.conf', 'named-file.conf', 'named.conf', 'rndc-file.conf', 'rndc-file.key', 'rndc.conf', 'rndc.key'], \ 'nanorc': ['/etc/nanorc', 'file.nanorc', 'any/etc/nanorc'], + \ 'nasm': ['file.nasm'], \ 'natural': ['file.NSA', 'file.NSC', 'file.NSG', 'file.NSL', 'file.NSM', 'file.NSN', 'file.NSP', 'file.NSS'], \ 'ncf': ['file.ncf'], \ 'neomuttlog': ['/home/user/.neomuttdebug1'], -- cgit From 6c2c77b128e74c69be0d4fd79637c742f7eaba34 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 15 Dec 2024 12:04:33 +0100 Subject: vim-patch:9.1.0926: filetype: Pixi lock files are not recognized Problem: filetype: Pixi lock files are not recognized Solution: detect "pixi.lock" file as yaml filetype (Brandon Maier) Reference: https://pixi.sh/latest/features/lockfile/ closes: vim/vim#16212 https://github.com/vim/vim/commit/7d1bb90dcf711c732a49e0a45e56028a4853a17d Co-authored-by: Brandon Maier --- test/old/testdir/test_filetype.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index d1551885b1..222cdb9504 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -890,7 +890,7 @@ func s:GetFilenameChecks() abort \ 'xslt': ['file.xsl', 'file.xslt'], \ 'yacc': ['file.yy', 'file.yxx', 'file.y++'], \ 'yaml': ['file.yaml', 'file.yml', 'file.eyaml', 'any/.bundle/config', '.clangd', '.clang-format', '.clang-tidy', 'file.mplstyle', 'matplotlibrc', 'yarn.lock', - \ '/home/user/.kube/config', '.condarc', 'condarc'], + \ '/home/user/.kube/config', '.condarc', 'condarc', 'pixi.lock'], \ 'yang': ['file.yang'], \ 'yuck': ['file.yuck'], \ 'z8a': ['file.z8a'], -- cgit From cc38630d39d2aa99183756d55849117daf6dfbfa Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 15 Dec 2024 19:27:12 +0100 Subject: vim-patch:9.1.0929: filetype: lalrpop files are not recognized Problem: filetype: lalrpop files are not recognized Solution: detect '*.lalrpop' files as lalrpop filetype (David Thievon) References: https://github.com/lalrpop/lalrpop closes: vim/vim#16223 https://github.com/vim/vim/commit/5a2e0cf5f11c611c9b01f1bd6e7294edf0dd2bf4 Co-authored-by: David Thievon --- test/old/testdir/test_filetype.vim | 1 + 1 file changed, 1 insertion(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 222cdb9504..18957da220 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -404,6 +404,7 @@ func s:GetFilenameChecks() abort \ 'kscript': ['file.ks'], \ 'kwt': ['file.k'], \ 'lace': ['file.ace', 'file.ACE'], + \ 'lalrpop': ['file.lalrpop'], \ 'latte': ['file.latte', 'file.lte'], \ 'ld': ['file.ld', 'any/usr/lib/aarch64-xilinx-linux/ldscripts/aarch64elf32b.x'], \ 'ldapconf': ['ldap.conf', '.ldaprc', 'ldaprc'], -- cgit From 167a2383b9966ac227a77b0221088246e14ce75a Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 16 Dec 2024 04:00:20 -0800 Subject: fix(api): not using TRY_WRAP, generic error messages #31595 Problem: - API functions using `try_start` directly instead of `TRY_WRAP`, do not surface the underlying error message, and instead show generic things like "Failed to set buffer". - Error handling code is duplicated in the API impl, instead of delegating to the vim buffer/window handling logic. Solution: - Use `TRY_WRAP`. --- test/old/testdir/test_winfixbuf.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_winfixbuf.vim b/test/old/testdir/test_winfixbuf.vim index 1777bec184..cc8ff86fa1 100644 --- a/test/old/testdir/test_winfixbuf.vim +++ b/test/old/testdir/test_winfixbuf.vim @@ -2613,7 +2613,7 @@ EOF try pyxdo test_winfixbuf_Test_pythonx_pyxdo_set_buffer() - catch /pynvim\.api\.common\.NvimError: E1513:/ + catch /pynvim\.api\.common\.NvimError: Vim:E1513:/ let l:caught = 1 endtry @@ -2644,7 +2644,7 @@ func Test_pythonx_pyxfile() try pyxfile file.py - catch /pynvim\.api\.common\.NvimError: E1513:/ + catch /pynvim\.api\.common\.NvimError: Vim:E1513:/ let l:caught = 1 endtry @@ -2676,7 +2676,7 @@ import vim buffer = vim.vars["_previous_buffer"] vim.current.buffer = vim.buffers[buffer] EOF - catch /pynvim\.api\.common\.NvimError: E1513:/ + catch /pynvim\.api\.common\.NvimError: Vim:E1513:/ let l:caught = 1 endtry -- cgit From 15153c4cd5319652bcdcd608fe5d4f0fa1eb9419 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 17 Dec 2024 09:03:26 +0800 Subject: vim-patch:9.1.0938: exclusive selection not respected when re-selecting block mode (#31603) Problem: exclusive selection not respected when re-selecting block mode (Matt Ellis) Solution: advance selection by another character when using selection=exclusive and visual block mode fixes: vim/vim#16202 closes: vim/vim#16219 https://github.com/vim/vim/commit/bb955894734b287abfadd3a25786a42038d18d61 Co-authored-by: Christian Brabandt --- test/old/testdir/test_visual.vim | 46 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_visual.vim b/test/old/testdir/test_visual.vim index e25327ddd4..39388cbc27 100644 --- a/test/old/testdir/test_visual.vim +++ b/test/old/testdir/test_visual.vim @@ -2718,4 +2718,50 @@ func Test_visual_block_cursor_insert_enter() bwipe! endfunc +func Test_visual_block_exclusive_selection() + new + set selection=exclusive + call setline(1, ['asöd asdf', 'asdf asdf', 'as€d asdf', 'asdf asdf']) + call cursor(1, 1) + exe ":norm! \eh3j~" + call assert_equal(['ASÖd asdf', 'ASDf asdf', 'AS€d asdf', 'ASDf asdf'], getline(1, '$')) + exe ":norm! 1v~" + call assert_equal(['asöd asdf', 'asdf asdf', 'as€d asdf', 'asdf asdf'], getline(1, '$')) + bwipe! + set selection&vim +endfunc + +func Test_visual_block_exclusive_selection_adjusted() + new + " Test that the end-position of the visual selection is adjusted for exclusive selection + set selection=exclusive + call setline(1, ['asöd asdf ', 'asdf asdf ', 'as€d asdf ', 'asdf asdf ']) + call cursor(1, 1) + " inclusive motion + exe ":norm! \e3jy" + call assert_equal([0, 4, 5, 0], getpos("'>")) + " exclusive motion + exe ":norm! \ta3jy" + call assert_equal([0, 4, 6, 0], getpos("'>")) + " another inclusive motion + exe ":norm! \g_3jy" + call assert_equal([0, 4, 10, 0], getpos("'>")) + + " Reset selection option to Vim default + set selection&vim + call cursor(1, 1) + + " inclusive motion + exe ":norm! \e3jy" + call assert_equal([0, 4, 4, 0], getpos("'>")) + " exclusive motion + exe ":norm! \ta3jy" + call assert_equal([0, 4, 5, 0], getpos("'>")) + " another inclusive motion + exe ":norm! \g_3jy" + call assert_equal([0, 4, 9, 0], getpos("'>")) + bwipe! + set selection&vim +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From b03e790cddd19b57fa91f4fbfcc30c28f3c173bf Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 17 Dec 2024 11:34:30 +0800 Subject: vim-patch:9.1.0934: hard to view an existing buffer in the preview window (#31605) Problem: hard to view an existing buffer in the preview window Solution: add the :pbuffer command (Yinzuo Jiang) Similar as `:pedit` and `:buffer` command. `:pbuffer` edits buffer [N] from the buffer list in the preview window. `:pbuffer` can also open special buffer, for example terminal buffer. closes: vim/vim#16222 https://github.com/vim/vim/commit/a2a2fe841ed2efdbb1f8055f752a3a4d0988ae9d Cherry-pick Test_popup_and_previewwindow_dump() changes from patch 9.0.0625. Cherry-pick Run_noroom_for_newwindow_test() changes from patches 8.2.0432 and 9.0.0363. Co-authored-by: Yinzuo Jiang --- test/old/testdir/test_popup.vim | 33 +++++++++++++++++-------- test/old/testdir/test_preview.vim | 47 ++++++++++++++++++++++++++++++------ test/old/testdir/test_statusline.vim | 4 +++ test/old/testdir/test_window_cmd.vim | 31 ++++++++++++------------ test/old/testdir/test_winfixbuf.vim | 12 +++++++++ 5 files changed, 95 insertions(+), 32 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_popup.vim b/test/old/testdir/test_popup.vim index 33e86678c8..a24e133ce6 100644 --- a/test/old/testdir/test_popup.vim +++ b/test/old/testdir/test_popup.vim @@ -748,17 +748,11 @@ func Test_popup_and_preview_autocommand() bw! endfunc -func Test_popup_and_previewwindow_dump() +func s:run_popup_and_previewwindow_dump(lines, dumpfile) CheckScreendump CheckFeature quickfix - let lines =<< trim END - set previewheight=9 - silent! pedit - call setline(1, map(repeat(["ab"], 10), "v:val .. v:key")) - exec "norm! G\\" - END - call writefile(lines, 'Xscript') + call writefile(a:lines, 'Xscript', 'D') let buf = RunVimInTerminal('-S Xscript', {}) " wait for the script to finish @@ -768,11 +762,30 @@ func Test_popup_and_previewwindow_dump() call term_sendkeys(buf, "o") call TermWait(buf, 50) call term_sendkeys(buf, "\\") - call VerifyScreenDump(buf, 'Test_popup_and_previewwindow_01', {}) + call VerifyScreenDump(buf, a:dumpfile, {}) call term_sendkeys(buf, "\u") call StopVimInTerminal(buf) - call delete('Xscript') +endfunc + +func Test_popup_and_previewwindow_dump_pedit() + let lines =<< trim END + set previewheight=9 + silent! pedit + call setline(1, map(repeat(["ab"], 10), "v:val .. v:key")) + exec "norm! G\\" + END + call s:run_popup_and_previewwindow_dump(lines, 'Test_popup_and_previewwindow_pedit') +endfunc + +func Test_popup_and_previewwindow_dump_pbuffer() + let lines =<< trim END + set previewheight=9 + silent! pbuffer + call setline(1, map(repeat(["ab"], 10), "v:val .. v:key")) + exec "norm! G\\\" + END + call s:run_popup_and_previewwindow_dump(lines, 'Test_popup_and_previewwindow_pbuffer') endfunc func Test_balloon_split() diff --git a/test/old/testdir/test_preview.vim b/test/old/testdir/test_preview.vim index b7b908e761..d24b09b7d2 100644 --- a/test/old/testdir/test_preview.vim +++ b/test/old/testdir/test_preview.vim @@ -15,6 +15,20 @@ func Test_Psearch() bwipe endfunc +func s:goto_preview_and_close() + " Go to the preview window + wincmd P + call assert_equal(1, &previewwindow) + call assert_equal('preview', win_gettype()) + + " Close preview window + wincmd z + call assert_equal(1, winnr('$')) + call assert_equal(0, &previewwindow) + + call assert_fails('wincmd P', 'E441:') +endfunc + func Test_window_preview() CheckFeature quickfix @@ -23,17 +37,36 @@ func Test_window_preview() call assert_equal(2, winnr('$')) call assert_equal(0, &previewwindow) - " Go to the preview window - wincmd P - call assert_equal(1, &previewwindow) - call assert_equal('preview', win_gettype()) + call s:goto_preview_and_close() +endfunc - " Close preview window - wincmd z +func Test_window_preview_from_pbuffer() + CheckFeature quickfix + + call writefile(['/* some C code */'], 'Xpreview.c', 'D') + edit Xpreview.c + const buf_num = bufnr('%') + enew call assert_equal(1, winnr('$')) + exe 'pbuffer ' . buf_num + call assert_equal(2, winnr('$')) call assert_equal(0, &previewwindow) - call assert_fails('wincmd P', 'E441:') + call s:goto_preview_and_close() +endfunc + +func Test_window_preview_terminal() + CheckFeature quickfix + " CheckFeature terminal + + term " ++curwin + const buf_num = bufnr('$') + call assert_equal(1, winnr('$')) + exe 'pbuffer' . buf_num + call assert_equal(2, winnr('$')) + call assert_equal(0, &previewwindow) + + call s:goto_preview_and_close() endfunc func Test_window_preview_from_help() diff --git a/test/old/testdir/test_statusline.vim b/test/old/testdir/test_statusline.vim index c8162ced07..c9f79dfef7 100644 --- a/test/old/testdir/test_statusline.vim +++ b/test/old/testdir/test_statusline.vim @@ -220,6 +220,10 @@ func Test_statusline() wincmd j call assert_match('^\[Preview\],PRV\s*$', s:get_statusline()) pclose + pbuffer + wincmd j + call assert_match('^\[Preview\],PRV\s*$', s:get_statusline()) + pclose " %y: Type of file in the buffer, e.g., "[vim]". See 'filetype'. " %Y: Type of file in the buffer, e.g., ",VIM". See 'filetype'. diff --git a/test/old/testdir/test_window_cmd.vim b/test/old/testdir/test_window_cmd.vim index e173aa1e73..343bc9fd83 100644 --- a/test/old/testdir/test_window_cmd.vim +++ b/test/old/testdir/test_window_cmd.vim @@ -1185,20 +1185,20 @@ func Run_noroom_for_newwindow_test(dir_arg) let dir = (a:dir_arg == 'v') ? 'vert ' : '' " Open as many windows as possible - for i in range(500) + while v:true try exe dir . 'new' catch /E36:/ break endtry - endfor + endwhile - call writefile(['first', 'second', 'third'], 'Xfile1') - call writefile([], 'Xfile2') - call writefile([], 'Xfile3') + call writefile(['first', 'second', 'third'], 'Xnorfile1') + call writefile([], 'Xnorfile2') + call writefile([], 'Xnorfile3') " Argument list related commands - args Xfile1 Xfile2 Xfile3 + args Xnorfile1 Xnorfile2 Xnorfile3 next for cmd in ['sargument 2', 'snext', 'sprevious', 'sNext', 'srewind', \ 'sfirst', 'slast'] @@ -1209,13 +1209,13 @@ func Run_noroom_for_newwindow_test(dir_arg) " Buffer related commands set modified hide enew - for cmd in ['sbuffer Xfile1', 'sbnext', 'sbprevious', 'sbNext', 'sbrewind', + for cmd in ['sbuffer Xnorfile1', 'sbnext', 'sbprevious', 'sbNext', 'sbrewind', \ 'sbfirst', 'sblast', 'sball', 'sbmodified', 'sunhide'] call assert_fails(dir .. cmd, 'E36:') endfor " Window related commands - for cmd in ['split', 'split Xfile2', 'new', 'new Xfile3', 'sview Xfile1', + for cmd in ['split', 'split Xnorfile2', 'new', 'new Xnorfile3', 'sview Xnorfile1', \ 'sfind runtest.vim'] call assert_fails(dir .. cmd, 'E36:') endfor @@ -1238,7 +1238,8 @@ func Run_noroom_for_newwindow_test(dir_arg) call assert_fails(dir .. 'lopen', 'E36:') " Preview window - call assert_fails(dir .. 'pedit Xfile2', 'E36:') + call assert_fails(dir .. 'pedit Xnorfile2', 'E36:') + call assert_fails(dir .. 'pbuffer', 'E36:') call setline(1, 'abc') call assert_fails(dir .. 'psearch abc', 'E36:') endif @@ -1246,15 +1247,15 @@ func Run_noroom_for_newwindow_test(dir_arg) " Window commands (CTRL-W ^ and CTRL-W f) if a:dir_arg == 'h' call assert_fails('call feedkeys("\^", "xt")', 'E36:') - call setline(1, 'Xfile1') + call setline(1, 'Xnorfile1') call assert_fails('call feedkeys("gg\f", "xt")', 'E36:') endif enew! " Tag commands (:stag, :stselect and :stjump) call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", - \ "second\tXfile1\t2", - \ "third\tXfile1\t3",], + \ "second\tXnorfile1\t2", + \ "third\tXnorfile1\t3",], \ 'Xtags') set tags=Xtags call assert_fails(dir .. 'stag second', 'E36:') @@ -1276,9 +1277,9 @@ func Run_noroom_for_newwindow_test(dir_arg) endif %bwipe! - call delete('Xfile1') - call delete('Xfile2') - call delete('Xfile3') + call delete('Xnorfile1') + call delete('Xnorfile2') + call delete('Xnorfile3') only endfunc diff --git a/test/old/testdir/test_winfixbuf.vim b/test/old/testdir/test_winfixbuf.vim index cc8ff86fa1..f7986fdda3 100644 --- a/test/old/testdir/test_winfixbuf.vim +++ b/test/old/testdir/test_winfixbuf.vim @@ -2545,6 +2545,18 @@ func Test_pedit() call assert_equal(l:other, bufnr()) endfunc +" Allow :pbuffer because, unlike :buffer, it uses a separate window +func Test_pbuffer() + call s:reset_all_buffers() + + let l:other = s:make_buffer_pairs() + + exe 'pbuffer ' . l:other + + execute "normal \w" + call assert_equal(l:other, bufnr()) +endfunc + " Fail :pop but :pop! is allowed func Test_pop() call s:reset_all_buffers() -- cgit From c830901e8cde49467d1c99c2d656a13e51979790 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 17 Dec 2024 12:40:30 +0800 Subject: vim-patch:9.1.0936: cannot highlight completed text Problem: cannot highlight completed text Solution: (optionally) highlight auto-completed text using the ComplMatchIns highlight group (glepnir) closes: vim/vim#16173 https://github.com/vim/vim/commit/6a38aff218f5b99a1aed7edaa357df24b9092734 Co-authored-by: glepnir --- test/old/testdir/test_popup.vim | 45 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_popup.vim b/test/old/testdir/test_popup.vim index a24e133ce6..4f5b769ace 100644 --- a/test/old/testdir/test_popup.vim +++ b/test/old/testdir/test_popup.vim @@ -1713,4 +1713,49 @@ func Test_pum_keep_select() call StopVimInTerminal(buf) endfunc +func Test_pum_matchins_higlight() + CheckScreendump + let lines =<< trim END + func Omni_test(findstart, base) + if a:findstart + return col(".") + endif + return [#{word: "foo"}, #{word: "bar"}, #{word: "你好"}] + endfunc + set omnifunc=Omni_test + hi ComplMatchIns ctermfg=red + END + call writefile(lines, 'Xscript', 'D') + let buf = RunVimInTerminal('-S Xscript', {}) + + call TermWait(buf) + call term_sendkeys(buf, "S\\") + call VerifyScreenDump(buf, 'Test_pum_matchins_01', {}) + call term_sendkeys(buf, "\\") + + call TermWait(buf) + call term_sendkeys(buf, "S\\\") + call VerifyScreenDump(buf, 'Test_pum_matchins_02', {}) + call term_sendkeys(buf, "\\") + + call TermWait(buf) + call term_sendkeys(buf, "S\\\\") + call VerifyScreenDump(buf, 'Test_pum_matchins_03', {}) + call term_sendkeys(buf, "\\") + + " restore after accept + call TermWait(buf) + call term_sendkeys(buf, "S\\\") + call VerifyScreenDump(buf, 'Test_pum_matchins_04', {}) + call term_sendkeys(buf, "\\") + + " restore after cancel completion + call TermWait(buf) + call term_sendkeys(buf, "S\\\") + call VerifyScreenDump(buf, 'Test_pum_matchins_05', {}) + call term_sendkeys(buf, "\\") + + call StopVimInTerminal(buf) +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From 2f7b385f2ef61626bc034bd6f3a25f5ec9f3a1f3 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 18 Dec 2024 07:34:52 +0800 Subject: vim-patch:9.1.0941: ComplMatchIns doesn't work after multibyte chars Problem: ComplMatchIns doesn't work after multibyte chars (after v9.1.0936) Solution: Use (ptr - line) instead of wlv.col (zeertzjq). closes: vim/vim#16233 https://github.com/vim/vim/commit/f4ccada5c372b2c14cc32490860c6995cd00268c --- test/old/testdir/test_popup.vim | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_popup.vim b/test/old/testdir/test_popup.vim index 4f5b769ace..de8674dad0 100644 --- a/test/old/testdir/test_popup.vim +++ b/test/old/testdir/test_popup.vim @@ -1729,29 +1729,29 @@ func Test_pum_matchins_higlight() let buf = RunVimInTerminal('-S Xscript', {}) call TermWait(buf) - call term_sendkeys(buf, "S\\") + call term_sendkeys(buf, "Sαβγ \\") call VerifyScreenDump(buf, 'Test_pum_matchins_01', {}) call term_sendkeys(buf, "\\") call TermWait(buf) - call term_sendkeys(buf, "S\\\") + call term_sendkeys(buf, "Sαβγ \\\") call VerifyScreenDump(buf, 'Test_pum_matchins_02', {}) call term_sendkeys(buf, "\\") call TermWait(buf) - call term_sendkeys(buf, "S\\\\") + call term_sendkeys(buf, "Sαβγ \\\\") call VerifyScreenDump(buf, 'Test_pum_matchins_03', {}) call term_sendkeys(buf, "\\") " restore after accept call TermWait(buf) - call term_sendkeys(buf, "S\\\") + call term_sendkeys(buf, "Sαβγ \\\") call VerifyScreenDump(buf, 'Test_pum_matchins_04', {}) call term_sendkeys(buf, "\\") " restore after cancel completion call TermWait(buf) - call term_sendkeys(buf, "S\\\") + call term_sendkeys(buf, "Sαβγ \\\") call VerifyScreenDump(buf, 'Test_pum_matchins_05', {}) call term_sendkeys(buf, "\\") -- cgit From b7da54aa9e72a0c7684546439f078ed89ba16d0a Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 18 Dec 2024 07:49:13 +0800 Subject: vim-patch:9.1.0942: a few typos were found Problem: a few typos were found Solution: fix them (zeertzjq) closes: vim/vim#16232 https://github.com/vim/vim/commit/d32bf0a06762f9ad08334d67b4d7f235f87f9063 --- test/old/testdir/test_popup.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_popup.vim b/test/old/testdir/test_popup.vim index de8674dad0..28104bdff5 100644 --- a/test/old/testdir/test_popup.vim +++ b/test/old/testdir/test_popup.vim @@ -1713,7 +1713,7 @@ func Test_pum_keep_select() call StopVimInTerminal(buf) endfunc -func Test_pum_matchins_higlight() +func Test_pum_matchins_highlight() CheckScreendump let lines =<< trim END func Omni_test(findstart, base) -- cgit From f7c42433c55203a1421276b33b6d3fedd652ca7e Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 18 Dec 2024 09:04:32 +0800 Subject: vim-patch:9.1.0940: Wrong cursor shape with "gq" and 'indentexpr' executes :normal (#31616) Problem: Wrong cursor shape with "gq" and 'indentexpr' executes :normal Solution: Update cursor and mouse shape after restoring old_State. (zeertzjq) closes: vim/vim#16241 Solution: Update cursor and mouse shape after restoring old_State. https://github.com/vim/vim/commit/6c3027744e71937b24829135ba072090d7d52bc3 --- test/old/testdir/test_indent.vim | 49 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_indent.vim b/test/old/testdir/test_indent.vim index 0998b04443..36670a0472 100644 --- a/test/old/testdir/test_indent.vim +++ b/test/old/testdir/test_indent.vim @@ -1,5 +1,8 @@ " Test for various indent options +source shared.vim +source check.vim + func Test_preserveindent() new " Test for autoindent copying indent from the previous line @@ -303,4 +306,50 @@ func Test_indent_overflow_count2() close! endfunc +" Test that mouse shape is restored to Normal mode after using "gq" when +" 'indentexpr' executes :normal. +func Test_indent_norm_with_gq() + CheckFeature mouseshape + CheckCanRunGui + + let lines =<< trim END + func Indent() + exe "normal! \" + return 0 + endfunc + + setlocal indentexpr=Indent() + END + call writefile(lines, 'Xindentexpr.vim', 'D') + + let lines =<< trim END + vim9script + var mouse_shapes = [] + + setline(1, [repeat('a', 80), repeat('b', 80)]) + + feedkeys('ggVG') + timer_start(50, (_) => { + mouse_shapes += [getmouseshape()] + timer_start(50, (_) => { + feedkeys('gq') + timer_start(50, (_) => { + mouse_shapes += [getmouseshape()] + timer_start(50, (_) => { + writefile(mouse_shapes, 'Xmouseshapes') + quit! + }) + }) + }) + }) + END + call writefile(lines, 'Xmouseshape.vim', 'D') + + call RunVim([], [], "-g -S Xindentexpr.vim -S Xmouseshape.vim") + call WaitForAssert({-> assert_equal(['rightup-arrow', 'arrow'], + \ readfile('Xmouseshapes'))}, 300) + + call delete('Xmouseshapes') +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From 738320188ffc389f1dc04f67a06c280f2d4ae41d Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 18 Dec 2024 10:21:52 +0800 Subject: test(old): fix incorrect comment in test_preview.vim (#31619) --- test/old/testdir/test_preview.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_preview.vim b/test/old/testdir/test_preview.vim index d24b09b7d2..424d93f54d 100644 --- a/test/old/testdir/test_preview.vim +++ b/test/old/testdir/test_preview.vim @@ -59,7 +59,8 @@ func Test_window_preview_terminal() CheckFeature quickfix " CheckFeature terminal - term " ++curwin + " term ++curwin + term const buf_num = bufnr('$') call assert_equal(1, winnr('$')) exe 'pbuffer' . buf_num -- cgit From 02bc40c19401ea9f7529cbc81bd18bd01c39bb3c Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 19 Dec 2024 07:59:03 +0800 Subject: vim-patch:9.1.0945: ComplMatchIns highlight doesn't end after inserted text (#31628) Problem: ComplMatchIns highlight doesn't end after inserted text. Solution: Handle ComplMatchIns highlight more like search highlight. Fix off-by-one error. Handle deleting text properly. (zeertzjq) closes: vim/vim#16244 https://github.com/vim/vim/commit/f25d8f9312a24da2727671560a865888812ab8d9 --- test/old/testdir/test_indent.vim | 2 +- test/old/testdir/test_popup.vim | 58 ++++++++++++++++++++++++++++++++++++++-- 2 files changed, 57 insertions(+), 3 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_indent.vim b/test/old/testdir/test_indent.vim index 36670a0472..630beed810 100644 --- a/test/old/testdir/test_indent.vim +++ b/test/old/testdir/test_indent.vim @@ -308,7 +308,7 @@ endfunc " Test that mouse shape is restored to Normal mode after using "gq" when " 'indentexpr' executes :normal. -func Test_indent_norm_with_gq() +func Test_mouse_shape_indent_norm_with_gq() CheckFeature mouseshape CheckCanRunGui diff --git a/test/old/testdir/test_popup.vim b/test/old/testdir/test_popup.vim index 28104bdff5..f16a897b07 100644 --- a/test/old/testdir/test_popup.vim +++ b/test/old/testdir/test_popup.vim @@ -1747,13 +1747,67 @@ func Test_pum_matchins_highlight() call TermWait(buf) call term_sendkeys(buf, "Sαβγ \\\") call VerifyScreenDump(buf, 'Test_pum_matchins_04', {}) - call term_sendkeys(buf, "\\") + call term_sendkeys(buf, "\") " restore after cancel completion call TermWait(buf) call term_sendkeys(buf, "Sαβγ \\\") call VerifyScreenDump(buf, 'Test_pum_matchins_05', {}) - call term_sendkeys(buf, "\\") + call term_sendkeys(buf, "\") + + " text after the inserted text shouldn't be highlighted + call TermWait(buf) + call term_sendkeys(buf, "0ea \\") + call VerifyScreenDump(buf, 'Test_pum_matchins_07', {}) + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_pum_matchins_08', {}) + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_pum_matchins_09', {}) + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_pum_matchins_10', {}) + call term_sendkeys(buf, "\") + + call StopVimInTerminal(buf) +endfunc + +func Test_pum_matchins_highlight_combine() + CheckScreendump + let lines =<< trim END + func Omni_test(findstart, base) + if a:findstart + return col(".") + endif + return [#{word: "foo"}, #{word: "bar"}, #{word: "你好"}] + endfunc + set omnifunc=Omni_test + hi Normal ctermbg=blue + hi CursorLine cterm=underline ctermbg=green + set cursorline + call setline(1, 'aaa bbb') + END + call writefile(lines, 'Xscript', 'D') + let buf = RunVimInTerminal('-S Xscript', {}) + + " when ComplMatchIns is not set, CursorLine applies normally + call term_sendkeys(buf, "0ea \\") + call VerifyScreenDump(buf, 'Test_pum_matchins_combine_01', {}) + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_pum_matchins_combine_02', {}) + call term_sendkeys(buf, "\\") + + " when ComplMatchIns is set, it is applied over CursorLine + call TermWait(buf) + call term_sendkeys(buf, ":hi ComplMatchIns ctermbg=red ctermfg=yellow\") + call TermWait(buf) + call term_sendkeys(buf, "0ea \\") + call VerifyScreenDump(buf, 'Test_pum_matchins_combine_03', {}) + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_pum_matchins_combine_04', {}) + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_pum_matchins_combine_05', {}) + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_pum_matchins_combine_06', {}) + call term_sendkeys(buf, "\") call StopVimInTerminal(buf) endfunc -- cgit From 8ef41f590224dfeea2e51d9fec150e363fd72ee0 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Thu, 19 Dec 2024 07:07:04 -0800 Subject: feat(jobs): jobstart(…,{term=true}), deprecate termopen() #31343 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: `termopen` has long been a superficial wrapper around `jobstart`, and has no real purpose. Also, `vim.system` and `nvim_open_term` presumably will replace all features of `jobstart` and `termopen`, so centralizing the logic will help with that. Solution: - Introduce `eval/deprecated.c`, where all deprecated eval funcs will live. - Introduce "term" flag of `jobstart`. - Deprecate `termopen`. --- test/old/testdir/runnvim.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/runnvim.vim b/test/old/testdir/runnvim.vim index 578614c8a1..f5945aeaee 100644 --- a/test/old/testdir/runnvim.vim +++ b/test/old/testdir/runnvim.vim @@ -8,6 +8,7 @@ function s:logger.on_exit(id, data, event) endfunction let s:logger.env = #{VIMRUNTIME: $VIMRUNTIME} +let s:logger.term = v:true " Replace non-printable chars by special sequence, or "<%x>". let s:escaped_char = {"\n": '\n', "\r": '\r', "\t": '\t'} @@ -25,7 +26,7 @@ function Main() set lines=25 set columns=80 enew - let job = termopen(args, s:logger) + let job = jobstart(args, s:logger) let results = jobwait([job], 5 * 60 * 1000) " TODO(ZyX-I): Get colors let screen = getline(1, '$') -- cgit From 889f9a0c5d1f3fe522af0d2b43a82317b0589b94 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 20 Dec 2024 08:04:46 +0800 Subject: vim-patch:9.1.0948: Missing cmdline completion for :pbuffer (#31645) Problem: Missing cmdline completion for :pbuffer. Solution: Add cmdline completion for :pbuffer like :buffer. (zeertzjq) fixes: vim/vim#16250 closes: vim/vim#16251 https://github.com/vim/vim/commit/3baf19a2b144b215c5b537c3c1b3b80a79b0fe99 --- test/old/testdir/test_preview.vim | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_preview.vim b/test/old/testdir/test_preview.vim index 424d93f54d..422c50ac77 100644 --- a/test/old/testdir/test_preview.vim +++ b/test/old/testdir/test_preview.vim @@ -47,12 +47,23 @@ func Test_window_preview_from_pbuffer() edit Xpreview.c const buf_num = bufnr('%') enew + + call feedkeys(":pbuffer Xpre\\\"\", 'xt') + call assert_equal("\"pbuffer Xpreview.c", @:) + call assert_equal(1, winnr('$')) exe 'pbuffer ' . buf_num call assert_equal(2, winnr('$')) call assert_equal(0, &previewwindow) call s:goto_preview_and_close() + + call assert_equal(1, winnr('$')) + pbuffer Xpreview.c + call assert_equal(2, winnr('$')) + call assert_equal(0, &previewwindow) + + call s:goto_preview_and_close() endfunc func Test_window_preview_terminal() -- cgit From 0fea57bc7127f4e160c1d66cb3ec910c9ec409a6 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 20 Dec 2024 19:56:22 +0100 Subject: vim-patch:9.1.0950: filetype: fennelrc files are not recognized Problem: filetype: fennelrc files are not recognized Solution: detect 'fennelrc' files as fennel filetype (Wu Zhenyu) References: https://github.com/bakpakin/Fennel/issues/193 closes: vim/vim#16262 https://github.com/vim/vim/commit/f173f4249fc785fb3e2b341bcfb0f21192cd4bf5 Co-authored-by: Wu, Zhenyu --- test/old/testdir/test_filetype.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 18957da220..bc8c388983 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -273,7 +273,7 @@ func s:GetFilenameChecks() abort \ 'falcon': ['file.fal'], \ 'fan': ['file.fan', 'file.fwt'], \ 'faust': ['file.dsp', 'file.lib'], - \ 'fennel': ['file.fnl'], + \ 'fennel': ['file.fnl', '.fennelrc', 'fennelrc'], \ 'fetchmail': ['.fetchmailrc'], \ 'fgl': ['file.4gl', 'file.4gh', 'file.m4gl'], \ 'firrtl': ['file.fir'], -- cgit From c7a4197a5c344f02241eed0761c86487ee5bbd96 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 22 Dec 2024 11:15:12 +0100 Subject: vim-patch:9.1.0951: filetype: jshell files are not recognized Problem: filetype: jshell files are not recognized Solution: detect '*.jsh' files as java filetype (Konfekt) closes: vim/vim#16260 https://github.com/vim/vim/commit/62e3014ab1146d7f78694c97fc6974f1af2cc5af Co-authored-by: Konfekt --- test/old/testdir/test_filetype.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index bc8c388983..7b7e3bdbfb 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -374,7 +374,7 @@ func s:GetFilenameChecks() abort \ 'jal': ['file.jal', 'file.JAL'], \ 'jam': ['file.jpl', 'file.jpr', 'JAM-file.file', 'JAM.file', 'Prl-file.file', 'Prl.file'], \ 'janet': ['file.janet'], - \ 'java': ['file.java', 'file.jav'], + \ 'java': ['file.java', 'file.jav', 'file.jsh'], \ 'javacc': ['file.jj', 'file.jjt'], \ 'javascript': ['file.js', 'file.jsm', 'file.javascript', 'file.es', 'file.mjs', 'file.cjs', '.node_repl_history', '.bun_repl_history', 'deno_history.txt'], \ 'javascript.glimmer': ['file.gjs'], -- cgit From 665a0e85c4788cb2847e270c333c0aee306f07ad Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 22 Dec 2024 15:15:57 +0100 Subject: vim-patch:9.1.0953: filetype: APKBUILD files not correctly detected Problem: filetype: APKBUILD files not correctly detected Solution: detect 'APKBUILD' files as apkbuild filetype, include a apkbuild syntax script (which basically just sources the sh.vim syntax file) (Hugo Osvaldo Barrera) Vim plugins (e.g.: ALE, nvim-lspconfig, etc) rely on filetype to determine which integrations/helpers are applicable. They expect filetype=apkbuild for APKBUILD files. On the other hand, plugins also enable bash-specific linters and functionality when filetype=bash, but APKBUILD files are POSIX sh, not bash, so these often provide bogus results. Change the filetype for APKBUILD to a 'apkbuild', so that tools and ftplugin can properly target these files. This filetype will use the existing `sh` syntax rules, since these are applicable for them. https://github.com/vim/vim/commit/7cb24917a112ba473cb351bdcdc48b8adbd46793 Co-authored-by: Hugo Osvaldo Barrera' via vim_dev --- test/old/testdir/test_filetype.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 7b7e3bdbfb..eb4d14c800 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -108,6 +108,7 @@ func s:GetFilenameChecks() abort \ '/etc/httpd/sites-some/file', '/etc/httpd/conf.file/conf'], \ 'apachestyle': ['/etc/proftpd/file.config,/etc/proftpd/conf.file/file', '/etc/proftpd/conf.file/file', '/etc/proftpd/file.conf', '/etc/proftpd/file.conf-file', \ 'any/etc/proftpd/conf.file/file', 'any/etc/proftpd/file.conf', 'any/etc/proftpd/file.conf-file', 'proftpd.conf', 'proftpd.conf-file'], + \ 'apkbuild': ['APKBUILD'], \ 'applescript': ['file.scpt'], \ 'aptconf': ['apt.conf', '/.aptitude/config', 'any/.aptitude/config'], \ 'arch': ['.arch-inventory', '=tagging-method'], @@ -680,7 +681,7 @@ func s:GetFilenameChecks() abort \ 'setserial': ['/etc/serial.conf', 'any/etc/serial.conf'], \ 'sexplib': ['file.sexp'], \ 'sh': ['.bashrc', '.bash_profile', '.bash-profile', '.bash_logout', '.bash-logout', '.bash_aliases', '.bash-aliases', '.bash_history', '.bash-history', - \ '/tmp/bash-fc-3Ozjlw', '/tmp/bash-fc.3Ozjlw', 'PKGBUILD', 'APKBUILD', 'file.bash', '/usr/share/doc/bash-completion/filter.sh', + \ '/tmp/bash-fc-3Ozjlw', '/tmp/bash-fc.3Ozjlw', 'PKGBUILD', 'file.bash', '/usr/share/doc/bash-completion/filter.sh', \ '/etc/udev/cdsymlinks.conf', 'any/etc/udev/cdsymlinks.conf', 'file.bats', '.ash_history', 'any/etc/neofetch/config.conf', '.xprofile', \ 'user-dirs.defaults', 'user-dirs.dirs', 'makepkg.conf', '.makepkg.conf', 'file.mdd', 'file.cygport', '.env', '.envrc', 'devscripts.conf', \ '.devscripts', 'file.lo', 'file.la', 'file.lai'], -- cgit From 14ee1de7e58276be4b80bc262cd0435eb9eeb01c Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 24 Dec 2024 10:31:35 +0100 Subject: vim-patch:9.1.0958: filetype: supertux2 config files detected as lisp Problem: filetype: supertux2 config files detected as lisp Solution: detect supertux2 config files as scheme instead (Wu, Zhenyu) References: https://github.com/SuperTux/supertux/wiki/S-Expression supertux uses #t and #f as bool type, which is same as scheme, not common lisp closes: vim/vim#16287 https://github.com/vim/vim/commit/e62d93ead10b4c5818e3c0b7551f1784d24bfe33 Co-authored-by: Wu, Zhenyu --- test/old/testdir/test_filetype.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index eb4d14c800..93fdb7fd27 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -426,7 +426,7 @@ func s:GetFilenameChecks() abort \ 'limits': ['/etc/limits', '/etc/anylimits.conf', '/etc/anylimits.d/file.conf', '/etc/limits.conf', '/etc/limits.d/file.conf', '/etc/some-limits.conf', '/etc/some-limits.d/file.conf', 'any/etc/limits', 'any/etc/limits.conf', 'any/etc/limits.d/file.conf', 'any/etc/some-limits.conf', 'any/etc/some-limits.d/file.conf'], \ 'liquidsoap': ['file.liq'], \ 'liquid': ['file.liquid'], - \ 'lisp': ['file.lsp', 'file.lisp', 'file.asd', 'file.el', '.emacs', '.sawfishrc', 'sbclrc', '.sbclrc', 'file.stsg', 'any/local/share/supertux2/config'], + \ 'lisp': ['file.lsp', 'file.lisp', 'file.asd', 'file.el', '.emacs', '.sawfishrc', 'sbclrc', '.sbclrc'], \ 'lite': ['file.lite', 'file.lt'], \ 'litestep': ['/LiteStep/any/file.rc', 'any/LiteStep/any/file.rc'], \ 'logcheck': ['/etc/logcheck/file.d-some/file', '/etc/logcheck/file.d/file', 'any/etc/logcheck/file.d-some/file', 'any/etc/logcheck/file.d/file'], @@ -668,7 +668,7 @@ func s:GetFilenameChecks() abort \ 'sather': ['file.sa'], \ 'sbt': ['file.sbt'], \ 'scala': ['file.scala'], - \ 'scheme': ['file.scm', 'file.ss', 'file.sld'], + \ 'scheme': ['file.scm', 'file.ss', 'file.sld', 'file.stsg', 'any/local/share/supertux2/config'], \ 'scilab': ['file.sci', 'file.sce'], \ 'screen': ['.screenrc', 'screenrc'], \ 'scss': ['file.scss'], -- cgit From 05eca4c04d4d2cc6ad3a2af69d76085135e9b16c Mon Sep 17 00:00:00 2001 From: glepnir Date: Tue, 24 Dec 2024 18:12:50 +0800 Subject: vim-patch:9.1.0956: completion may crash, completion highlight wrong with preview window Problem: completion may crash, completion highlight wrong with preview window (after v9.1.0954) Solution: correctly calculate scroll offset, check for preview window when adding extra highlighting (glepnir) when there have a preview window prepare_tagpreview will change curwin to preview window and this may cause ComplMatchIns check condition not correct. check wp is curwin and also the type of wp is not a preview or poup info fixes: https://github.com/vim/vim/issues/16284 closes: https://github.com/vim/vim/pull/16283 https://github.com/vim/vim/commit/8d0bb6dc9f2e5d94ebb59671d592c1b7fa325ca6 --- test/old/testdir/test_popup.vim | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_popup.vim b/test/old/testdir/test_popup.vim index f16a897b07..e902ea3bc2 100644 --- a/test/old/testdir/test_popup.vim +++ b/test/old/testdir/test_popup.vim @@ -1716,11 +1716,15 @@ endfunc func Test_pum_matchins_highlight() CheckScreendump let lines =<< trim END + let g:change = 0 func Omni_test(findstart, base) if a:findstart return col(".") endif - return [#{word: "foo"}, #{word: "bar"}, #{word: "你好"}] + if g:change == 0 + return [#{word: "foo"}, #{word: "bar"}, #{word: "你好"}] + endif + return [#{word: "foo", info: "info"}, #{word: "bar"}, #{word: "你好"}] endfunc set omnifunc=Omni_test hi ComplMatchIns ctermfg=red @@ -1767,6 +1771,10 @@ func Test_pum_matchins_highlight() call VerifyScreenDump(buf, 'Test_pum_matchins_10', {}) call term_sendkeys(buf, "\") + call term_sendkeys(buf, ":let g:change=1\S\\") + call VerifyScreenDump(buf, 'Test_pum_matchins_11', {}) + call term_sendkeys(buf, "\") + call StopVimInTerminal(buf) endfunc @@ -1812,4 +1820,15 @@ func Test_pum_matchins_highlight_combine() call StopVimInTerminal(buf) endfunc +" this used to crash +func Test_popup_completion_many_ctrlp() + new + let candidates=repeat(['a0'], 99) + call setline(1, candidates) + exe ":norm! VGg\" + norm! G + call feedkeys("o" .. repeat("\", 100), 'tx') + bw! +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From 01e1598072249011ac2cec7318559cea6179e509 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 25 Dec 2024 11:41:36 +0100 Subject: vim-patch:9.1.0960: filetype: hy history files are not recognized Problem: filetype: hy history files are not recognized Solution: detect '*.hy', '.hy-history' files as hy filetype, detect '.lips_repl_history' files are scheme filetype (Wu, Zhenyu) closes: vim/vim#16298 https://github.com/vim/vim/commit/a32daed55933df49a7aed571cc6e400ae01c7976 Co-authored-by: Wu, Zhenyu --- test/old/testdir/test_filetype.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 93fdb7fd27..e30e464fd7 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -356,6 +356,7 @@ func s:GetFilenameChecks() abort \ 'htmlm4': ['file.html.m4'], \ 'httest': ['file.htt', 'file.htb'], \ 'hurl': ['file.hurl'], + \ 'hy': ['file.hy', '.hy-history'], \ 'hyprlang': ['hyprlock.conf', 'hyprland.conf', 'hypridle.conf', 'hyprpaper.conf', '/hypr/foo.conf'], \ 'i3config': ['/home/user/.i3/config', '/home/user/.config/i3/config', '/etc/i3/config', '/etc/xdg/i3/config'], \ 'ibasic': ['file.iba', 'file.ibi'], @@ -668,7 +669,7 @@ func s:GetFilenameChecks() abort \ 'sather': ['file.sa'], \ 'sbt': ['file.sbt'], \ 'scala': ['file.scala'], - \ 'scheme': ['file.scm', 'file.ss', 'file.sld', 'file.stsg', 'any/local/share/supertux2/config'], + \ 'scheme': ['file.scm', 'file.ss', 'file.sld', 'file.stsg', 'any/local/share/supertux2/config', '.lips_repl_history'], \ 'scilab': ['file.sci', 'file.sce'], \ 'screen': ['.screenrc', 'screenrc'], \ 'scss': ['file.scss'], -- cgit From 7567f7d3226ab247eb2b743460492c1101045b0e Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 25 Dec 2024 11:44:46 +0100 Subject: vim-patch:9.1.0961: filetype: TI gel files are not recognized Problem: filetype: TI gel files are not recognized Solution: detect '*.gel' files as gel filetype, include get filetype and syntax plugins (Wu, Zhenyu) References: https://downloads.ti.com/ccs/esd/documents/users_guide/ccs_debug-gel.html closes: vim/vim#16226 https://github.com/vim/vim/commit/9360de9027aa286e802363ede59c9e97025ae123 Co-authored-by: Wu, Zhenyu --- test/old/testdir/test_filetype.vim | 1 + 1 file changed, 1 insertion(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index e30e464fd7..f556d551dd 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -298,6 +298,7 @@ func s:GetFilenameChecks() abort \ 'gdscript': ['file.gd'], \ 'gdshader': ['file.gdshader', 'file.shader'], \ 'gedcom': ['file.ged', 'lltxxxxx.txt', '/tmp/lltmp', '/tmp/lltmp-file', 'any/tmp/lltmp', 'any/tmp/lltmp-file'], + \ 'gel': ['file.gel'], \ 'gemtext': ['file.gmi', 'file.gemini'], \ 'gift': ['file.gift'], \ 'gitattributes': ['file.git/info/attributes', '.gitattributes', '/.config/git/attributes', '/etc/gitattributes', '/usr/local/etc/gitattributes', 'some.git/info/attributes'] + s:WhenConfigHome('$XDG_CONFIG_HOME/git/attributes'), -- cgit From 46c7faa00b165a1ad1b7cef8245df30d3dc3ef56 Mon Sep 17 00:00:00 2001 From: glepnir Date: Fri, 27 Dec 2024 14:23:06 +0800 Subject: vim-patch:9.1.0963: fuzzy-matching does not prefer full match (#31741) Problem: fuzzy-matching does not prefer full match (Maxim Kim) Solution: add additional score for a full match (glepnir) fixes: vim/vim#15654 closes: vim/vim#16300 https://github.com/vim/vim/commit/5a04999a7402201cf1b47ff10bc474dd1cdc24f4 --- test/old/testdir/test_matchfuzzy.vim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_matchfuzzy.vim b/test/old/testdir/test_matchfuzzy.vim index 90f3366b23..c2dc07ed10 100644 --- a/test/old/testdir/test_matchfuzzy.vim +++ b/test/old/testdir/test_matchfuzzy.vim @@ -23,6 +23,8 @@ func Test_matchfuzzy() call assert_equal(['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'], matchfuzzy(['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'], 'aa')) call assert_equal(256, matchfuzzy([repeat('a', 256)], repeat('a', 256))[0]->len()) call assert_equal([], matchfuzzy([repeat('a', 300)], repeat('a', 257))) + " full match has highest score + call assert_equal(['Cursor', 'lCursor'], matchfuzzy(["hello", "lCursor", "Cursor"], "Cursor")) " matches with same score should not be reordered let l = ['abc1', 'abc2', 'abc3'] call assert_equal(l, l->matchfuzzy('abc')) @@ -101,7 +103,7 @@ func Test_matchfuzzypos() call assert_equal([['curl', 'world'], [[2,3], [2,3]], [128, 127]], matchfuzzypos(['world', 'curl'], 'rl')) call assert_equal([['curl', 'world'], [[2,3], [2,3]], [128, 127]], matchfuzzypos(['world', 'one', 'curl'], 'rl')) call assert_equal([['hello', 'hello world hello world'], - \ [[0, 1, 2, 3, 4], [0, 1, 2, 3, 4]], [275, 257]], + \ [[0, 1, 2, 3, 4], [0, 1, 2, 3, 4]], [375, 257]], \ matchfuzzypos(['hello world hello world', 'hello', 'world'], 'hello')) call assert_equal([['aaaaaaa'], [[0, 1, 2]], [191]], matchfuzzypos(['aaaaaaa'], 'aaa')) call assert_equal([['a b'], [[0, 3]], [219]], matchfuzzypos(['a b'], 'a b')) @@ -136,7 +138,7 @@ func Test_matchfuzzypos() call assert_equal([['foo bar baz'], [[0, 1, 2, 3, 4, 5, 10]], [326]], ['foo bar baz', 'foo', 'foo bar', 'baz bar']->matchfuzzypos('foo baz', {'matchseq': 1})) call assert_equal([[], [], []], ['foo bar baz', 'foo', 'foo bar', 'baz bar']->matchfuzzypos('one two')) call assert_equal([[], [], []], ['foo bar']->matchfuzzypos(" \t ")) - call assert_equal([['grace'], [[1, 2, 3, 4, 2, 3, 4, 0, 1, 2, 3, 4]], [657]], ['grace']->matchfuzzypos('race ace grace')) + call assert_equal([['grace'], [[1, 2, 3, 4, 2, 3, 4, 0, 1, 2, 3, 4]], [757]], ['grace']->matchfuzzypos('race ace grace')) let l = [{'id' : 5, 'val' : 'crayon'}, {'id' : 6, 'val' : 'camera'}] call assert_equal([[{'id' : 6, 'val' : 'camera'}], [[0, 1, 2]], [192]], -- cgit From 69fbb58385d14a623be6652fcd2d4c3ff65de1d3 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Thu, 26 Dec 2024 18:56:31 +0100 Subject: vim-patch:9.1.0962: filetype: bun.lock file is not recognized Problem: filetype: bun.lock file is not recognized Solution: detect 'bun.lock' file as jsonc filetype (Anton Kastritskii) closes: vim/vim#16308 https://github.com/vim/vim/commit/f07ae5b3bdb7331ee0e65adcb74402eef74f0a2b Co-authored-by: Anton Kastritskii --- test/old/testdir/test_filetype.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index f556d551dd..94bf208b67 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -391,7 +391,7 @@ func s:GetFilenameChecks() abort \ 'jproperties': ['file.properties', 'file.properties_xx', 'file.properties_xx_xx', 'some.properties_xx_xx_file', 'org.eclipse.xyz.prefs'], \ 'json': ['file.json', 'file.jsonp', 'file.json-patch', 'file.geojson', 'file.webmanifest', 'Pipfile.lock', 'file.ipynb', 'file.jupyterlab-settings', '.prettierrc', '.firebaserc', '.stylelintrc', '.lintstagedrc', 'file.slnf', 'file.sublime-project', 'file.sublime-settings', 'file.sublime-workspace', 'file.bd', 'file.bda', 'file.xci', 'flake.lock', 'pack.mcmeta', 'deno.lock'], \ 'json5': ['file.json5'], - \ 'jsonc': ['file.jsonc', '.babelrc', '.eslintrc', '.jsfmtrc', '.jshintrc', '.jscsrc', '.vsconfig', '.hintrc', '.swrc', 'jsconfig.json', 'tsconfig.json', 'tsconfig.test.json', 'tsconfig-test.json', '.luaurc'], + \ 'jsonc': ['file.jsonc', '.babelrc', '.eslintrc', '.jsfmtrc', '.jshintrc', '.jscsrc', '.vsconfig', '.hintrc', '.swrc', 'jsconfig.json', 'tsconfig.json', 'tsconfig.test.json', 'tsconfig-test.json', '.luaurc', 'bun.lock'], \ 'jsonl': ['file.jsonl'], \ 'jsonnet': ['file.jsonnet', 'file.libsonnet'], \ 'jsp': ['file.jsp'], -- cgit From 2b07b14eacf3197754c63f42f9c880e85960eef2 Mon Sep 17 00:00:00 2001 From: Luca Saccarola <96259932+saccarosium@users.noreply.github.com> Date: Sat, 28 Dec 2024 12:20:50 +0100 Subject: vim-patch:9.1.0965: filetype: sh filetype set when detecting the use of bash (#31749) Problem: filetype: sh filetype set when detecting the use of bash Solution: when bash is detected, use 'bash' filetype instead (Luca Saccarola) closes: vim/vim#16309 https://github.com/vim/vim/commit/b9b762c21f2b61e0e7d8fee43d4d3dc8ecffd721 --- test/old/testdir/test_filetype.vim | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 94bf208b67..d61c0d380d 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -128,6 +128,9 @@ func s:GetFilenameChecks() abort \ 'ave': ['file.ave'], \ 'awk': ['file.awk', 'file.gawk'], \ 'b': ['file.mch', 'file.ref', 'file.imp'], + \ 'bash': ['.bashrc', '.bash_profile', '.bash-profile', '.bash_logout', '.bash-logout', '.bash_aliases', + \ '.bash-aliases', '.bash_history', '.bash-history', '/tmp/bash-fc-3Ozjlw', '/tmp/bash-fc.3Ozjlw', + \ 'PKGBUILD', 'file.bash', 'file.bats', 'file.cygport'], \ 'basic': ['file.bas', 'file.bi', 'file.bm'], \ 'bass': ['file.bass'], \ 'bc': ['file.bc'], @@ -682,11 +685,10 @@ func s:GetFilenameChecks() abort \ 'services': ['/etc/services', 'any/etc/services'], \ 'setserial': ['/etc/serial.conf', 'any/etc/serial.conf'], \ 'sexplib': ['file.sexp'], - \ 'sh': ['.bashrc', '.bash_profile', '.bash-profile', '.bash_logout', '.bash-logout', '.bash_aliases', '.bash-aliases', '.bash_history', '.bash-history', - \ '/tmp/bash-fc-3Ozjlw', '/tmp/bash-fc.3Ozjlw', 'PKGBUILD', 'file.bash', '/usr/share/doc/bash-completion/filter.sh', - \ '/etc/udev/cdsymlinks.conf', 'any/etc/udev/cdsymlinks.conf', 'file.bats', '.ash_history', 'any/etc/neofetch/config.conf', '.xprofile', - \ 'user-dirs.defaults', 'user-dirs.dirs', 'makepkg.conf', '.makepkg.conf', 'file.mdd', 'file.cygport', '.env', '.envrc', 'devscripts.conf', - \ '.devscripts', 'file.lo', 'file.la', 'file.lai'], + \ 'sh': ['/usr/share/doc/bash-completion/filter.sh', '/etc/udev/cdsymlinks.conf', 'any/etc/udev/cdsymlinks.conf', + \ '.ash_history', 'any/etc/neofetch/config.conf', '.xprofile', 'user-dirs.defaults', 'user-dirs.dirs', + \ 'makepkg.conf', '.makepkg.conf', 'file.mdd', '.env', '.envrc', 'devscripts.conf', '.devscripts', 'file.lo', + \ 'file.la', 'file.lai'], \ 'sieve': ['file.siv', 'file.sieve'], \ 'sil': ['file.sil'], \ 'simula': ['file.sim'], @@ -980,11 +982,11 @@ func s:GetScriptChecks() abort \ 'clojure': [['#!/path/clojure']], \ 'scala': [['#!/path/scala']], \ 'sh': [['#!/path/sh'], - \ ['#!/path/bash'], - \ ['#!/path/bash2'], \ ['#!/path/dash'], \ ['#!/path/ksh'], \ ['#!/path/ksh93']], + \ 'bash': [['#!/path/bash'], + \ ['#!/path/bash2']], \ 'csh': [['#!/path/csh']], \ 'tcsh': [['#!/path/tcsh']], \ 'zsh': [['#!/path/zsh']], -- cgit From d3951be4a0df3ca8c9a4fce5c05f82fbdaac1df6 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 29 Dec 2024 08:56:32 +0800 Subject: vim-patch:9.1.0968: tests: GetFileNameChecks() isn't fully sorted by filetype name (#31763) Problem: tests: GetFileNameChecks() isn't fully sorted by filetype name Solution: re-sort the list closes: vim/vim#16322 https://github.com/vim/vim/commit/e51043ad9f8e07d4c0a1e0056a8f8853e08f6a30 --- test/old/testdir/test_filetype.vim | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index d61c0d380d..2b1ed2bbe4 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -157,6 +157,7 @@ func s:GetFilenameChecks() abort \ 'calendar': ['calendar', '/.calendar/file', '/share/calendar/any/calendar.file', '/share/calendar/calendar.file', 'any/share/calendar/any/calendar.file', 'any/share/calendar/calendar.file'], \ 'capnp': ['file.capnp'], \ 'catalog': ['catalog', 'sgml.catalogfile', 'sgml.catalog', 'sgml.catalog-file'], + \ 'cdc': ['file.cdc'], \ 'cdl': ['file.cdl'], \ 'cdrdaoconf': ['/etc/cdrdao.conf', '/etc/defaults/cdrdao', '/etc/default/cdrdao', '.cdrdao', 'any/etc/cdrdao.conf', 'any/etc/default/cdrdao', 'any/etc/defaults/cdrdao'], \ 'cdrtoc': ['file.toc'], @@ -199,8 +200,8 @@ func s:GetFilenameChecks() abort \ 'csdl': ['file.csdl'], \ 'csp': ['file.csp', 'file.fdr'], \ 'css': ['file.css'], - \ 'cterm': ['file.con'], \ 'csv': ['file.csv'], + \ 'cterm': ['file.con'], \ 'cucumber': ['file.feature'], \ 'cuda': ['file.cu', 'file.cuh'], \ 'cue': ['file.cue'], @@ -215,11 +216,11 @@ func s:GetFilenameChecks() abort \ 'dart': ['file.dart', 'file.drt'], \ 'datascript': ['file.ds'], \ 'dcd': ['file.dcd'], + \ 'deb822sources': ['/etc/apt/sources.list.d/file.sources', 'any/etc/apt/sources.list.d/file.sources'], \ 'debchangelog': ['changelog.Debian', 'changelog.dch', 'NEWS.Debian', 'NEWS.dch', '/debian/changelog'], \ 'debcontrol': ['/debian/control', 'any/debian/control', 'any/DEBIAN/control'], \ 'debcopyright': ['/debian/copyright', 'any/debian/copyright'], \ 'debsources': ['/etc/apt/sources.list', '/etc/apt/sources.list.d/file.list', 'any/etc/apt/sources.list', 'any/etc/apt/sources.list.d/file.list'], - \ 'deb822sources': ['/etc/apt/sources.list.d/file.sources', 'any/etc/apt/sources.list.d/file.sources'], \ 'def': ['file.def'], \ 'denyhosts': ['denyhosts.conf'], \ 'desc': ['file.desc'], @@ -356,9 +357,9 @@ func s:GetFilenameChecks() abort \ 'hostconf': ['/etc/host.conf', 'any/etc/host.conf'], \ 'hostsaccess': ['/etc/hosts.allow', '/etc/hosts.deny', 'any/etc/hosts.allow', 'any/etc/hosts.deny'], \ 'html': ['file.html', 'file.htm', 'file.cshtml', 'file.component.html'], - \ 'http': ['file.http'], \ 'htmlm4': ['file.html.m4'], \ 'httest': ['file.htt', 'file.htb'], + \ 'http': ['file.http'], \ 'hurl': ['file.hurl'], \ 'hy': ['file.hy', '.hy-history'], \ 'hyprlang': ['hyprlock.conf', 'hyprland.conf', 'hypridle.conf', 'hyprpaper.conf', '/hypr/foo.conf'], @@ -389,9 +390,9 @@ func s:GetFilenameChecks() abort \ 'jgraph': ['file.jgr'], \ 'jinja': ['file.jinja'], \ 'jj': ['file.jjdescription'], - \ 'jq': ['file.jq'], \ 'jovial': ['file.jov', 'file.j73', 'file.jovial'], \ 'jproperties': ['file.properties', 'file.properties_xx', 'file.properties_xx_xx', 'some.properties_xx_xx_file', 'org.eclipse.xyz.prefs'], + \ 'jq': ['file.jq'], \ 'json': ['file.json', 'file.jsonp', 'file.json-patch', 'file.geojson', 'file.webmanifest', 'Pipfile.lock', 'file.ipynb', 'file.jupyterlab-settings', '.prettierrc', '.firebaserc', '.stylelintrc', '.lintstagedrc', 'file.slnf', 'file.sublime-project', 'file.sublime-settings', 'file.sublime-workspace', 'file.bd', 'file.bda', 'file.xci', 'flake.lock', 'pack.mcmeta', 'deno.lock'], \ 'json5': ['file.json5'], \ 'jsonc': ['file.jsonc', '.babelrc', '.eslintrc', '.jsfmtrc', '.jshintrc', '.jscsrc', '.vsconfig', '.hintrc', '.swrc', 'jsconfig.json', 'tsconfig.json', 'tsconfig.test.json', 'tsconfig-test.json', '.luaurc', 'bun.lock'], @@ -417,8 +418,8 @@ func s:GetFilenameChecks() abort \ 'ldif': ['file.ldif'], \ 'lean': ['file.lean'], \ 'ledger': ['file.ldg', 'file.ledger', 'file.journal'], - \ 'less': ['file.less'], \ 'leo': ['file.leo'], + \ 'less': ['file.less'], \ 'lex': ['file.lex', 'file.l', 'file.lxx', 'file.l++'], \ 'lf': ['lfrc'], \ 'lftp': ['lftp.conf', '.lftprc', 'anylftp/rc', 'lftp/rc', 'some-lftp/rc'], @@ -429,13 +430,13 @@ func s:GetFilenameChecks() abort \ 'lilo': ['lilo.conf', 'lilo.conf-file'], \ 'lilypond': ['file.ly', 'file.ily'], \ 'limits': ['/etc/limits', '/etc/anylimits.conf', '/etc/anylimits.d/file.conf', '/etc/limits.conf', '/etc/limits.d/file.conf', '/etc/some-limits.conf', '/etc/some-limits.d/file.conf', 'any/etc/limits', 'any/etc/limits.conf', 'any/etc/limits.d/file.conf', 'any/etc/some-limits.conf', 'any/etc/some-limits.d/file.conf'], - \ 'liquidsoap': ['file.liq'], \ 'liquid': ['file.liquid'], + \ 'liquidsoap': ['file.liq'], \ 'lisp': ['file.lsp', 'file.lisp', 'file.asd', 'file.el', '.emacs', '.sawfishrc', 'sbclrc', '.sbclrc'], \ 'lite': ['file.lite', 'file.lt'], \ 'litestep': ['/LiteStep/any/file.rc', 'any/LiteStep/any/file.rc'], - \ 'logcheck': ['/etc/logcheck/file.d-some/file', '/etc/logcheck/file.d/file', 'any/etc/logcheck/file.d-some/file', 'any/etc/logcheck/file.d/file'], \ 'livebook': ['file.livemd'], + \ 'logcheck': ['/etc/logcheck/file.d-some/file', '/etc/logcheck/file.d/file', 'any/etc/logcheck/file.d-some/file', 'any/etc/logcheck/file.d/file'], \ 'loginaccess': ['/etc/login.access', 'any/etc/login.access'], \ 'logindefs': ['/etc/login.defs', 'any/etc/login.defs'], \ 'logtalk': ['file.lgt'], @@ -507,6 +508,7 @@ func s:GetFilenameChecks() abort \ 'mmp': ['file.mmp'], \ 'modconf': ['/etc/modules.conf', '/etc/modules', '/etc/conf.modules', '/etc/modprobe.file', 'any/etc/conf.modules', 'any/etc/modprobe.file', 'any/etc/modules', 'any/etc/modules.conf'], \ 'modula3': ['file.m3', 'file.mg', 'file.i3', 'file.ig', 'file.lm3'], + \ 'mojo': ['file.mojo', 'file.🔥'], \ 'monk': ['file.isc', 'file.monk', 'file.ssc', 'file.tsc'], \ 'moo': ['file.moo'], \ 'moonscript': ['file.moon'], @@ -515,10 +517,9 @@ func s:GetFilenameChecks() abort \ 'mplayerconf': ['mplayer.conf', '/.mplayer/config', 'any/.mplayer/config'], \ 'mrxvtrc': ['mrxvtrc', '.mrxvtrc'], \ 'msidl': ['file.odl', 'file.mof'], - \ 'mss': ['file.mss'], - \ 'msql': ['file.msql'], - \ 'mojo': ['file.mojo', 'file.🔥'], \ 'msmtp': ['.msmtprc'], + \ 'msql': ['file.msql'], + \ 'mss': ['file.mss'], \ 'mupad': ['file.mu'], \ 'mush': ['file.mush'], \ 'mustache': ['file.mustache'], @@ -611,6 +612,7 @@ func s:GetFilenameChecks() abort \ 'promela': ['file.pml'], \ 'proto': ['file.proto'], \ 'protocols': ['/etc/protocols', 'any/etc/protocols'], + \ 'prql': ['file.prql'], \ 'ps1': ['file.ps1', 'file.psd1', 'file.psm1', 'file.pssc'], \ 'ps1xml': ['file.ps1xml'], \ 'psf': ['file.psf'], @@ -653,19 +655,20 @@ func s:GetFilenameChecks() abort \ 'rnc': ['file.rnc'], \ 'rng': ['file.rng'], \ 'rnoweb': ['file.rnw', 'file.snw'], - \ 'rpgle': ['file.rpgle', 'file.rpgleinc'], \ 'robot': ['file.robot', 'file.resource'], \ 'robots': ['robots.txt'], \ 'roc': ['file.roc'], \ 'ron': ['file.ron'], \ 'routeros': ['file.rsc'], \ 'rpcgen': ['file.x'], + \ 'rpgle': ['file.rpgle', 'file.rpgleinc'], \ 'rpl': ['file.rpl'], \ 'rrst': ['file.rrst', 'file.srst'], \ 'rst': ['file.rst'], \ 'rtf': ['file.rtf'], \ 'ruby': ['.irbrc', 'irbrc', '.irb_history', 'irb_history', 'file.rb', 'file.rbw', 'file.gemspec', 'file.ru', 'Gemfile', 'file.builder', 'file.rxml', 'file.rjs', 'file.rant', 'file.rake', 'rakefile', 'Rakefile', 'rantfile', 'Rantfile', 'rakefile-file', 'Rakefile-file', 'Puppetfile', 'Vagrantfile'], \ 'rust': ['file.rs'], + \ 'sage': ['file.sage'], \ 'salt': ['file.sls'], \ 'samba': ['smb.conf'], \ 'sas': ['file.sas'], @@ -695,9 +698,7 @@ func s:GetFilenameChecks() abort \ 'sinda': ['file.sin', 'file.s85'], \ 'sisu': ['file.sst', 'file.ssm', 'file.ssi', 'file.-sst', 'file._sst', 'file.sst.meta', 'file.-sst.meta', 'file._sst.meta'], \ 'skill': ['file.il', 'file.ils', 'file.cdf'], - \ 'cdc': ['file.cdc'], \ 'slang': ['file.sl'], - \ 'sage': ['file.sage'], \ 'slice': ['file.ice'], \ 'slint': ['file.slint'], \ 'slpconf': ['/etc/slp.conf', 'any/etc/slp.conf'], @@ -723,7 +724,6 @@ func s:GetFilenameChecks() abort \ 'spyce': ['file.spy', 'file.spi'], \ 'sql': ['file.tyb', 'file.tyc', 'file.pkb', 'file.pks', '.sqlite_history'], \ 'sqlj': ['file.sqlj'], - \ 'prql': ['file.prql'], \ 'sqr': ['file.sqr', 'file.sqi'], \ 'squid': ['squid.conf'], \ 'squirrel': ['file.nut'], @@ -789,14 +789,13 @@ func s:GetFilenameChecks() abort \ 'any/etc/systemd/system/file.d/.#-file', \ 'any/etc/systemd/system/file.d/file.conf'], \ 'systemverilog': ['file.sv', 'file.svh'], - \ 'trace32': ['file.cmm', 'file.t32'], + \ 'tablegen': ['file.td'], \ 'tags': ['tags'], \ 'tak': ['file.tak'], \ 'tal': ['file.tal'], \ 'taskdata': ['pending.data', 'completed.data', 'undo.data'], \ 'taskedit': ['file.task'], \ 'tcl': ['file.tcl', 'file.tm', 'file.tk', 'file.itcl', 'file.itk', 'file.jacl', '.tclshrc', 'tclsh.rc', '.wishrc', '.tclsh-history', '.xsctcmdhistory', '.xsdbcmdhistory'], - \ 'tablegen': ['file.td'], \ 'teal': ['file.tl'], \ 'templ': ['file.templ'], \ 'template': ['file.tmpl'], @@ -816,6 +815,7 @@ func s:GetFilenameChecks() abort \ 'tmux': ['tmuxfile.conf', '.tmuxfile.conf', '.tmux-file.conf', '.tmux.conf', 'tmux-file.conf', 'tmux.conf', 'tmux.conf.local'], \ 'toml': ['file.toml', 'Gopkg.lock', 'Pipfile', '/home/user/.cargo/config', '.black'], \ 'tpp': ['file.tpp'], + \ 'trace32': ['file.cmm', 'file.t32'], \ 'treetop': ['file.treetop'], \ 'trustees': ['trustees.conf'], \ 'tsalt': ['file.slt'], @@ -828,12 +828,12 @@ func s:GetFilenameChecks() abort \ 'typescript.glimmer': ['file.gts'], \ 'typescriptreact': ['file.tsx'], \ 'typespec': ['file.tsp'], - \ 'ungrammar': ['file.ungram'], \ 'uc': ['file.uc'], \ 'udevconf': ['/etc/udev/udev.conf', 'any/etc/udev/udev.conf'], \ 'udevperm': ['/etc/udev/permissions.d/file.permissions', 'any/etc/udev/permissions.d/file.permissions'], \ 'udevrules': ['/etc/udev/rules.d/file.rules', '/usr/lib/udev/rules.d/file.rules', '/lib/udev/rules.d/file.rules'], \ 'uil': ['file.uit', 'file.uil'], + \ 'ungrammar': ['file.ungram'], \ 'unison': ['file.u', 'file.uu'], \ 'updatedb': ['/etc/updatedb.conf', 'any/etc/updatedb.conf'], \ 'upstart': ['/usr/share/upstart/file.conf', '/usr/share/upstart/file.override', '/etc/init/file.conf', '/etc/init/file.override', '/.init/file.conf', '/.init/file.override', '/.config/upstart/file.conf', '/.config/upstart/file.override', 'any/.config/upstart/file.conf', 'any/.config/upstart/file.override', 'any/.init/file.conf', 'any/.init/file.override', 'any/etc/init/file.conf', 'any/etc/init/file.override', 'any/usr/share/upstart/file.conf', 'any/usr/share/upstart/file.override'], -- cgit From 493b6899ee898ec43217a8ae270b24bcc3b47281 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 29 Dec 2024 15:27:01 +0100 Subject: vim-patch:9.1.0971: filetype: SLNX files are not recognized Problem: filetype: SLNX files are not recognized Solution: detect '*.slnx' files as xml filetype (Gustav Eikaas) References: https://blog.ndepend.com/slnx-the-new-net-solution-xml-file-format/ https://blog.jetbrains.com/dotnet/2024/10/04/support-for-slnx-solution-files/ closes: vim/vim#16334 https://github.com/vim/vim/commit/3b3318b64043dcf29d6f06322739f695a5cc257e Co-authored-by: GustavEikaas --- test/old/testdir/test_filetype.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 2b1ed2bbe4..88dcef423a 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -886,7 +886,7 @@ func s:GetFilenameChecks() abort \ 'xml': ['/etc/blkid.tab', '/etc/blkid.tab.old', 'file.xmi', 'file.csproj', 'file.csproj.user', 'file.fsproj', 'file.fsproj.user', 'file.vbproj', 'file.vbproj.user', 'file.ui', \ 'file.tpm', '/etc/xdg/menus/file.menu', 'fglrxrc', 'file.xlf', 'file.xliff', 'file.xul', 'file.wsdl', 'file.wpl', 'any/etc/blkid.tab', 'any/etc/blkid.tab.old', \ 'any/etc/xdg/menus/file.menu', 'file.atom', 'file.rss', 'file.cdxml', 'file.psc1', 'file.mpd', 'fonts.conf', 'file.xcu', 'file.xlb', 'file.xlc', 'file.xba', 'file.xpr', - \ 'file.xpfm', 'file.spfm', 'file.bxml', 'file.mmi'], + \ 'file.xpfm', 'file.spfm', 'file.bxml', 'file.mmi', 'file.slnx'], \ 'xmodmap': ['anyXmodmap', 'Xmodmap', 'some-Xmodmap', 'some-xmodmap', 'some-xmodmap-file', 'xmodmap', 'xmodmap-file'], \ 'xpm': ['file.xpm'], \ 'xpm2': ['file.xpm2'], -- cgit From 0e880b5612b0dece2863c70ee608971726ec5f2c Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 29 Dec 2024 15:33:40 +0100 Subject: vim-patch:9.1.0972: filetype: TI linker map files are not recognized Problem: filetype: TI linker map files are not recognized Solution: detect TI linker map files as lnkmap filetype (Wu, Zhenyu) References: https://downloads.ti.com/docs/esd/SPRUI03A/Content/SPRUI03A_HTML/linker_description.html closes: vim/vim#16324 https://github.com/vim/vim/commit/5113831d16c05f3a8b47da0c6f95a641d5fc7b2e Co-authored-by: Wu, Zhenyu --- test/old/testdir/test_filetype.vim | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 88dcef423a..75092f8ece 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -459,7 +459,6 @@ func s:GetFilenameChecks() abort \ 'mallard': ['file.page'], "\ 'man': ['file.man'], \ 'manconf': ['/etc/man.conf', 'man.config', 'any/etc/man.conf'], - \ 'map': ['file.map'], \ 'maple': ['file.mv', 'file.mpl', 'file.mws'], \ 'markdown': ['file.markdown', 'file.mdown', 'file.mkd', 'file.mkdn', 'file.mdwn', 'file.md'], \ 'masm': ['file.masm'], @@ -2765,6 +2764,24 @@ func Test_make_file() filetype off endfunc +func Test_map_file() + filetype on + + " TI linker map file + call writefile(['******************************************************************************', ' TMS320C6x Linker Unix v7.4.24 ', '******************************************************************************'], 'Xfile.map', 'D') + split Xfile.map + call assert_equal('lnkmap', &filetype) + bwipe! + + " TI linker map file + call writefile(['MAP', 'NAME "local-demo"', 'END'], 'Xfile.map', 'D') + split Xfile.map + call assert_equal('map', &filetype) + bwipe! + + filetype off +endfunc + func Test_org_file() filetype on -- cgit From 7b739248a183dc56e38441a79d1630205750924d Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 30 Dec 2024 11:26:43 +0100 Subject: vim-patch:9.1.0977: filetype: msbuild filetypes are not recognized Problem: filetype: msbuild filetypes are not recognized Solution: detect msbuild files as xml filetype (Gustav Eikaas) closes: vim/vim#16339 https://github.com/vim/vim/commit/32b7e3a8c99d369b02154df74cbe42a37c7c7e68 Co-authored-by: GustavEikaas --- test/old/testdir/test_filetype.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 75092f8ece..0e9796388c 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -885,7 +885,7 @@ func s:GetFilenameChecks() abort \ 'xml': ['/etc/blkid.tab', '/etc/blkid.tab.old', 'file.xmi', 'file.csproj', 'file.csproj.user', 'file.fsproj', 'file.fsproj.user', 'file.vbproj', 'file.vbproj.user', 'file.ui', \ 'file.tpm', '/etc/xdg/menus/file.menu', 'fglrxrc', 'file.xlf', 'file.xliff', 'file.xul', 'file.wsdl', 'file.wpl', 'any/etc/blkid.tab', 'any/etc/blkid.tab.old', \ 'any/etc/xdg/menus/file.menu', 'file.atom', 'file.rss', 'file.cdxml', 'file.psc1', 'file.mpd', 'fonts.conf', 'file.xcu', 'file.xlb', 'file.xlc', 'file.xba', 'file.xpr', - \ 'file.xpfm', 'file.spfm', 'file.bxml', 'file.mmi', 'file.slnx'], + \ 'file.xpfm', 'file.spfm', 'file.bxml', 'file.mmi', 'file.slnx', 'Directory.Packages.props', 'Directory.Build.targets', 'Directory.Build.props'], \ 'xmodmap': ['anyXmodmap', 'Xmodmap', 'some-Xmodmap', 'some-xmodmap', 'some-xmodmap-file', 'xmodmap', 'xmodmap-file'], \ 'xpm': ['file.xpm'], \ 'xpm2': ['file.xpm2'], -- cgit From d077e31cc9dda36f2eb030146a10a308bbc542af Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 30 Dec 2024 19:06:31 +0800 Subject: vim-patch:9.1.0978: GUI tests sometimes fail when setting 'scroll' options (#31785) Problem: GUI tests sometimes fail when setting 'scroll' options Solution: decrease the 'scroll' and 'scrolljump' option value from 20 to 15, in case the Gui window is not large enough to handle 20. tests: decrease the scroll and scrolljump values the gui tests sometimes fail with: ``` From test_options_all.vim: Found errors in Test_opt_set_scroll(): Caught exception in Test_opt_set_scroll(): Vim(set):E49: Invalid scroll size: scroll=20 @ command line..script /home/runner/work/vim/vim/src/testdir/runtest.vim[617]..function RunTheTest[57]..Test_opt_set_scroll, line 7 Found errors in Test_opt_set_scrolljump(): Caught exception in Test_opt_set_scrolljump(): Vim(set):E49: Invalid scroll size: scrolljump=20 @ command line..script /home/runner/work/vim/vim/src/testdir/runtest.vim[617]..function RunTheTest[57]..Test_opt_set_scrolljump, line 9 ``` closes: vim/vim#16337 https://github.com/vim/vim/commit/2e1f757f7b52a00b77eb19648b7ea46e932eff2b Co-authored-by: Christian Brabandt --- test/old/testdir/gen_opt_test.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/gen_opt_test.vim b/test/old/testdir/gen_opt_test.vim index a2ad1eb8b4..3802ee3fc9 100644 --- a/test/old/testdir/gen_opt_test.vim +++ b/test/old/testdir/gen_opt_test.vim @@ -120,8 +120,8 @@ let test_values = { \ 'numberwidth': [[1, 4, 8, 10, 11, 20], [-1, 0, 21]], \ 'regexpengine': [[0, 1, 2], [-1, 3, 999]], \ 'report': [[0, 1, 2, 9999], [-1]], - \ 'scroll': [[0, 1, 2, 20], [-1, 999]], - \ 'scrolljump': [[-100, -1, 0, 1, 2, 20], [-101, 999]], + \ 'scroll': [[0, 1, 2, 15], [-1, 999]], + \ 'scrolljump': [[-100, -1, 0, 1, 2, 15], [-101, 999]], \ 'scrolloff': [[0, 1, 8, 999], [-1]], \ 'shiftwidth': [[0, 1, 8, 999], [-1]], \ 'sidescroll': [[0, 1, 8, 999], [-1]], -- cgit From 57f10abbc2c17453ffe584833abb7596e9897a6e Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 31 Dec 2024 08:41:54 +0800 Subject: vim-patch:9.1.0981: tests: typo in test_filetype.vim (#31794) Problem: tests: typo in test_filetype.vim Solution: fix comment, update lnkmap syntax file and add DESCT keyword (Wu, Zhenyu) closes: vim/vim#16348 https://github.com/vim/vim/commit/2bee7e43e137bcef62e6872791e2be7ce9c32703 Co-authored-by: Wu, Zhenyu --- test/old/testdir/test_filetype.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 0e9796388c..462bf2e025 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -2773,7 +2773,7 @@ func Test_map_file() call assert_equal('lnkmap', &filetype) bwipe! - " TI linker map file + " UMN mapserver config file call writefile(['MAP', 'NAME "local-demo"', 'END'], 'Xfile.map', 'D') split Xfile.map call assert_equal('map', &filetype) -- cgit From bdc0b5f5054afb8ba3418f9d6c9b1b3e944f3e3a Mon Sep 17 00:00:00 2001 From: glepnir Date: Tue, 31 Dec 2024 19:12:50 +0800 Subject: vim-patch:9.1.0983: not able to get the displayed items in complete_i… (#31796) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit vim-patch:9.1.0983: not able to get the displayed items in complete_info() Problem: not able to get the displayed items in complete_info() (Evgeni Chasnovski) Solution: return the visible items via the "matches" key for complete_info() (glepnir) fixes: vim/vim#10007 closes: vim/vim#16307 https://github.com/vim/vim/commit/d4088edae21659e14ab5f763c820f4eab9d36981 --- test/old/testdir/test_ins_complete.vim | 44 ++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_ins_complete.vim b/test/old/testdir/test_ins_complete.vim index bf7477f088..52fd24881c 100644 --- a/test/old/testdir/test_ins_complete.vim +++ b/test/old/testdir/test_ins_complete.vim @@ -2870,4 +2870,48 @@ func Test_complete_fuzzy_match_tie() set completeopt& endfunc +func Test_complete_info_matches() + let g:what = ['matches'] + func ShownInfo() + let g:compl_info = complete_info(g:what) + return '' + endfunc + set completeopt+=noinsert + + new + call setline(1, ['aaa', 'aab', 'aba', 'abb']) + inoremap =ShownInfo() + + call feedkeys("Go\\\\dd", 'tx') + call assert_equal([ + \ {'word': 'aaa', 'menu': '', 'user_data': '', 'info': '', 'kind': '', 'abbr': ''}, + \ {'word': 'aab', 'menu': '', 'user_data': '', 'info': '', 'kind': '', 'abbr': ''}, + \ {'word': 'aba', 'menu': '', 'user_data': '', 'info': '', 'kind': '', 'abbr': ''}, + \ {'word': 'abb', 'menu': '', 'user_data': '', 'info': '', 'kind': '', 'abbr': ''}, + \], g:compl_info['matches']) + + call feedkeys("Goa\\b\\dd", 'tx') + call assert_equal([ + \ {'word': 'aba', 'menu': '', 'user_data': '', 'info': '', 'kind': '', 'abbr': ''}, + \ {'word': 'abb', 'menu': '', 'user_data': '', 'info': '', 'kind': '', 'abbr': ''}, + \], g:compl_info['matches']) + + " items and matches both in what + let g:what = ['items', 'matches'] + call feedkeys("Goa\\b\\dd", 'tx') + call assert_equal([ + \ {'word': 'aaa', 'menu': '', 'user_data': '', 'match': v:false, 'info': '', 'kind': '', 'abbr': ''}, + \ {'word': 'aab', 'menu': '', 'user_data': '', 'match': v:false, 'info': '', 'kind': '', 'abbr': ''}, + \ {'word': 'aba', 'menu': '', 'user_data': '', 'match': v:true, 'info': '', 'kind': '', 'abbr': ''}, + \ {'word': 'abb', 'menu': '', 'user_data': '', 'match': v:true, 'info': '', 'kind': '', 'abbr': ''}, + \], g:compl_info['items']) + call assert_false(has_key(g:compl_info, 'matches')) + + bw! + bw! + unlet g:what + delfunc ShownInfo + set cot& +endfunc + " vim: shiftwidth=2 sts=2 expandtab nofoldenable -- cgit From 1877cd5fcdc0bbe5f3d0685d42d4e295fb819724 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 31 Dec 2024 11:53:02 +0100 Subject: vim-patch:9.1.0982: TI linker files are not recognized Problem: TI linker files are not recognized Solution: inspect '*.cmd' files and detect TI linker files as 'lnk' filetype, include a lnk ftplugin and syntax script (Wu, Zhenyu) closes: vim/vim#16320 https://github.com/vim/vim/commit/39a4eb0b2ca901b59800fad086550053556e59dc Co-authored-by: Wu, Zhenyu --- test/old/testdir/test_filetype.vim | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 462bf2e025..1bf2bdb360 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -2300,6 +2300,27 @@ func Test_cls_file() filetype off endfunc +func Test_cmd_file() + filetype on + + call writefile(['--rom_model'], 'Xfile.cmd') + split Xfile.cmd + call assert_equal('lnk', &filetype) + bwipe! + + call writefile(['/* comment */'], 'Xfile.cmd') + split Xfile.cmd + call assert_equal('rexx', &filetype) + bwipe! + + call writefile(['REM comment'], 'Xfile.cmd') + split Xfile.cmd + call assert_equal('dosbatch', &filetype) + bwipe! + + filetype off +endfunc + func Test_sig_file() filetype on -- cgit From 48e2a73610ca5639408f79b3d8eebd3e5f57a327 Mon Sep 17 00:00:00 2001 From: luukvbaal Date: Thu, 2 Jan 2025 14:51:03 +0100 Subject: feat(ui)!: emit prompt "messages" as cmdline events #31525 Problem: Prompts are emitted as messages events, where cmdline events are more appropriate. The user input is also emitted as message events in fast context, so cannot be displayed with vim.ui_attach(). Solution: Prompt for user input through cmdline prompts. --- test/old/testdir/test_spell.vim | 12 +++++++++--- test/old/testdir/test_tagjump.vim | 4 +++- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_spell.vim b/test/old/testdir/test_spell.vim index bdd8a673fd..a5ae653369 100644 --- a/test/old/testdir/test_spell.vim +++ b/test/old/testdir/test_spell.vim @@ -471,7 +471,9 @@ func Test_spellsuggest_option_number() \ .. "Change \"baord\" to:\n" \ .. " 1 \"board\"\n" \ .. " 2 \"bard\"\n" - \ .. "Type number and or click with the mouse (q or empty cancels): ", a) + "\ Nvim: Prompt message is sent to cmdline prompt. + "\ .. "Type number and or click with the mouse (q or empty cancels): ", a) + \ , a) set spell spellsuggest=0 call assert_equal("\nSorry, no suggestions", execute('norm $z=')) @@ -509,7 +511,9 @@ func Test_spellsuggest_option_expr() \ .. " 1 \"BARD\"\n" \ .. " 2 \"BOARD\"\n" \ .. " 3 \"BROAD\"\n" - \ .. "Type number and or click with the mouse (q or empty cancels): ", a) + "\ Nvim: Prompt message is sent to cmdline prompt. + "\ .. "Type number and or click with the mouse (q or empty cancels): ", a) + \ , a) " With verbose, z= should show the score i.e. word length with " our SpellSuggest() function. @@ -521,7 +525,9 @@ func Test_spellsuggest_option_expr() \ .. " 1 \"BARD\" (4 - 0)\n" \ .. " 2 \"BOARD\" (5 - 0)\n" \ .. " 3 \"BROAD\" (5 - 0)\n" - \ .. "Type number and or click with the mouse (q or empty cancels): ", a) + "\ Nvim: Prompt message is sent to cmdline prompt. + "\ .. "Type number and or click with the mouse (q or empty cancels): ", a) + \ , a) set spell& spellsuggest& verbose& bwipe! diff --git a/test/old/testdir/test_tagjump.vim b/test/old/testdir/test_tagjump.vim index 470c5c43b4..efc5e4cebe 100644 --- a/test/old/testdir/test_tagjump.vim +++ b/test/old/testdir/test_tagjump.vim @@ -1231,8 +1231,10 @@ func Test_tselect_listing() 2 FS v first Xfoo typeref:typename:char 2 -Type number and (q or empty cancels): [DATA] +" Type number and (q or empty cancels): +" Nvim: Prompt message is sent to cmdline prompt. + call assert_equal(expected, l) call delete('Xtags') -- cgit From b365036ab3f5e91439a5397ed0f32b651d60f08c Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 3 Jan 2025 10:42:52 +0100 Subject: vim-patch:9.1.0986: filetype: 'jj' filetype is a bit imprecise Problem: filetype: 'jj' filetype is a bit imprecise Solution: rename 'jj' filetype to 'jjdescription' (Gregory Anders) closes: vim/vim#16364 https://github.com/vim/vim/commit/58c44e8833365e1a777330491c2799ae324ed893 Co-authored-by: Gregory Anders --- test/old/testdir/test_filetype.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 1bf2bdb360..d5853adf49 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -389,7 +389,7 @@ func s:GetFilenameChecks() abort \ 'jess': ['file.clp'], \ 'jgraph': ['file.jgr'], \ 'jinja': ['file.jinja'], - \ 'jj': ['file.jjdescription'], + \ 'jjdescription': ['file.jjdescription'], \ 'jovial': ['file.jov', 'file.j73', 'file.jovial'], \ 'jproperties': ['file.properties', 'file.properties_xx', 'file.properties_xx_xx', 'some.properties_xx_xx_file', 'org.eclipse.xyz.prefs'], \ 'jq': ['file.jq'], -- cgit From fa298fd2f4b0c46df434938cbc17467e263cc094 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 3 Jan 2025 10:46:22 +0100 Subject: vim-patch:9.1.0987: filetype: cake files are not recognized Problem: filetype: cake files are not recognized Solution: detect '*.cake' files as cs filetype (Zoe Roux) References: https://cakebuild.net/ closes: vim/vim#16367 https://github.com/vim/vim/commit/a407573f30a978b3aa61532bbd9b0ae94a87dc32 Co-authored-by: Zoe Roux --- test/old/testdir/test_filetype.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index d5853adf49..685f700130 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -195,7 +195,7 @@ func s:GetFilenameChecks() abort \ 'crm': ['file.crm'], \ 'crontab': ['crontab', 'crontab.file', '/etc/cron.d/file', 'any/etc/cron.d/file'], \ 'crystal': ['file.cr'], - \ 'cs': ['file.cs', 'file.csx'], + \ 'cs': ['file.cs', 'file.csx', 'file.cake'], \ 'csc': ['file.csc'], \ 'csdl': ['file.csdl'], \ 'csp': ['file.csp', 'file.fdr'], -- cgit From 54ac406649b9e93d756ea62c1a6a587db462039c Mon Sep 17 00:00:00 2001 From: luukvbaal Date: Sun, 5 Jan 2025 12:09:38 +0100 Subject: vim-patch:9.1.0990: Inconsistent behavior when changing cmdheight (#31830) Problem: Inconsistent behavior when changing cmdheight by resizing the topframe through wincmds and dragging laststatus. Changing cmdheight by resizing the topframe does not trigger OptionSet. Solution: Consolidate logic for changing the cmdheight, set the option value to handle side-effects (Luuk van Baal) https://github.com/vim/vim/commit/e15cbc1af47e9dea90448c714eb4908e5d4302fc vim-patch:9.0.0187: command line height changes when maximizing window height Problem: Command line height changes when maximizing window height. Solution: Do not change the command line height. (closes vim/vim#10885) https://github.com/vim/vim/commit/96bde99bf890acd9952863a02c1d15edca2000e1 --- test/old/testdir/test_autocmd.vim | 24 ++++++++++++++++++++++++ test/old/testdir/test_cmdline.vim | 7 ++++--- test/old/testdir/test_window_cmd.vim | 1 - 3 files changed, 28 insertions(+), 4 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_autocmd.vim b/test/old/testdir/test_autocmd.vim index 40c09e61ac..d5f7c928de 100644 --- a/test/old/testdir/test_autocmd.vim +++ b/test/old/testdir/test_autocmd.vim @@ -4181,4 +4181,28 @@ func Test_autocmd_BufWinLeave_with_vsp() exe "bw! " .. dummy endfunc +func Test_OptionSet_cmdheight() + set mouse=a laststatus=2 + au OptionSet cmdheight :let &l:ch = v:option_new + + resize -1 + call assert_equal(2, &l:ch) + resize +1 + call assert_equal(1, &l:ch) + + call Ntest_setmouse(&lines - 1, 1) + call feedkeys("\", 'xt') + call Ntest_setmouse(&lines - 2, 1) + call feedkeys("\", 'xt') + call assert_equal(2, &l:ch) + + tabnew | resize +1 + call assert_equal(1, &l:ch) + tabfirst + call assert_equal(2, &l:ch) + + tabonly + set cmdheight& mouse& laststatus& +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/test/old/testdir/test_cmdline.vim b/test/old/testdir/test_cmdline.vim index cbce0e908d..3fce086040 100644 --- a/test/old/testdir/test_cmdline.vim +++ b/test/old/testdir/test_cmdline.vim @@ -291,9 +291,10 @@ func Test_changing_cmdheight() call term_sendkeys(buf, ":resize -3\") call VerifyScreenDump(buf, 'Test_changing_cmdheight_1', {}) - " using the space available doesn't change the status line - call term_sendkeys(buf, ":set cmdheight+=3\") + " :resize now also changes 'cmdheight' accordingly + call term_sendkeys(buf, ":set cmdheight+=1\") call VerifyScreenDump(buf, 'Test_changing_cmdheight_2', {}) + call term_sendkeys(buf, ":set cmdheight-=1\") " using more space moves the status line up call term_sendkeys(buf, ":set cmdheight+=1\") @@ -312,7 +313,7 @@ func Test_changing_cmdheight() call term_sendkeys(buf, ":call EchoTwo()\") call VerifyScreenDump(buf, 'Test_changing_cmdheight_6', {}) - " increasing 'cmdheight' doesn't clear the messages that need hit-enter + " decreasing 'cmdheight' doesn't clear the messages that need hit-enter call term_sendkeys(buf, ":call EchoOne()\") call VerifyScreenDump(buf, 'Test_changing_cmdheight_7', {}) diff --git a/test/old/testdir/test_window_cmd.vim b/test/old/testdir/test_window_cmd.vim index 343bc9fd83..24517f90cb 100644 --- a/test/old/testdir/test_window_cmd.vim +++ b/test/old/testdir/test_window_cmd.vim @@ -56,7 +56,6 @@ func Test_window_cmd_cmdwin_with_vsp() endfunc func Test_cmdheight_not_changed() - throw 'Skipped: N/A' set cmdheight=2 set winminheight=0 augroup Maximize -- cgit From 06ff5480ce274daf3b7ad9950a587099200dc8ff Mon Sep 17 00:00:00 2001 From: luukvbaal Date: Tue, 7 Jan 2025 02:00:09 +0100 Subject: vim-patch:9.1.0993: New 'cmdheight' behavior may be surprising #31892 Problem: Although patch 9.1.0990 fixed a real problem/inconsistency, it also introduced new behavior that may break BWC and/or be unexpected. Before 9.1.0990, window commands could make the topframe smaller (without changing 'cmdheight'; quirk that is now fixed), but did not allow extending the topframe beyond the 'cmdheight' set by the user. After 9.1.0990, the user can reduce the 'cmdheight' below the value they set explicitly, through window commands, which may lead to confusion. (aftere v9.1.0990) Solution: Store the value explicitly set by the user and clamp the 'cmdheight' when resizing the topframe. This also applies to dragging laststatus, which in contrast to window commands _did_ allow reducing the 'cmdheight' to values below the one set by the user. So with this patch there is still new behavior, but I think in a way that is less surprising. While at it, also fix a Coverity warning, introduced in v9.1.0990 (Luuk van Baal) https://github.com/vim/vim/commit/c97e8695353565d6b20adffa48aad47f6e09967f --- test/old/testdir/test_cmdline.vim | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_cmdline.vim b/test/old/testdir/test_cmdline.vim index 3fce086040..d4ad63d43e 100644 --- a/test/old/testdir/test_cmdline.vim +++ b/test/old/testdir/test_cmdline.vim @@ -294,17 +294,16 @@ func Test_changing_cmdheight() " :resize now also changes 'cmdheight' accordingly call term_sendkeys(buf, ":set cmdheight+=1\") call VerifyScreenDump(buf, 'Test_changing_cmdheight_2', {}) - call term_sendkeys(buf, ":set cmdheight-=1\") " using more space moves the status line up call term_sendkeys(buf, ":set cmdheight+=1\") call VerifyScreenDump(buf, 'Test_changing_cmdheight_3', {}) " reducing cmdheight moves status line down - call term_sendkeys(buf, ":set cmdheight-=2\") + call term_sendkeys(buf, ":set cmdheight-=3\") call VerifyScreenDump(buf, 'Test_changing_cmdheight_4', {}) - " reducing window size and then setting cmdheight + " reducing window size and then setting cmdheight call term_sendkeys(buf, ":resize -1\") call term_sendkeys(buf, ":set cmdheight=1\") call VerifyScreenDump(buf, 'Test_changing_cmdheight_5', {}) @@ -313,10 +312,14 @@ func Test_changing_cmdheight() call term_sendkeys(buf, ":call EchoTwo()\") call VerifyScreenDump(buf, 'Test_changing_cmdheight_6', {}) - " decreasing 'cmdheight' doesn't clear the messages that need hit-enter + " increasing 'cmdheight' doesn't clear the messages that need hit-enter call term_sendkeys(buf, ":call EchoOne()\") call VerifyScreenDump(buf, 'Test_changing_cmdheight_7', {}) + " window commands do not reduce 'cmdheight' to value lower than :set by user + call term_sendkeys(buf, "\:wincmd _\") + call VerifyScreenDump(buf, 'Test_changing_cmdheight_8', {}) + " clean up call StopVimInTerminal(buf) endfunc -- cgit From d5308637bf1aac2b97fccf73a0ffdef304eaa1d6 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 3 Jan 2025 20:12:15 +0800 Subject: vim-patch:9.1.0984: exception handling can be improved Problem: exception handling can be improved Solution: add v:stacktrace and getstacktrace() closes: vim/vim#16360 https://github.com/vim/vim/commit/663d18d6102f40d14e36096ec590445e61026ed6 Co-authored-by: ichizok Co-authored-by: Naruhiko Nishino --- test/old/testdir/test_stacktrace.vim | 107 +++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 test/old/testdir/test_stacktrace.vim (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_stacktrace.vim b/test/old/testdir/test_stacktrace.vim new file mode 100644 index 0000000000..2ff5801ce6 --- /dev/null +++ b/test/old/testdir/test_stacktrace.vim @@ -0,0 +1,107 @@ +" Test for getstacktrace() and v:stacktrace + +let s:thisfile = expand('%:p') +let s:testdir = s:thisfile->fnamemodify(':h') + +func Filepath(name) + return s:testdir .. '/' .. a:name +endfunc + +func AssertStacktrace(expect, actual) + call assert_equal(#{lnum: 581, filepath: Filepath('runtest.vim')}, a:actual[0]) + call assert_equal(a:expect, a:actual[-len(a:expect):]) +endfunc + +func Test_getstacktrace() + let g:stacktrace = [] + let lines1 =<< trim [SCRIPT] + " Xscript1 + source Xscript2 + func Xfunc1() + " Xfunc1 + call Xfunc2() + endfunc + [SCRIPT] + let lines2 =<< trim [SCRIPT] + " Xscript2 + func Xfunc2() + " Xfunc2 + let g:stacktrace = getstacktrace() + endfunc + [SCRIPT] + call writefile(lines1, 'Xscript1', 'D') + call writefile(lines2, 'Xscript2', 'D') + source Xscript1 + call Xfunc1() + call AssertStacktrace([ + \ #{funcref: funcref('Test_getstacktrace'), lnum: 35, filepath: s:thisfile}, + \ #{funcref: funcref('Xfunc1'), lnum: 5, filepath: Filepath('Xscript1')}, + \ #{funcref: funcref('Xfunc2'), lnum: 4, filepath: Filepath('Xscript2')}, + \ ], g:stacktrace) + unlet g:stacktrace +endfunc + +func Test_getstacktrace_event() + let g:stacktrace = [] + let lines1 =<< trim [SCRIPT] + " Xscript1 + func Xfunc() + " Xfunc + let g:stacktrace = getstacktrace() + endfunc + augroup test_stacktrace + autocmd SourcePre * call Xfunc() + augroup END + [SCRIPT] + let lines2 =<< trim [SCRIPT] + " Xscript2 + [SCRIPT] + call writefile(lines1, 'Xscript1', 'D') + call writefile(lines2, 'Xscript2', 'D') + source Xscript1 + source Xscript2 + call AssertStacktrace([ + \ #{funcref: funcref('Test_getstacktrace_event'), lnum: 62, filepath: s:thisfile}, + \ #{event: 'SourcePre Autocommands for "*"', lnum: 7, filepath: Filepath('Xscript1')}, + \ #{funcref: funcref('Xfunc'), lnum: 4, filepath: Filepath('Xscript1')}, + \ ], g:stacktrace) + augroup test_stacktrace + autocmd! + augroup END + unlet g:stacktrace +endfunc + +func Test_vstacktrace() + let lines1 =<< trim [SCRIPT] + " Xscript1 + source Xscript2 + func Xfunc1() + " Xfunc1 + call Xfunc2() + endfunc + [SCRIPT] + let lines2 =<< trim [SCRIPT] + " Xscript2 + func Xfunc2() + " Xfunc2 + throw 'Exception from Xfunc2' + endfunc + [SCRIPT] + call writefile(lines1, 'Xscript1', 'D') + call writefile(lines2, 'Xscript2', 'D') + source Xscript1 + call assert_equal([], v:stacktrace) + try + call Xfunc1() + catch + let stacktrace = v:stacktrace + endtry + call assert_equal([], v:stacktrace) + call AssertStacktrace([ + \ #{funcref: funcref('Test_vstacktrace'), lnum: 95, filepath: s:thisfile}, + \ #{funcref: funcref('Xfunc1'), lnum: 5, filepath: Filepath('Xscript1')}, + \ #{funcref: funcref('Xfunc2'), lnum: 4, filepath: Filepath('Xscript2')}, + \ ], stacktrace) +endfunc + +" vim: shiftwidth=2 sts=2 expandtab -- cgit From 8fa4306eb910028ee8df8685ae9b1649608c2608 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 7 Jan 2025 09:05:52 +0800 Subject: vim-patch:9.1.0991: v:stacktrace has wrong type in Vim9 script Problem: v:stacktrace has wrong type in Vim9 script. Solution: Change the type to t_list_dict_any. Fix grammar in docs. (zeertzjq) closes: vim/vim#16390 https://github.com/vim/vim/commit/6655bef33047b826e0ccb8c686f3f57e47161b1c --- test/old/testdir/test_stacktrace.vim | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_stacktrace.vim b/test/old/testdir/test_stacktrace.vim index 2ff5801ce6..1e47deefdd 100644 --- a/test/old/testdir/test_stacktrace.vim +++ b/test/old/testdir/test_stacktrace.vim @@ -1,5 +1,7 @@ " Test for getstacktrace() and v:stacktrace +source vim9.vim + let s:thisfile = expand('%:p') let s:testdir = s:thisfile->fnamemodify(':h') @@ -34,7 +36,7 @@ func Test_getstacktrace() source Xscript1 call Xfunc1() call AssertStacktrace([ - \ #{funcref: funcref('Test_getstacktrace'), lnum: 35, filepath: s:thisfile}, + \ #{funcref: funcref('Test_getstacktrace'), lnum: 37, filepath: s:thisfile}, \ #{funcref: funcref('Xfunc1'), lnum: 5, filepath: Filepath('Xscript1')}, \ #{funcref: funcref('Xfunc2'), lnum: 4, filepath: Filepath('Xscript2')}, \ ], g:stacktrace) @@ -61,7 +63,7 @@ func Test_getstacktrace_event() source Xscript1 source Xscript2 call AssertStacktrace([ - \ #{funcref: funcref('Test_getstacktrace_event'), lnum: 62, filepath: s:thisfile}, + \ #{funcref: funcref('Test_getstacktrace_event'), lnum: 64, filepath: s:thisfile}, \ #{event: 'SourcePre Autocommands for "*"', lnum: 7, filepath: Filepath('Xscript1')}, \ #{funcref: funcref('Xfunc'), lnum: 4, filepath: Filepath('Xscript1')}, \ ], g:stacktrace) @@ -98,10 +100,33 @@ func Test_vstacktrace() endtry call assert_equal([], v:stacktrace) call AssertStacktrace([ - \ #{funcref: funcref('Test_vstacktrace'), lnum: 95, filepath: s:thisfile}, + \ #{funcref: funcref('Test_vstacktrace'), lnum: 97, filepath: s:thisfile}, \ #{funcref: funcref('Xfunc1'), lnum: 5, filepath: Filepath('Xscript1')}, \ #{funcref: funcref('Xfunc2'), lnum: 4, filepath: Filepath('Xscript2')}, \ ], stacktrace) endfunc +func Test_zzz_stacktrace_vim9() + let lines =<< trim [SCRIPT] + var stacktrace = getstacktrace() + assert_notequal([], stacktrace) + for d in stacktrace + assert_true(has_key(d, 'lnum')) + endfor + try + throw 'Exception from s:Func' + catch + assert_notequal([], v:stacktrace) + assert_equal(len(stacktrace), len(v:stacktrace)) + for d in v:stacktrace + assert_true(has_key(d, 'lnum')) + endfor + endtry + [SCRIPT] + call CheckDefSuccess(lines) + " FIXME: v:stacktrace is not cleared after the exception handling, and this + " test has to be run as the last one because of this. + " call assert_equal([], v:stacktrace) +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From 561580aba5307cbd4d4a6c00cb39048831109bc7 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 7 Jan 2025 21:32:55 +0100 Subject: vim-patch:9.1.0995: filetype: shaderslang files are not detected Problem: filetype: shaderslang files are not detected Solution: detect '*.slang' files as shaderslang filetype, include a filetype and syntax script (mtvare6) Reference: https://shader-slang.com/ closes: vim/vim#16387 https://github.com/vim/vim/commit/616219f684744bcfad61a53c13166cda9b141dea Co-authored-by: mtvare6 --- test/old/testdir/test_filetype.vim | 1 + 1 file changed, 1 insertion(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 685f700130..6c8ab3a270 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -691,6 +691,7 @@ func s:GetFilenameChecks() abort \ '.ash_history', 'any/etc/neofetch/config.conf', '.xprofile', 'user-dirs.defaults', 'user-dirs.dirs', \ 'makepkg.conf', '.makepkg.conf', 'file.mdd', '.env', '.envrc', 'devscripts.conf', '.devscripts', 'file.lo', \ 'file.la', 'file.lai'], + \ 'shaderslang': ['file.slang'], \ 'sieve': ['file.siv', 'file.sieve'], \ 'sil': ['file.sil'], \ 'simula': ['file.sim'], -- cgit From 3f0adf90debb35b5a937480151a659d654106ff6 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 9 Jan 2025 17:30:26 +0800 Subject: vim-patch:9.1.0998: filetype: TI assembly files are not recognized (#31929) Problem: filetype: TI assembly files are not recognized Solution: inspect '*.sa' and assembly files and detect TI assembly files, include filetype plugin and syntax script for TI assembly files (Wu, Zhenyu) closes: vim/vim#15827 https://github.com/vim/vim/commit/4f73c07abff420bad9fa5befc2c284c00b984993 Co-authored-by: Wu, Zhenyu --- test/old/testdir/test_filetype.vim | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 6c8ab3a270..d890884eb5 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -672,7 +672,6 @@ func s:GetFilenameChecks() abort \ 'samba': ['smb.conf'], \ 'sas': ['file.sas'], \ 'sass': ['file.sass'], - \ 'sather': ['file.sa'], \ 'sbt': ['file.sbt'], \ 'scala': ['file.scala'], \ 'scheme': ['file.scm', 'file.ss', 'file.sld', 'file.stsg', 'any/local/share/supertux2/config', '.lips_repl_history'], @@ -2322,6 +2321,22 @@ func Test_cmd_file() filetype off endfunc +func Test_sa_file() + filetype on + + call writefile([';* XXX-a.sa: XXX for TI C6000 DSP *;', '.no_mdep'], 'Xfile.sa') + split Xfile.sa + call assert_equal('tiasm', &filetype) + bwipe! + + call writefile(['-- comment'], 'Xfile.sa') + split Xfile.sa + call assert_equal('sather', &filetype) + bwipe! + + filetype off +endfunc + func Test_sig_file() filetype on -- cgit From 846a2019c0e3b3a91477c12ec2c4ac85861b4d67 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 10 Jan 2025 08:03:44 +0800 Subject: vim-patch:9.1.0999: Vim9: leaking finished exception (#31939) Problem: leaking finished exception (after v9.1.0984) Solution: use finish_exception to clean up caught exceptions (Yee Cheng Chin) In Vimscript, v:exception/throwpoint/stacktrace are supposed to reflect the currently caught exception, and be popped after the exception is finished (via endtry, finally, or a thrown exception inside catch). Vim9script does not handle this properly, and leaks them instead. This is clearly visible when launching GVim with menu enabled. A caught exception inside the s:BMShow() in menu.vim would show up when querying `v:stacktrace` even though the exception was already caught and handled. To fix this, just use the same functionality as Vimscript by calling `finish_exception` to properly restore the states. Note that this assumes `current_exception` is always the same as `caught_stack` which believe should be the case. Added tests for this. Also fix up test_stacktrace to properly test the stack restore behavior where we have nested exceptions in catch blocks and to also test the vim9script functionality properly. - Also, remove its dependency on explicitly checking a line number in runtest.vim which is a very fragile way to write tests as any minor change in runtest.vim (shared among all tests) would require changing test_stacktrace.vim. We don't actually need such granularity in the test. closes: vim/vim#16413 https://github.com/vim/vim/commit/2051af1642843426714efc2572c3e270fe0948be Co-authored-by: Yee Cheng Chin --- test/old/testdir/test_stacktrace.vim | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_stacktrace.vim b/test/old/testdir/test_stacktrace.vim index 1e47deefdd..9e1f51e1f6 100644 --- a/test/old/testdir/test_stacktrace.vim +++ b/test/old/testdir/test_stacktrace.vim @@ -10,7 +10,7 @@ func Filepath(name) endfunc func AssertStacktrace(expect, actual) - call assert_equal(#{lnum: 581, filepath: Filepath('runtest.vim')}, a:actual[0]) + call assert_equal(Filepath('runtest.vim'), a:actual[0]['filepath']) call assert_equal(a:expect, a:actual[-len(a:expect):]) endfunc @@ -97,6 +97,12 @@ func Test_vstacktrace() call Xfunc1() catch let stacktrace = v:stacktrace + try + call Xfunc1() + catch + let stacktrace_inner = v:stacktrace + endtry + let stacktrace_after = v:stacktrace " should be restored by the exception stack to the previous one endtry call assert_equal([], v:stacktrace) call AssertStacktrace([ @@ -104,9 +110,15 @@ func Test_vstacktrace() \ #{funcref: funcref('Xfunc1'), lnum: 5, filepath: Filepath('Xscript1')}, \ #{funcref: funcref('Xfunc2'), lnum: 4, filepath: Filepath('Xscript2')}, \ ], stacktrace) + call AssertStacktrace([ + \ #{funcref: funcref('Test_vstacktrace'), lnum: 101, filepath: s:thisfile}, + \ #{funcref: funcref('Xfunc1'), lnum: 5, filepath: Filepath('Xscript1')}, + \ #{funcref: funcref('Xfunc2'), lnum: 4, filepath: Filepath('Xscript2')}, + \ ], stacktrace_inner) + call assert_equal(stacktrace, stacktrace_after) endfunc -func Test_zzz_stacktrace_vim9() +func Test_stacktrace_vim9() let lines =<< trim [SCRIPT] var stacktrace = getstacktrace() assert_notequal([], stacktrace) @@ -122,11 +134,9 @@ func Test_zzz_stacktrace_vim9() assert_true(has_key(d, 'lnum')) endfor endtry + call assert_equal([], v:stacktrace) [SCRIPT] call CheckDefSuccess(lines) - " FIXME: v:stacktrace is not cleared after the exception handling, and this - " test has to be run as the last one because of this. - " call assert_equal([], v:stacktrace) endfunc " vim: shiftwidth=2 sts=2 expandtab -- cgit From a37784ad831fdf31e7eeafdd41f7d3cb81b1a07f Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 10 Jan 2025 08:04:02 +0800 Subject: vim-patch:9.1.1000: tests: ruby tests fail with Ruby 3.4 (#31940) Problem: tests: ruby tests fail with Ruby 3.4 Solution: adjust expected output for Ruby 3.4 (Yee Cheng Chin) Vim's Ruby tests relied on explicit matching of output texts which are fragile in design. Ruby 3.4 has changed the output slightly (using 'name' instead of `name', and also using more spaces in dictionary printouts). Modify the Vim tests to be less fragile to such changes. closes: vim/vim#16411 https://github.com/vim/vim/commit/ebea31e454b9a1731cde845226f2c28ca5c097b1 Co-authored-by: Yee Cheng Chin --- test/old/testdir/test_ruby.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_ruby.vim b/test/old/testdir/test_ruby.vim index d4a3dc3301..4d54d29df7 100644 --- a/test/old/testdir/test_ruby.vim +++ b/test/old/testdir/test_ruby.vim @@ -282,7 +282,7 @@ func Test_ruby_Vim_buffer_get() call assert_match('Xfoo1$', rubyeval('Vim::Buffer[1].name')) call assert_match('Xfoo2$', rubyeval('Vim::Buffer[2].name')) call assert_fails('ruby print Vim::Buffer[3].name', - \ "NoMethodError: undefined method `name' for nil") + \ "NoMethodError") %bwipe endfunc @@ -364,7 +364,7 @@ func Test_ruby_Vim_evaluate_dict() redir => l:out ruby d = Vim.evaluate("d"); print d redir END - call assert_equal(['{"a"=>"foo", "b"=>123}'], split(l:out, "\n")) + call assert_equal(['{"a"=>"foo","b"=>123}'], split(substitute(l:out, '\s', '', 'g'), "\n")) endfunc " Test Vim::message({msg}) (display message {msg}) @@ -384,7 +384,7 @@ func Test_ruby_print() call assert_equal('1.23', RubyPrint('1.23')) call assert_equal('Hello World!', RubyPrint('"Hello World!"')) call assert_equal('[1, 2]', RubyPrint('[1, 2]')) - call assert_equal('{"k1"=>"v1", "k2"=>"v2"}', RubyPrint('({"k1" => "v1", "k2" => "v2"})')) + call assert_equal('{"k1"=>"v1","k2"=>"v2"}', substitute(RubyPrint('({"k1" => "v1", "k2" => "v2"})'), '\s', '', 'g')) call assert_equal('true', RubyPrint('true')) call assert_equal('false', RubyPrint('false')) call assert_equal('', RubyPrint('nil')) -- cgit From fbe546e25d21f3184814d696c329d23d146bd615 Mon Sep 17 00:00:00 2001 From: glepnir Date: Sat, 11 Jan 2025 07:58:45 +0800 Subject: vim-patch:9.1.0996: ComplMatchIns may highlight wrong text (#31931) Problem: ComplMatchIns may highlight wrong text Solution: don't highlight in case of fuzzy match, skip-highlight when not inserting anything (glepnir) closes: vim/vim#16404 https://github.com/vim/vim/commit/e890887b8052561ac5f8dce218e578ed28599cc6 --- test/old/testdir/test_popup.vim | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_popup.vim b/test/old/testdir/test_popup.vim index e902ea3bc2..7f570182e4 100644 --- a/test/old/testdir/test_popup.vim +++ b/test/old/testdir/test_popup.vim @@ -1817,6 +1817,20 @@ func Test_pum_matchins_highlight_combine() call VerifyScreenDump(buf, 'Test_pum_matchins_combine_06', {}) call term_sendkeys(buf, "\") + " Does not highlight the compl leader + call TermWait(buf) + call term_sendkeys(buf, ":set cot+=menuone,noselect\") + call TermWait(buf) + call term_sendkeys(buf, "S\\f\") + call VerifyScreenDump(buf, 'Test_pum_matchins_combine_07', {}) + call term_sendkeys(buf, "\\") + + call term_sendkeys(buf, ":set cot+=fuzzy\") + call TermWait(buf) + call term_sendkeys(buf, "S\\f\") + call VerifyScreenDump(buf, 'Test_pum_matchins_combine_08', {}) + call term_sendkeys(buf, "\\") + call StopVimInTerminal(buf) endfunc -- cgit From 37316fbac641ecafde29fd750a08ece490d209c1 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 12 Jan 2025 08:04:25 +0800 Subject: vim-patch:9.1.1005: completion text is highlighted even with no pattern found (#31973) Problem: completion text is highlighted even with no pattern found Solution: use ins_compl_leader_len() instead of checking compl_leader.length (glepnir) closes: vim/vim#16422 https://github.com/vim/vim/commit/9fddb8ae770be3e16545dd4c2f4cfaad8f62cb40 Co-authored-by: glepnir --- test/old/testdir/test_popup.vim | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_popup.vim b/test/old/testdir/test_popup.vim index 7f570182e4..31cfc2d096 100644 --- a/test/old/testdir/test_popup.vim +++ b/test/old/testdir/test_popup.vim @@ -1830,6 +1830,13 @@ func Test_pum_matchins_highlight_combine() call term_sendkeys(buf, "S\\f\") call VerifyScreenDump(buf, 'Test_pum_matchins_combine_08', {}) call term_sendkeys(buf, "\\") + call TermWait(buf) + + call term_sendkeys(buf, ":set cot-=fuzzy\") + call TermWait(buf) + call term_sendkeys(buf, "Sf\") + call VerifyScreenDump(buf, 'Test_pum_matchins_combine_09', {}) + call term_sendkeys(buf, "\\") call StopVimInTerminal(buf) endfunc -- cgit From 1a8a48d7e5f8243aff0253a82f4214241eb877d6 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 12 Jan 2025 08:25:57 +0800 Subject: vim-patch:9.1.1003: [security]: heap-buffer-overflow with visual mode (#31971) Problem: [security]: heap-buffer-overflow with visual mode when using :all, causing Vim trying to access beyond end-of-line (gandalf) Solution: Reset visual mode on :all, validate position in gchar_pos() and charwise_block_prep() This fixes CVE-2025-22134 Github Advisory: https://github.com/vim/vim/security/advisories/GHSA-5rgf-26wj-48v8 https://github.com/vim/vim/commit/c9a1e257f1630a0866447e53a564f7ff96a80ead Co-authored-by: Christian Brabandt --- test/old/testdir/test_visual.vim | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_visual.vim b/test/old/testdir/test_visual.vim index 39388cbc27..328ac502bf 100644 --- a/test/old/testdir/test_visual.vim +++ b/test/old/testdir/test_visual.vim @@ -470,7 +470,7 @@ func Test_Visual_Block() \ "\t{", \ "\t}"], getline(1, '$')) - close! + bw! endfunc " Test for 'p'ut in visual block mode @@ -1082,7 +1082,7 @@ func Test_star_register() delmarks < > call assert_fails('*yank', 'E20:') - close! + bw! endfunc " Test for changing text in visual mode with 'exclusive' selection @@ -1098,7 +1098,7 @@ func Test_exclusive_selection() call assert_equal('l one', getline(1)) set virtualedit& set selection& - close! + bw! endfunc " Test for starting linewise visual with a count. @@ -1155,7 +1155,7 @@ func Test_visual_inner_block() 8,9d call cursor(5, 1) call assert_beeps('normal ViBiB') - close! + bw! endfunc func Test_visual_put_in_block() @@ -2764,4 +2764,22 @@ func Test_visual_block_exclusive_selection_adjusted() set selection&vim endfunc +" the following caused a Heap-Overflow, because Vim was accessing outside of a +" line end +func Test_visual_pos_buffer_heap_overflow() + set virtualedit=all + args Xa Xb + all + call setline(1, ['', '', '']) + call cursor(3, 1) + wincmd w + call setline(1, 'foobar') + normal! $lv0 + all + call setreg('"', 'baz') + normal! [P + set virtualedit= + bw! Xa Xb +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From bf58b757c4c2e1bf2a4afe4279150ca68a68691f Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 12 Jan 2025 11:42:02 +0100 Subject: vim-patch:9.1.1007: filetype: various ignore are not recognized Problem: filetype: various ignore are not recognized Solution: detect rg/docker/npm/vvsce ignore files as 'gitgnore' filetype (Wu, Zhenyu) Not only prettier, but many programs also support ignore files (like rg, docker, npm, vscode). So use the gitignore filetype for them due to same syntax closes: vim/vim#16428 https://github.com/vim/vim/commit/8cbe2e0a0a78f57bb545a97695bfedd6a95e6992 Co-authored-by: Wu, Zhenyu --- test/old/testdir/test_filetype.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index d890884eb5..5182ff5167 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -308,7 +308,7 @@ func s:GetFilenameChecks() abort \ 'gitattributes': ['file.git/info/attributes', '.gitattributes', '/.config/git/attributes', '/etc/gitattributes', '/usr/local/etc/gitattributes', 'some.git/info/attributes'] + s:WhenConfigHome('$XDG_CONFIG_HOME/git/attributes'), \ 'gitcommit': ['COMMIT_EDITMSG', 'MERGE_MSG', 'TAG_EDITMSG', 'NOTES_EDITMSG', 'EDIT_DESCRIPTION'], \ 'gitconfig': ['file.git/config', 'file.git/config.worktree', 'file.git/worktrees/x/config.worktree', '.gitconfig', '.gitmodules', 'file.git/modules//config', '/.config/git/config', '/etc/gitconfig', '/usr/local/etc/gitconfig', '/etc/gitconfig.d/file', 'any/etc/gitconfig.d/file', '/.gitconfig.d/file', 'any/.config/git/config', 'any/.gitconfig.d/file', 'some.git/config', 'some.git/modules/any/config'] + s:WhenConfigHome('$XDG_CONFIG_HOME/git/config'), - \ 'gitignore': ['file.git/info/exclude', '.gitignore', '/.config/git/ignore', 'some.git/info/exclude'] + s:WhenConfigHome('$XDG_CONFIG_HOME/git/ignore') + ['.prettierignore'], + \ 'gitignore': ['file.git/info/exclude', '.gitignore', '/.config/git/ignore', 'some.git/info/exclude'] + s:WhenConfigHome('$XDG_CONFIG_HOME/git/ignore') + ['.prettierignore', '.rgignore', '.ignore', '.dockerignore', '.npmignore', '.vscodeignore'], \ 'gitolite': ['gitolite.conf', '/gitolite-admin/conf/file', 'any/gitolite-admin/conf/file'], \ 'gitrebase': ['git-rebase-todo'], \ 'gitsendemail': ['.gitsendemail.msg.xxxxxx'], -- cgit From 2c16c849986794682a4776ff4ec100d00eeba5ca Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 13 Jan 2025 15:18:47 +0800 Subject: vim-patch:9.1.1011: popupmenu internal error with some abbr in completion item (#31988) Problem: Popup menu internal error with some abbr in completion item. Solution: Don't compute attributes when there is no corresponding text. Reduce indent in pum_redraw() while at it (zeertzjq). fixes: vim/vim#16427 closes: vim/vim#16435 https://github.com/vim/vim/commit/3a0cc36c69744a7727ce34311d39d2d9d8ddc6f9 --- test/old/testdir/test_popup.vim | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_popup.vim b/test/old/testdir/test_popup.vim index 31cfc2d096..e4abf978ab 100644 --- a/test/old/testdir/test_popup.vim +++ b/test/old/testdir/test_popup.vim @@ -1519,6 +1519,39 @@ func Test_pum_highlights_match() call StopVimInTerminal(buf) endfunc +func Test_pum_highlights_match_with_abbr() + CheckScreendump + let lines =<< trim END + func Omni_test(findstart, base) + if a:findstart + return col(".") + endif + return { + \ 'words': [ + \ { 'word': 'foobar', 'abbr': "foobar\t\t!" }, + \ { 'word': 'foobaz', 'abbr': "foobaz\t\t!" }, + \]} + endfunc + + set omnifunc=Omni_test + set completeopt=menuone,noinsert + hi PmenuMatchSel ctermfg=6 ctermbg=7 + hi PmenuMatch ctermfg=4 ctermbg=225 + END + call writefile(lines, 'Xscript', 'D') + let buf = RunVimInTerminal('-S Xscript', {}) + call TermWait(buf) + call term_sendkeys(buf, "i\\") + call TermWait(buf, 50) + call term_sendkeys(buf, "foo") + call VerifyScreenDump(buf, 'Test_pum_highlights_19', {}) + + call term_sendkeys(buf, "\\") + call TermWait(buf) + + call StopVimInTerminal(buf) +endfunc + func Test_pum_user_abbr_hlgroup() CheckScreendump let lines =<< trim END -- cgit From 34e2185022ab698827b72751d77e218a1b6b6afe Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Fri, 10 Jan 2025 10:20:43 +0000 Subject: fix(options): better handling of empty values Problem: Whether an option is allowed to be empty isn't well defined and isn't properly checked. Solution: - For non-list string options, explicitly check the option value if it is empty. - Annotate non-list string options that can accept an empty value. - Adjust command completion to ignore the empty value. - Render values in Lua meta files --- test/old/testdir/gen_opt_test.vim | 14 +++++++------- test/old/testdir/test_options.vim | 3 ++- test/old/testdir/test_termdebug.vim | 6 ++++-- 3 files changed, 13 insertions(+), 10 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/gen_opt_test.vim b/test/old/testdir/gen_opt_test.vim index 3802ee3fc9..bcb0f3d4c4 100644 --- a/test/old/testdir/gen_opt_test.vim +++ b/test/old/testdir/gen_opt_test.vim @@ -145,8 +145,8 @@ let test_values = { \ 'winwidth': [[1, 10, 999], [-1, 0]], \ "\ string options - \ 'ambiwidth': [['', 'single', 'double'], ['xxx']], - \ 'background': [['', 'light', 'dark'], ['xxx']], + \ 'ambiwidth': [['single', 'double'], ['xxx']], + \ 'background': [['light', 'dark'], ['xxx']], "\ 'backspace': [[0, 1, 2, 3, '', 'indent', 'eol', 'start', 'nostop', "\ " 'eol,start', 'indent,eol,nostop'], "\ " [-1, 4, 'xxx']], @@ -214,12 +214,12 @@ let test_values = { \ ['xxx', 'foldcolumn:xxx', 'algorithm:xxx', 'algorithm:']], \ 'display': [['', 'lastline', 'truncate', 'uhex', 'lastline,uhex'], \ ['xxx']], - \ 'eadirection': [['', 'both', 'ver', 'hor'], ['xxx', 'ver,hor']], + \ 'eadirection': [['both', 'ver', 'hor'], ['xxx', 'ver,hor']], "\ 'encoding': [['latin1'], ['xxx', '']], \ 'eventignore': [['', 'WinEnter', 'WinLeave,winenter', 'all,WinEnter'], \ ['xxx']], \ 'fileencoding': [['', 'latin1', 'xxx'], []], - \ 'fileformat': [['', 'dos', 'unix', 'mac'], ['xxx']], + \ 'fileformat': [['dos', 'unix', 'mac'], ['xxx']], \ 'fileformats': [['', 'dos', 'dos,unix'], ['xxx']], \ 'fillchars': [['', 'stl:x', 'stlnc:x', 'vert:x', 'fold:x', 'foldopen:x', \ 'foldclose:x', 'foldsep:x', 'diff:x', 'eob:x', 'lastline:x', @@ -274,7 +274,7 @@ let test_values = { \ 'mkspellmem': [['10000,100,12'], ['', 'xxx', '10000,100']], \ 'mouse': [['', 'n', 'v', 'i', 'c', 'h', 'a', 'r', 'nvi'], \ ['xxx', 'n,v,i']], - \ 'mousemodel': [['', 'extend', 'popup', 'popup_setpos'], ['xxx']], + \ 'mousemodel': [['extend', 'popup', 'popup_setpos'], ['xxx']], \ 'mouseshape': [['', 'n:arrow'], ['xxx']], \ 'nrformats': [['', 'alpha', 'octal', 'hex', 'bin', 'unsigned', 'blank', \ 'alpha,hex,bin'], @@ -299,7 +299,7 @@ let test_values = { \ 'sessionoptions': [['', 'blank', 'curdir', 'sesdir', \ 'help,options,slash'], \ ['xxx', 'curdir,sesdir']], - \ 'showcmdloc': [['', 'last', 'statusline', 'tabline'], ['xxx']], + \ 'showcmdloc': [['last', 'statusline', 'tabline'], ['xxx']], "\ 'signcolumn': [['', 'auto', 'no', 'yes', 'number'], ['xxx', 'no,yes']], \ 'spellfile': [['', 'file.en.add', 'xxx.en.add,yyy.gb.add,zzz.ja.add', \ '/tmp/dir\ with\ space/en.utf-8.add', @@ -311,7 +311,7 @@ let test_values = { \ 'spellsuggest': [['', 'best', 'double', 'fast', '100', 'timeout:100', \ 'timeout:-1', 'file:/tmp/file', 'expr:Func()', 'double,33'], \ ['xxx', '-1', 'timeout:', 'best,double', 'double,fast']], - \ 'splitkeep': [['', 'cursor', 'screen', 'topline'], ['xxx']], + \ 'splitkeep': [['cursor', 'screen', 'topline'], ['xxx']], \ 'statusline': [['', 'xxx'], ['%$', '%{', '%{%', '%{%}', '%(', '%)']], "\ 'swapsync': [['', 'sync', 'fsync'], ['xxx']], \ 'switchbuf': [['', 'useopen', 'usetab', 'split', 'vsplit', 'newtab', diff --git a/test/old/testdir/test_options.vim b/test/old/testdir/test_options.vim index d090186b62..dfa140b163 100644 --- a/test/old/testdir/test_options.vim +++ b/test/old/testdir/test_options.vim @@ -504,7 +504,8 @@ func Test_set_completion_string_values() call assert_equal('current', getcompletion('set browsedir=', 'cmdline')[1]) endif call assert_equal('unload', getcompletion('set bufhidden=', 'cmdline')[1]) - call assert_equal('nowrite', getcompletion('set buftype=', 'cmdline')[1]) + "call assert_equal('nowrite', getcompletion('set buftype=', 'cmdline')[1]) + call assert_equal('help', getcompletion('set buftype=', 'cmdline')[1]) call assert_equal('internal', getcompletion('set casemap=', 'cmdline')[1]) if exists('+clipboard') " call assert_match('unnamed', getcompletion('set clipboard=', 'cmdline')[1]) diff --git a/test/old/testdir/test_termdebug.vim b/test/old/testdir/test_termdebug.vim index eb88ea6f5f..6ff233fff0 100644 --- a/test/old/testdir/test_termdebug.vim +++ b/test/old/testdir/test_termdebug.vim @@ -391,7 +391,8 @@ endfunc function Test_termdebug_save_restore_variables() " saved mousemodel - let &mousemodel='' + "let &mousemodel='' + let &mousemodel='extend' " saved keys nnoremap K :echo "hello world!" @@ -414,7 +415,8 @@ function Test_termdebug_save_restore_variables() quit! call WaitForAssert({-> assert_equal(1, winnr('$'))}) - call assert_true(empty(&mousemodel)) + "call assert_true(empty(&mousemodel)) + call assert_equal(&mousemodel, 'extend') call assert_true(empty(expected_map_minus)) call assert_equal(expected_map_K.rhs, maparg('K', 'n', 0, 1).rhs) -- cgit From 69ad6b12ec473a54f09a11596da724178185eb7a Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 14 Jan 2025 18:55:06 +0800 Subject: vim-patch:9.1.1010: filetype: VisualCode setting file not recognized (#32003) Problem: filetype: VisualCode setting file not recognized Solution: detect json files in VSCode config directory as jsonc filetype (Konfekt) closes: vim/vim#16400 https://github.com/vim/vim/commit/c200f53cbb03fa11e489a27791d5b9dfc34a6564 Co-authored-by: Konfekt --- test/old/testdir/test_filetype.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 5182ff5167..2c6b1bd0f4 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -395,7 +395,7 @@ func s:GetFilenameChecks() abort \ 'jq': ['file.jq'], \ 'json': ['file.json', 'file.jsonp', 'file.json-patch', 'file.geojson', 'file.webmanifest', 'Pipfile.lock', 'file.ipynb', 'file.jupyterlab-settings', '.prettierrc', '.firebaserc', '.stylelintrc', '.lintstagedrc', 'file.slnf', 'file.sublime-project', 'file.sublime-settings', 'file.sublime-workspace', 'file.bd', 'file.bda', 'file.xci', 'flake.lock', 'pack.mcmeta', 'deno.lock'], \ 'json5': ['file.json5'], - \ 'jsonc': ['file.jsonc', '.babelrc', '.eslintrc', '.jsfmtrc', '.jshintrc', '.jscsrc', '.vsconfig', '.hintrc', '.swrc', 'jsconfig.json', 'tsconfig.json', 'tsconfig.test.json', 'tsconfig-test.json', '.luaurc', 'bun.lock'], + \ 'jsonc': ['file.jsonc', '.babelrc', '.eslintrc', '.jsfmtrc', '.jshintrc', '.jscsrc', '.vsconfig', '.hintrc', '.swrc', 'jsconfig.json', 'tsconfig.json', 'tsconfig.test.json', 'tsconfig-test.json', '.luaurc', 'bun.lock', expand("$HOME/.config/VSCodium/User/settings.json")], \ 'jsonl': ['file.jsonl'], \ 'jsonnet': ['file.jsonnet', 'file.libsonnet'], \ 'jsp': ['file.jsp'], -- cgit From 09e01437c968be4c6e9f6bb3ac8811108c58008c Mon Sep 17 00:00:00 2001 From: Maria José Solano Date: Mon, 13 Jan 2025 19:45:11 -0800 Subject: refactor: use nvim.foo.bar format for autocommand groups --- test/old/testdir/setup.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/setup.vim b/test/old/testdir/setup.vim index b104d733f0..61596fc83a 100644 --- a/test/old/testdir/setup.vim +++ b/test/old/testdir/setup.vim @@ -65,7 +65,7 @@ mapclear mapclear! aunmenu * tlunmenu * -autocmd! nvim_popupmenu +autocmd! nvim.popupmenu " Undo the 'grepprg' and 'grepformat' setting in _defaults.lua. set grepprg& grepformat& -- cgit From 524be56042335db589b9fe62dfdae39be3f69a15 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Thu, 16 Jan 2025 00:34:25 +0100 Subject: vim-patch:9.1.1019: filetype: fd ignore files are not recognized (#32042) Problem: filetype: fd ignore files are not recognized Solution: detect .fdignore files as gitignore filetype closes: vim/vim#16444 https://github.com/vim/vim/commit/3058087f6f04be788118e94e942e0f0c9fca25f0 Co-authored-by: Wu, Zhenyu --- test/old/testdir/test_filetype.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 2c6b1bd0f4..6b07c66dc0 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -308,7 +308,7 @@ func s:GetFilenameChecks() abort \ 'gitattributes': ['file.git/info/attributes', '.gitattributes', '/.config/git/attributes', '/etc/gitattributes', '/usr/local/etc/gitattributes', 'some.git/info/attributes'] + s:WhenConfigHome('$XDG_CONFIG_HOME/git/attributes'), \ 'gitcommit': ['COMMIT_EDITMSG', 'MERGE_MSG', 'TAG_EDITMSG', 'NOTES_EDITMSG', 'EDIT_DESCRIPTION'], \ 'gitconfig': ['file.git/config', 'file.git/config.worktree', 'file.git/worktrees/x/config.worktree', '.gitconfig', '.gitmodules', 'file.git/modules//config', '/.config/git/config', '/etc/gitconfig', '/usr/local/etc/gitconfig', '/etc/gitconfig.d/file', 'any/etc/gitconfig.d/file', '/.gitconfig.d/file', 'any/.config/git/config', 'any/.gitconfig.d/file', 'some.git/config', 'some.git/modules/any/config'] + s:WhenConfigHome('$XDG_CONFIG_HOME/git/config'), - \ 'gitignore': ['file.git/info/exclude', '.gitignore', '/.config/git/ignore', 'some.git/info/exclude'] + s:WhenConfigHome('$XDG_CONFIG_HOME/git/ignore') + ['.prettierignore', '.rgignore', '.ignore', '.dockerignore', '.npmignore', '.vscodeignore'], + \ 'gitignore': ['file.git/info/exclude', '.gitignore', '/.config/git/ignore', 'some.git/info/exclude'] + s:WhenConfigHome('$XDG_CONFIG_HOME/git/ignore') + ['.prettierignore', '.fdignore', '/.config/fd/ignore', '.ignore', '.rgignore', '.dockerignore', '.npmignore', '.vscodeignore'], \ 'gitolite': ['gitolite.conf', '/gitolite-admin/conf/file', 'any/gitolite-admin/conf/file'], \ 'gitrebase': ['git-rebase-todo'], \ 'gitsendemail': ['.gitsendemail.msg.xxxxxx'], -- cgit From 718e16536052c0e75de61a32ef237a9e87fc03f2 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 16 Jan 2025 09:16:25 +0800 Subject: vim-patch:9.1.1018: v9.1.0743 causes regression with diff mode (#32047) Problem: v9.1.0743 causes regression with diff mode Solution: Fix the regression with overlapping regions closes: vim/vim#16454 https://github.com/vim/vim/commit/01f6509fb2de1627cc4ec2c109cd0aa2e3346d50 Co-authored-by: Yukihiro Nakadaira --- test/old/testdir/test_diffmode.vim | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_diffmode.vim b/test/old/testdir/test_diffmode.vim index 880286d329..695aeeac75 100644 --- a/test/old/testdir/test_diffmode.vim +++ b/test/old/testdir/test_diffmode.vim @@ -2004,6 +2004,12 @@ func Test_diff_overlapped_diff_blocks_will_be_merged() call WriteDiffFiles3(buf, ["a", "b", "c"], ["a", "x", "c"], ["a", "b", "y", "c"]) call VerifyBoth(buf, "Test_diff_overlapped_3.37", "") + call WriteDiffFiles3(buf, ["a", "b", "c"], ["d", "e"], ["b", "f"]) + call VerifyBoth(buf, "Test_diff_overlapped_3.38", "") + + call WriteDiffFiles3(buf, ["a", "b", "c"], ["d", "e"], ["b"]) + call VerifyBoth(buf, "Test_diff_overlapped_3.39", "") + call StopVimInTerminal(buf) endfunc -- cgit From f8680d009741d01e137aeb2232aa7e033cd70d7b Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 16 Jan 2025 09:27:08 +0800 Subject: vim-patch:9.1.1013: Vim9: Regression caused by patch v9.1.0646 Problem: Vim9: Regression caused by patch v9.1.0646 Solution: Translate the function name before invoking it in call() (Yegappan Lakshmanan) fixes: vim/vim#16430 closes: vim/vim#16445 https://github.com/vim/vim/commit/6289f9159102e0855bedc566636b5e7ca6ced72c N/A patch: vim-patch:8.2.4176: Vim9: cannot use imported function with call() Co-authored-by: Yegappan Lakshmanan --- test/old/testdir/test_user_func.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_user_func.vim b/test/old/testdir/test_user_func.vim index 3c24412eb7..b509b03778 100644 --- a/test/old/testdir/test_user_func.vim +++ b/test/old/testdir/test_user_func.vim @@ -380,7 +380,7 @@ func Test_script_local_func() " Try to call a script local function in global scope let lines =<< trim [CODE] :call assert_fails('call s:Xfunc()', 'E81:') - :call assert_fails('let x = call("Xfunc", [])', 'E120:') + :call assert_fails('let x = call("Xfunc", [])', ['E81:', 'E117:']) :call writefile(v:errors, 'Xresult') :qall -- cgit From 47a4e4239203fe96d404874bdc1ea6910f72b695 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 16 Jan 2025 09:35:52 +0800 Subject: vim-patch:9.1.1017: Vim9: Patch 9.1.1013 causes a few problems Problem: Vim9: Patch 9.1.1013 causes a few problems Solution: Translate the function name only when it is a string (Yegappan Lakshmanan) fixes: vim/vim#16453 closes: vim/vim#16450 https://github.com/vim/vim/commit/9904cbca4132f7376246a1a31305eb53e9530023 Cherry-pick call() change from patch 9.0.0345. Co-authored-by: Yegappan Lakshmanan --- test/old/testdir/test_functions.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_functions.vim b/test/old/testdir/test_functions.vim index 327ea98e1c..01e6001dcc 100644 --- a/test/old/testdir/test_functions.vim +++ b/test/old/testdir/test_functions.vim @@ -2672,7 +2672,9 @@ endfunc func Test_call() call assert_equal(3, call('len', [123])) call assert_equal(3, 'len'->call([123])) - call assert_fails("call call('len', 123)", 'E714:') + call assert_equal(4, call({ x -> len(x) }, ['xxxx'])) + call assert_equal(2, call(function('len'), ['xx'])) + call assert_fails("call call('len', 123)", 'E1211:') call assert_equal(0, call('', [])) call assert_equal(0, call('len', v:_null_list)) -- cgit From 0d3a8e8c1a7778c6c79658f26ba492a5f4a17d18 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 17 Jan 2025 08:38:58 +0800 Subject: vim-patch:9.1.1020: no way to get current selected item in a async context (#32056) Problem: no way to get current selected item in a async context Solution: add completed flag to show the entries of currently selected index item (glepnir) closes: vim/vim#16451 https://github.com/vim/vim/commit/037b028a2219d09bc97be04b300b2c0490c4268d Co-authored-by: glepnir --- test/old/testdir/test_ins_complete.vim | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_ins_complete.vim b/test/old/testdir/test_ins_complete.vim index 52fd24881c..f1ff45ff90 100644 --- a/test/old/testdir/test_ins_complete.vim +++ b/test/old/testdir/test_ins_complete.vim @@ -2914,4 +2914,34 @@ func Test_complete_info_matches() set cot& endfunc +func Test_complete_info_completed() + func ShownInfo() + let g:compl_info = complete_info(['completed']) + return '' + endfunc + set completeopt+=noinsert + + new + call setline(1, ['aaa', 'aab', 'aba', 'abb']) + inoremap =ShownInfo() + + call feedkeys("Go\\\\dd", 'tx') + call assert_equal({'word': 'aaa', 'menu': '', 'user_data': '', 'info': '', 'kind': '', 'abbr': ''}, g:compl_info['completed']) + + call feedkeys("Go\\\\\dd", 'tx') + call assert_equal({'word': 'aab', 'menu': '', 'user_data': '', 'info': '', 'kind': '', 'abbr': ''}, g:compl_info['completed']) + + call feedkeys("Go\\\\\\\dd", 'tx') + call assert_equal({'word': 'abb', 'menu': '', 'user_data': '', 'info': '', 'kind': '', 'abbr': ''}, g:compl_info['completed']) + + set completeopt+=noselect + call feedkeys("Go\\\\dd", 'tx') + call assert_equal({}, g:compl_info) + + bw! + bw! + delfunc ShownInfo + set cot& +endfunc + " vim: shiftwidth=2 sts=2 expandtab nofoldenable -- cgit From 3530182ba491ba8663b40bdff0c044d74e89bb82 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 17 Jan 2025 13:46:58 +0100 Subject: vim-patch:9.1.1026: filetype: swc configuration files are not recognized Problem: filetype: swc configuration files are not recognized Solution: detect .swcrc files as json filetype (Marces Engel) References: https://swc.rs/docs/configuration/swcrc closes: vim/vim#16462 https://github.com/vim/vim/commit/3a738fccaaf6737c91641856ea00579dbe68bd4e Co-authored-by: Marces Engel --- test/old/testdir/test_filetype.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 6b07c66dc0..7213f3b032 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -393,7 +393,7 @@ func s:GetFilenameChecks() abort \ 'jovial': ['file.jov', 'file.j73', 'file.jovial'], \ 'jproperties': ['file.properties', 'file.properties_xx', 'file.properties_xx_xx', 'some.properties_xx_xx_file', 'org.eclipse.xyz.prefs'], \ 'jq': ['file.jq'], - \ 'json': ['file.json', 'file.jsonp', 'file.json-patch', 'file.geojson', 'file.webmanifest', 'Pipfile.lock', 'file.ipynb', 'file.jupyterlab-settings', '.prettierrc', '.firebaserc', '.stylelintrc', '.lintstagedrc', 'file.slnf', 'file.sublime-project', 'file.sublime-settings', 'file.sublime-workspace', 'file.bd', 'file.bda', 'file.xci', 'flake.lock', 'pack.mcmeta', 'deno.lock'], + \ 'json': ['file.json', 'file.jsonp', 'file.json-patch', 'file.geojson', 'file.webmanifest', 'Pipfile.lock', 'file.ipynb', 'file.jupyterlab-settings', '.prettierrc', '.firebaserc', '.stylelintrc', '.lintstagedrc', 'file.slnf', 'file.sublime-project', 'file.sublime-settings', 'file.sublime-workspace', 'file.bd', 'file.bda', 'file.xci', 'flake.lock', 'pack.mcmeta', 'deno.lock', '.swcrc'], \ 'json5': ['file.json5'], \ 'jsonc': ['file.jsonc', '.babelrc', '.eslintrc', '.jsfmtrc', '.jshintrc', '.jscsrc', '.vsconfig', '.hintrc', '.swrc', 'jsconfig.json', 'tsconfig.json', 'tsconfig.test.json', 'tsconfig-test.json', '.luaurc', 'bun.lock', expand("$HOME/.config/VSCodium/User/settings.json")], \ 'jsonl': ['file.jsonl'], -- cgit From 5b025b499ec430f1733409f0fb5ba3f88ce25a88 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 18 Jan 2025 10:42:11 +0100 Subject: vim-patch:9.1.1030: filetype: setting bash filetype is backwards incompatible Problem: filetype: setting bash filetype is backwards incompatible Solution: revert patch v9.1.0965, detect bash scripts again as sh filetype This reverts commit b9b762c21f2b61e0e7d8fee43d4d3dc8ecffd721. related: vim/vim#16309 https://github.com/vim/vim/commit/727c567a0934643e2d6e1dd92d4e636b17d9067f Co-authored-by: Christian Brabandt vim-patch:9.1.1033: tests: shaderslang was removed from test_filetype erroneously Problem: tests: shaderslang was removed from test_filetype erroneously (Christian Clason, after v9.1.1030) Solution: restore the test https://github.com/vim/vim/commit/1d2867df0c5dfa3d2444229f9e4b23d6ff935956 Co-authored-by: Christian Brabandt --- test/old/testdir/test_filetype.vim | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 7213f3b032..020603015f 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -128,9 +128,6 @@ func s:GetFilenameChecks() abort \ 'ave': ['file.ave'], \ 'awk': ['file.awk', 'file.gawk'], \ 'b': ['file.mch', 'file.ref', 'file.imp'], - \ 'bash': ['.bashrc', '.bash_profile', '.bash-profile', '.bash_logout', '.bash-logout', '.bash_aliases', - \ '.bash-aliases', '.bash_history', '.bash-history', '/tmp/bash-fc-3Ozjlw', '/tmp/bash-fc.3Ozjlw', - \ 'PKGBUILD', 'file.bash', 'file.bats', 'file.cygport'], \ 'basic': ['file.bas', 'file.bi', 'file.bm'], \ 'bass': ['file.bass'], \ 'bc': ['file.bc'], @@ -686,10 +683,11 @@ func s:GetFilenameChecks() abort \ 'services': ['/etc/services', 'any/etc/services'], \ 'setserial': ['/etc/serial.conf', 'any/etc/serial.conf'], \ 'sexplib': ['file.sexp'], - \ 'sh': ['/usr/share/doc/bash-completion/filter.sh', '/etc/udev/cdsymlinks.conf', 'any/etc/udev/cdsymlinks.conf', - \ '.ash_history', 'any/etc/neofetch/config.conf', '.xprofile', 'user-dirs.defaults', 'user-dirs.dirs', - \ 'makepkg.conf', '.makepkg.conf', 'file.mdd', '.env', '.envrc', 'devscripts.conf', '.devscripts', 'file.lo', - \ 'file.la', 'file.lai'], + \ 'sh': ['.bashrc', '.bash_profile', '.bash-profile', '.bash_logout', '.bash-logout', '.bash_aliases', '.bash-aliases', '.bash_history', '.bash-history', + \ '/tmp/bash-fc-3Ozjlw', '/tmp/bash-fc.3Ozjlw', 'PKGBUILD', 'file.bash', '/usr/share/doc/bash-completion/filter.sh', + \ '/etc/udev/cdsymlinks.conf', 'any/etc/udev/cdsymlinks.conf', 'file.bats', '.ash_history', 'any/etc/neofetch/config.conf', '.xprofile', + \ 'user-dirs.defaults', 'user-dirs.dirs', 'makepkg.conf', '.makepkg.conf', 'file.mdd', 'file.cygport', '.env', '.envrc', 'devscripts.conf', + \ '.devscripts', 'file.lo', 'file.la', 'file.lai'], \ 'shaderslang': ['file.slang'], \ 'sieve': ['file.siv', 'file.sieve'], \ 'sil': ['file.sil'], @@ -981,11 +979,11 @@ func s:GetScriptChecks() abort \ 'clojure': [['#!/path/clojure']], \ 'scala': [['#!/path/scala']], \ 'sh': [['#!/path/sh'], + \ ['#!/path/bash'], + \ ['#!/path/bash2'], \ ['#!/path/dash'], \ ['#!/path/ksh'], \ ['#!/path/ksh93']], - \ 'bash': [['#!/path/bash'], - \ ['#!/path/bash2']], \ 'csh': [['#!/path/csh']], \ 'tcsh': [['#!/path/tcsh']], \ 'zsh': [['#!/path/zsh']], -- cgit From a66f6add29fd8b2ee352c6089ceca6ab4f522385 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 22 Jan 2025 10:55:41 +0800 Subject: vim-patch:9.1.1046: fuzzymatching doesn't prefer matching camelcase (#32155) Problem: fuzzymatching doesn't prefer matching camelcase (Tomasz N) Solution: Add extra score when case matches (glepnir) fixes: vim/vim#16434 closes: vim/vim#16439 https://github.com/vim/vim/commit/9dfc7e5e6169594f6f4607ef1ba9dd347a9194d2 Co-authored-by: glepnir --- test/old/testdir/test_matchfuzzy.vim | 60 +++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 24 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_matchfuzzy.vim b/test/old/testdir/test_matchfuzzy.vim index c2dc07ed10..0c982c19f1 100644 --- a/test/old/testdir/test_matchfuzzy.vim +++ b/test/old/testdir/test_matchfuzzy.vim @@ -100,15 +100,15 @@ endfunc " Test for the matchfuzzypos() function func Test_matchfuzzypos() - call assert_equal([['curl', 'world'], [[2,3], [2,3]], [128, 127]], matchfuzzypos(['world', 'curl'], 'rl')) - call assert_equal([['curl', 'world'], [[2,3], [2,3]], [128, 127]], matchfuzzypos(['world', 'one', 'curl'], 'rl')) + call assert_equal([['curl', 'world'], [[2,3], [2,3]], [178, 177]], matchfuzzypos(['world', 'curl'], 'rl')) + call assert_equal([['curl', 'world'], [[2,3], [2,3]], [178, 177]], matchfuzzypos(['world', 'one', 'curl'], 'rl')) call assert_equal([['hello', 'hello world hello world'], - \ [[0, 1, 2, 3, 4], [0, 1, 2, 3, 4]], [375, 257]], + \ [[0, 1, 2, 3, 4], [0, 1, 2, 3, 4]], [500, 382]], \ matchfuzzypos(['hello world hello world', 'hello', 'world'], 'hello')) - call assert_equal([['aaaaaaa'], [[0, 1, 2]], [191]], matchfuzzypos(['aaaaaaa'], 'aaa')) - call assert_equal([['a b'], [[0, 3]], [219]], matchfuzzypos(['a b'], 'a b')) - call assert_equal([['a b'], [[0, 3]], [219]], matchfuzzypos(['a b'], 'a b')) - call assert_equal([['a b'], [[0]], [112]], matchfuzzypos(['a b'], ' a ')) + call assert_equal([['aaaaaaa'], [[0, 1, 2]], [266]], matchfuzzypos(['aaaaaaa'], 'aaa')) + call assert_equal([['a b'], [[0, 3]], [269]], matchfuzzypos(['a b'], 'a b')) + call assert_equal([['a b'], [[0, 3]], [269]], matchfuzzypos(['a b'], 'a b')) + call assert_equal([['a b'], [[0]], [137]], matchfuzzypos(['a b'], ' a ')) call assert_equal([[], [], []], matchfuzzypos(['a b'], ' ')) call assert_equal([[], [], []], matchfuzzypos(['world', 'curl'], 'ab')) let x = matchfuzzypos([repeat('a', 256)], repeat('a', 256)) @@ -117,33 +117,33 @@ func Test_matchfuzzypos() call assert_equal([[], [], []], matchfuzzypos([], 'abc')) " match in a long string - call assert_equal([[repeat('x', 300) .. 'abc'], [[300, 301, 302]], [-135]], + call assert_equal([[repeat('x', 300) .. 'abc'], [[300, 301, 302]], [-60]], \ matchfuzzypos([repeat('x', 300) .. 'abc'], 'abc')) " preference for camel case match - call assert_equal([['xabcxxaBc'], [[6, 7, 8]], [189]], matchfuzzypos(['xabcxxaBc'], 'abc')) + call assert_equal([['xabcxxaBc'], [[6, 7, 8]], [269]], matchfuzzypos(['xabcxxaBc'], 'abc')) " preference for match after a separator (_ or space) - call assert_equal([['xabx_ab'], [[5, 6]], [145]], matchfuzzypos(['xabx_ab'], 'ab')) + call assert_equal([['xabx_ab'], [[5, 6]], [195]], matchfuzzypos(['xabx_ab'], 'ab')) " preference for leading letter match - call assert_equal([['abcxabc'], [[0, 1]], [150]], matchfuzzypos(['abcxabc'], 'ab')) + call assert_equal([['abcxabc'], [[0, 1]], [200]], matchfuzzypos(['abcxabc'], 'ab')) " preference for sequential match - call assert_equal([['aobncedone'], [[7, 8, 9]], [158]], matchfuzzypos(['aobncedone'], 'one')) + call assert_equal([['aobncedone'], [[7, 8, 9]], [233]], matchfuzzypos(['aobncedone'], 'one')) " best recursive match - call assert_equal([['xoone'], [[2, 3, 4]], [168]], matchfuzzypos(['xoone'], 'one')) + call assert_equal([['xoone'], [[2, 3, 4]], [243]], matchfuzzypos(['xoone'], 'one')) " match multiple words (separated by space) - call assert_equal([['foo bar baz'], [[8, 9, 10, 0, 1, 2]], [369]], ['foo bar baz', 'foo', 'foo bar', 'baz bar']->matchfuzzypos('baz foo')) + call assert_equal([['foo bar baz'], [[8, 9, 10, 0, 1, 2]], [519]], ['foo bar baz', 'foo', 'foo bar', 'baz bar']->matchfuzzypos('baz foo')) call assert_equal([[], [], []], ['foo bar baz', 'foo', 'foo bar', 'baz bar']->matchfuzzypos('baz foo', {'matchseq': 1})) - call assert_equal([['foo bar baz'], [[0, 1, 2, 8, 9, 10]], [369]], ['foo bar baz', 'foo', 'foo bar', 'baz bar']->matchfuzzypos('foo baz')) - call assert_equal([['foo bar baz'], [[0, 1, 2, 3, 4, 5, 10]], [326]], ['foo bar baz', 'foo', 'foo bar', 'baz bar']->matchfuzzypos('foo baz', {'matchseq': 1})) + call assert_equal([['foo bar baz'], [[0, 1, 2, 8, 9, 10]], [519]], ['foo bar baz', 'foo', 'foo bar', 'baz bar']->matchfuzzypos('foo baz')) + call assert_equal([['foo bar baz'], [[0, 1, 2, 3, 4, 5, 10]], [476]], ['foo bar baz', 'foo', 'foo bar', 'baz bar']->matchfuzzypos('foo baz', {'matchseq': 1})) call assert_equal([[], [], []], ['foo bar baz', 'foo', 'foo bar', 'baz bar']->matchfuzzypos('one two')) call assert_equal([[], [], []], ['foo bar']->matchfuzzypos(" \t ")) - call assert_equal([['grace'], [[1, 2, 3, 4, 2, 3, 4, 0, 1, 2, 3, 4]], [757]], ['grace']->matchfuzzypos('race ace grace')) + call assert_equal([['grace'], [[1, 2, 3, 4, 2, 3, 4, 0, 1, 2, 3, 4]], [1057]], ['grace']->matchfuzzypos('race ace grace')) let l = [{'id' : 5, 'val' : 'crayon'}, {'id' : 6, 'val' : 'camera'}] - call assert_equal([[{'id' : 6, 'val' : 'camera'}], [[0, 1, 2]], [192]], + call assert_equal([[{'id' : 6, 'val' : 'camera'}], [[0, 1, 2]], [267]], \ matchfuzzypos(l, 'cam', {'text_cb' : {v -> v.val}})) - call assert_equal([[{'id' : 6, 'val' : 'camera'}], [[0, 1, 2]], [192]], + call assert_equal([[{'id' : 6, 'val' : 'camera'}], [[0, 1, 2]], [267]], \ matchfuzzypos(l, 'cam', {'key' : 'val'})) call assert_equal([[], [], []], matchfuzzypos(l, 'day', {'text_cb' : {v -> v.val}})) call assert_equal([[], [], []], matchfuzzypos(l, 'day', {'key' : 'val'})) @@ -161,6 +161,18 @@ func Test_matchfuzzypos() " Nvim doesn't have null functions " call assert_fails("let x = matchfuzzypos(l, 'foo', {'text_cb' : test_null_function()})", 'E475:') + " case match + call assert_equal([['Match', 'match'], [[0, 1], [0, 1]], [202, 177]], matchfuzzypos(['match', 'Match'], 'Ma')) + call assert_equal([['match', 'Match'], [[0, 1], [0, 1]], [202, 177]], matchfuzzypos(['Match', 'match'], 'ma')) + " CamelCase has high weight even case match + call assert_equal(['MyTestCase', 'mytestcase'], matchfuzzy(['mytestcase', 'MyTestCase'], 'mtc')) + call assert_equal(['MyTestCase', 'mytestcase'], matchfuzzy(['MyTestCase', 'mytestcase'], 'mtc')) + call assert_equal(['MyTest', 'Mytest', 'mytest', ],matchfuzzy(['Mytest', 'mytest', 'MyTest'], 'MyT')) + call assert_equal(['CamelCaseMatchIngAlg', 'camelCaseMatchingAlg', 'camelcasematchingalg'], + \ matchfuzzy(['CamelCaseMatchIngAlg', 'camelcasematchingalg', 'camelCaseMatchingAlg'], 'CamelCase')) + call assert_equal(['CamelCaseMatchIngAlg', 'camelCaseMatchingAlg', 'camelcasematchingalg'], + \ matchfuzzy(['CamelCaseMatchIngAlg', 'camelcasematchingalg', 'camelCaseMatchingAlg'], 'CamelcaseM')) + let l = [{'id' : 5, 'name' : 'foo'}, {'id' : 6, 'name' : []}, {'id' : 7}] call assert_fails("let x = matchfuzzypos(l, 'foo', {'key' : 'name'})", 'E730:') endfunc @@ -211,12 +223,12 @@ func Test_matchfuzzypos_mbyte() call assert_equal([['ンヹㄇヺヴ'], [[1, 3]], [88]], matchfuzzypos(['ンヹㄇヺヴ'], 'ヹヺ')) " reverse the order of characters call assert_equal([[], [], []], matchfuzzypos(['ンヹㄇヺヴ'], 'ヺヹ')) - call assert_equal([['αβΩxxx', 'xαxβxΩx'], [[0, 1, 2], [1, 3, 5]], [222, 113]], + call assert_equal([['αβΩxxx', 'xαxβxΩx'], [[0, 1, 2], [1, 3, 5]], [252, 143]], \ matchfuzzypos(['αβΩxxx', 'xαxβxΩx'], 'αβΩ')) call assert_equal([['ππbbππ', 'πππbbbπππ', 'ππππbbbbππππ', 'πbπ'], - \ [[0, 1], [0, 1], [0, 1], [0, 2]], [151, 148, 145, 110]], + \ [[0, 1], [0, 1], [0, 1], [0, 2]], [176, 173, 170, 135]], \ matchfuzzypos(['πbπ', 'ππbbππ', 'πππbbbπππ', 'ππππbbbbππππ'], 'ππ')) - call assert_equal([['ααααααα'], [[0, 1, 2]], [191]], + call assert_equal([['ααααααα'], [[0, 1, 2]], [216]], \ matchfuzzypos(['ααααααα'], 'ααα')) call assert_equal([[], [], []], matchfuzzypos(['ンヹㄇ', 'ŗŝţ'], 'fffifl')) @@ -229,10 +241,10 @@ func Test_matchfuzzypos_mbyte() call assert_equal([[], [], []], ['세 마리의 작은 돼지', '마리의', '마리의 작은', '작은 돼지']->matchfuzzypos('파란 하늘')) " match in a long string - call assert_equal([[repeat('ぶ', 300) .. 'ẼẼẼ'], [[300, 301, 302]], [-135]], + call assert_equal([[repeat('ぶ', 300) .. 'ẼẼẼ'], [[300, 301, 302]], [-110]], \ matchfuzzypos([repeat('ぶ', 300) .. 'ẼẼẼ'], 'ẼẼẼ')) " preference for camel case match - call assert_equal([['xѳѵҁxxѳѴҁ'], [[6, 7, 8]], [189]], matchfuzzypos(['xѳѵҁxxѳѴҁ'], 'ѳѵҁ')) + call assert_equal([['xѳѵҁxxѳѴҁ'], [[6, 7, 8]], [219]], matchfuzzypos(['xѳѵҁxxѳѴҁ'], 'ѳѵҁ')) " preference for match after a separator (_ or space) call assert_equal([['xちだx_ちだ'], [[5, 6]], [145]], matchfuzzypos(['xちだx_ちだ'], 'ちだ')) " preference for leading letter match -- cgit From a9c12d4c298813ed3aee36b2b4d5d0912c7201ea Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 23 Jan 2025 08:12:10 +0800 Subject: vim-patch:9.1.1048: crash after scrolling and pasting in silent Ex mode (#32168) Problem: Crash after scrolling and pasting in silent Ex mode. (fizz-is-on-the-way) Solution: Don't move cursor to line 0 when scrolling. (zeertzjq) closes: vim/vim#16506 https://github.com/vim/vim/commit/df098fedbc2c481e91ea7e6207dab90359a92cc3 --- test/old/testdir/test_normal.vim | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_normal.vim b/test/old/testdir/test_normal.vim index c89e73bada..1d9609cbe1 100644 --- a/test/old/testdir/test_normal.vim +++ b/test/old/testdir/test_normal.vim @@ -1338,11 +1338,27 @@ func Test_scroll_in_ex_mode() call writefile(['done'], 'Xdone') qa! END - call writefile(lines, 'Xscript') + call writefile(lines, 'Xscript', 'D') call assert_equal(1, RunVim([], [], '--clean -X -Z -e -s -S Xscript')) call assert_equal(['done'], readfile('Xdone')) - call delete('Xscript') + call delete('Xdone') +endfunc + +func Test_scroll_and_paste_in_ex_mode() + throw 'Skipped: does not work when Nvim is run from :!' + " This used to crash because of moving cursor to line 0. + let lines =<< trim END + v/foo/vi|YY9PYQ + v/bar/vi|YY9PYQ + v/bar/exe line('.') == 1 ? "vi|Y\9PYQ" : "vi|YQ" + call writefile(['done'], 'Xdone') + qa! + END + call writefile(lines, 'Xscript', 'D') + call assert_equal(1, RunVim([], [], '-u NONE -i NONE -n -X -Z -e -s -S Xscript')) + call assert_equal(['done'], readfile('Xdone')) + call delete('Xdone') endfunc @@ -4303,4 +4319,5 @@ func Test_normal_go() bwipe! endfunc + " vim: shiftwidth=2 sts=2 expandtab nofoldenable -- cgit From 28998e1f8a9cdca27ada7030757b7a47e99ce5b6 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 23 Jan 2025 16:33:41 +0800 Subject: vim-patch:9.1.1045: filetype: N-Tripels and TriG files are not recognized (#32170) Problem: filetype: N-Tripels and TriG files are not recognized Solution: detect '*.nt' files as ntriples filetype and '*.trig' files as trig filetype (Gordian Dziwis) closes: vim/vim#16493 https://github.com/vim/vim/commit/c04334c33f543a6b84a4442cf235d84f5eaef6bb Co-authored-by: Gordian Dziwis --- test/old/testdir/test_filetype.vim | 2 ++ 1 file changed, 2 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 020603015f..e39b93eea4 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -549,6 +549,7 @@ func s:GetFilenameChecks() abort \ 'nqc': ['file.nqc'], \ 'nroff': ['file.tr', 'file.nr', 'file.roff', 'file.tmac', 'file.mom', 'tmac.file'], \ 'nsis': ['file.nsi', 'file.nsh'], + \ 'ntriples': ['file.nt'], \ 'nu': ['file.nu'], \ 'obj': ['file.obj'], \ 'objdump': ['file.objdump', 'file.cppobjdump'], @@ -814,6 +815,7 @@ func s:GetFilenameChecks() abort \ 'tpp': ['file.tpp'], \ 'trace32': ['file.cmm', 'file.t32'], \ 'treetop': ['file.treetop'], + \ 'trig': ['file.trig'], \ 'trustees': ['trustees.conf'], \ 'tsalt': ['file.slt'], \ 'tsscl': ['file.tsscl'], -- cgit From 8634bd46b26f28fa26950128b0cc585560bd6a9a Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 20 Jan 2025 22:45:47 +0100 Subject: vim-patch:9.1.1042: filetype: just files are not recognized Problem: filetype: just files are not recognized Solution: adjust filetype detection pattern, detect just shebang line, include just ftplugin, indent and syntax plugin (Peter Benjamin) closes: vim/vim#16466 https://github.com/vim/vim/commit/72755b3c8e91ec90447969b736f080e0de36003d Co-authored-by: Peter Benjamin --- test/old/testdir/test_filetype.vim | 1 + 1 file changed, 1 insertion(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index e39b93eea4..9398cea786 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -997,6 +997,7 @@ func s:GetScriptChecks() abort \ 'expect': [['#!/path/expect']], \ 'execline': [['#!/sbin/execlineb -S0'], ['#!/usr/bin/execlineb']], \ 'gnuplot': [['#!/path/gnuplot']], + \ 'just': [['#!/path/just']], \ 'make': [['#!/path/make']], \ 'nix': [['#!/path/nix-shell']], \ 'pike': [['#!/path/pike'], -- cgit From 63aa167f944b147b9d4b8c417a37f4beb212d984 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 24 Jan 2025 06:44:23 +0800 Subject: vim-patch:9.1.1049: insert-completed items are always sorted Problem: insert-completed items are always sorted, although the LSP spec[1] standard defines sortText in the returned completionitem list. This means that the server has sorted the results. When fuzzy is enabled, this will break the server's sorting results. Solution: disable sorting of candidates when "nosort" is set in 'completeopt' [1] https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#completionItem closes: vim/vim#16501 https://github.com/vim/vim/commit/f400a0cc41113eb75516bdd7f38aeaa15208ba2c Co-authored-by: glepnir --- test/old/testdir/test_ins_complete.vim | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_ins_complete.vim b/test/old/testdir/test_ins_complete.vim index f1ff45ff90..988b7995ed 100644 --- a/test/old/testdir/test_ins_complete.vim +++ b/test/old/testdir/test_ins_complete.vim @@ -2778,7 +2778,7 @@ func Test_complete_fuzzy_match() if a:findstart return col(".") endif - return [#{word: "foo"}, #{word: "foobar"}, #{word: "fooBaz"}, #{word: "foobala"}] + return [#{word: "foo"}, #{word: "foobar"}, #{word: "fooBaz"}, #{word: "foobala"}, #{word: "你好吗"}, #{word: "我好"}] endfunc new @@ -2837,6 +2837,21 @@ func Test_complete_fuzzy_match() call feedkeys("STe\\x\\0", 'tx!') call assert_equal('Tex', getline('.')) + " test case for nosort option + set cot=menuone,menu,noinsert,fuzzy,nosort + " fooBaz" should have a higher score when the leader is "fb". + " With `nosort`, "foobar" should still be shown first in the popup menu. + call feedkeys("S\\fb", 'tx') + call assert_equal('foobar', g:word) + call feedkeys("S\\好", 'tx') + call assert_equal("你好吗", g:word) + + set cot+=noselect + call feedkeys("S\\好", 'tx') + call assert_equal(v:null, g:word) + call feedkeys("S\\好\", 'tx') + call assert_equal('你好吗', g:word) + " clean up set omnifunc= bw! -- cgit From 689c23b2ac5c8cb5953e45f9f0cf6c369e8d88df Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 25 Jan 2025 22:34:54 +0800 Subject: vim-patch:9.1.1053: "nosort" enables fuzzy filtering even if "fuzzy" isn't in 'completeopt' Problem: "nosort" enables fuzzy filtering even if "fuzzy" isn't in 'completeopt' (after v9.1.1049) Solution: Only enable fuzzy filtering when "fuzzy" is in 'completeopt'. (zeertzjq) closes: vim/vim#16510 https://github.com/vim/vim/commit/d65aa1bbdb808ef8fecde6df240c48cc39a52a8e --- test/old/testdir/test_ins_complete.vim | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_ins_complete.vim b/test/old/testdir/test_ins_complete.vim index 988b7995ed..1c63e8f4cc 100644 --- a/test/old/testdir/test_ins_complete.vim +++ b/test/old/testdir/test_ins_complete.vim @@ -2839,8 +2839,8 @@ func Test_complete_fuzzy_match() " test case for nosort option set cot=menuone,menu,noinsert,fuzzy,nosort - " fooBaz" should have a higher score when the leader is "fb". - " With `nosort`, "foobar" should still be shown first in the popup menu. + " "fooBaz" should have a higher score when the leader is "fb". + " With "nosort", "foobar" should still be shown first in the popup menu. call feedkeys("S\\fb", 'tx') call assert_equal('foobar', g:word) call feedkeys("S\\好", 'tx') @@ -2852,6 +2852,11 @@ func Test_complete_fuzzy_match() call feedkeys("S\\好\", 'tx') call assert_equal('你好吗', g:word) + " "nosort" shouldn't enable fuzzy filtering when "fuzzy" isn't present. + set cot=menuone,noinsert,nosort + call feedkeys("S\\fooB\", 'tx') + call assert_equal('fooBaz', getline('.')) + " clean up set omnifunc= bw! -- cgit From d4a65dad23b910ad0e5f44cc1720e8bd82bd749b Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 25 Jan 2025 23:03:43 +0800 Subject: vim-patch:9.1.1052: tests: off-by-one error in CheckCWD in test_debugger.vim (#32202) Problem: tests: off-by-one error in CheckCWD in test_debugger.vim Solution: Fix off-by-one in CheckCWD leading to local tests failure (Yee Cheng Chin) Vim's test_debugger's Test_debug_backtrace_level test will fail if you happen to run it in a Vim repository with full path of directory being exactly 29 characters (e.g. `/Users/bob/developing/src/vim`). The test does term dump comparison and the printout will overflow if the CWD is too long. It does have a function to skip to test if it detects that but it's off by one leading to this one situation where it will fail. The reason why the logic didn't account for this is that Vim's message printing will overflow the text if it prints a message at exactly the width of the terminal. This could be considered a bug / quirk but that will be another issue. closes: vim/vim#16517 https://github.com/vim/vim/commit/3acfbb4b548f4b1659ff1368a1b626cdd263acbe Co-authored-by: Yee Cheng Chin --- test/old/testdir/test_debugger.vim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_debugger.vim b/test/old/testdir/test_debugger.vim index 3a469e8a17..5820b58247 100644 --- a/test/old/testdir/test_debugger.vim +++ b/test/old/testdir/test_debugger.vim @@ -6,10 +6,11 @@ source check.vim func CheckCWD() " Check that the longer lines don't wrap due to the length of the script name - " in cwd + " in cwd. Need to subtract by 1 since Vim will still wrap the message if it + " just fits. let script_len = len( getcwd() .. '/Xtest1.vim' ) let longest_line = len( 'Breakpoint in "" line 1' ) - if script_len > ( 75 - longest_line ) + if script_len > ( 75 - longest_line - 1 ) throw 'Skipped: Your CWD has too many characters' endif endfunc -- cgit From efa664c7ed21b63f2cf0a8caa53161fe7e32b2bb Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 30 Jan 2025 14:39:13 +0800 Subject: vim-patch:9.1.1056: Vim doesn't highlight to be inserted text when completing (#32251) Problem: Vim doesn't highlight to be inserted text when completing Solution: Add support for the "preinsert" 'completeopt' value (glepnir) Support automatically inserting the currently selected candidate word that does not belong to the latter part of the leader. fixes: vim/vim#3433 closes: vim/vim#16403 https://github.com/vim/vim/commit/edd4ac3e895ce16034c7e098f1d68e0155d97886 Co-authored-by: glepnir --- test/old/testdir/gen_opt_test.vim | 4 +- test/old/testdir/test_ins_complete.vim | 117 +++++++++++++++++++++++++++++++++ 2 files changed, 119 insertions(+), 2 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/gen_opt_test.vim b/test/old/testdir/gen_opt_test.vim index bcb0f3d4c4..f9fcc4ae1b 100644 --- a/test/old/testdir/gen_opt_test.vim +++ b/test/old/testdir/gen_opt_test.vim @@ -87,7 +87,7 @@ let test_values = { \ ['xxx', 'help,nofile']], \ 'clipboard': [['', 'unnamed'], ['xxx', '\ze*', 'exclude:\\%(']], \ 'completeopt': [['', 'menu', 'menuone', 'longest', 'preview', 'popup', - \ 'noinsert', 'noselect', 'fuzzy', 'menu,longest'], + \ 'noinsert', 'noselect', 'fuzzy', 'preinsert', 'menu,longest'], \ ['xxx', 'menu,,,longest,']], \ 'encoding': [['utf8'], []], \ 'foldcolumn': [[0, 1, 4, 'auto', 'auto:1', 'auto:9'], [-1, 13, 999]], @@ -186,7 +186,7 @@ let test_values = { \ ['xxx']], \ 'concealcursor': [['', 'n', 'v', 'i', 'c', 'nvic'], ['xxx']], "\ 'completeopt': [['', 'menu', 'menuone', 'longest', 'preview', 'popup', - "\ " 'popuphidden', 'noinsert', 'noselect', 'fuzzy', 'menu,longest'], + "\ " 'popuphidden', 'noinsert', 'noselect', 'fuzzy', 'preinsert', 'menu,longest'], "\ " ['xxx', 'menu,,,longest,']], \ 'completeitemalign': [['abbr,kind,menu', 'menu,abbr,kind'], \ ['', 'xxx', 'abbr', 'abbr,menu', 'abbr,menu,kind,abbr', diff --git a/test/old/testdir/test_ins_complete.vim b/test/old/testdir/test_ins_complete.vim index 1c63e8f4cc..969d5012f4 100644 --- a/test/old/testdir/test_ins_complete.vim +++ b/test/old/testdir/test_ins_complete.vim @@ -2964,4 +2964,121 @@ func Test_complete_info_completed() set cot& endfunc +function Test_completeopt_preinsert() + func Omni_test(findstart, base) + if a:findstart + return col(".") + endif + return [#{word: "fobar"}, #{word: "foobar"}, #{word: "你的"}, #{word: "你好世界"}] + endfunc + set omnifunc=Omni_test + set completeopt=menu,menuone,preinsert + + new + call feedkeys("S\\f", 'tx') + call assert_equal("fobar", getline('.')) + call feedkeys("\\", 'tx') + + call feedkeys("S\\foo", 'tx') + call assert_equal("foobar", getline('.')) + call feedkeys("\\", 'tx') + + call feedkeys("S\\foo\\\", 'tx') + call assert_equal("", getline('.')) + call feedkeys("\\", 'tx') + + " delete a character and input new leader + call feedkeys("S\\foo\b", 'tx') + call assert_equal("fobar", getline('.')) + call feedkeys("\\", 'tx') + + " delete preinsert when prepare completion + call feedkeys("S\\f\", 'tx') + call assert_equal("f ", getline('.')) + call feedkeys("\\", 'tx') + + call feedkeys("S\\你", 'tx') + call assert_equal("你的", getline('.')) + call feedkeys("\\", 'tx') + + call feedkeys("S\\你好", 'tx') + call assert_equal("你好世界", getline('.')) + call feedkeys("\\", 'tx') + + call feedkeys("Shello wo\\\\\f", 'tx') + call assert_equal("hello fobar wo", getline('.')) + call feedkeys("\\", 'tx') + + call feedkeys("Shello wo\\\\\f\", 'tx') + call assert_equal("hello wo", getline('.')) + call feedkeys("\\", 'tx') + + call feedkeys("Shello wo\\\\\foo", 'tx') + call assert_equal("hello foobar wo", getline('.')) + call feedkeys("\\", 'tx') + + call feedkeys("Shello wo\\\\\foo\b", 'tx') + call assert_equal("hello fobar wo", getline('.')) + call feedkeys("\\", 'tx') + + " confrim + call feedkeys("S\\f\", 'tx') + call assert_equal("fobar", getline('.')) + call assert_equal(5, col('.')) + + " cancel + call feedkeys("S\\fo\", 'tx') + call assert_equal("fo", getline('.')) + call assert_equal(2, col('.')) + + call feedkeys("S hello hero\h\\", 'tx') + call assert_equal("hello", getline('.')) + call assert_equal(1, col('.')) + + call feedkeys("Sh\\\", 'tx') + call assert_equal("hello", getline('.')) + call assert_equal(5, col('.')) + + " delete preinsert part + call feedkeys("S\\fo ", 'tx') + call assert_equal("fo ", getline('.')) + call assert_equal(3, col('.')) + + " whole line + call feedkeys("Shello hero\\\", 'tx') + call assert_equal("hello hero", getline('.')) + call assert_equal(1, col('.')) + + call feedkeys("Shello hero\he\\", 'tx') + call assert_equal("hello hero", getline('.')) + call assert_equal(2, col('.')) + + " can not work with fuzzy + set cot+=fuzzy + call feedkeys("S\\", 'tx') + call assert_equal("fobar", getline('.')) + call assert_equal(5, col('.')) + + " test for fuzzy and noinsert + set cot+=noinsert + call feedkeys("S\\fb", 'tx') + call assert_equal("fb", getline('.')) + call assert_equal(2, col('.')) + + call feedkeys("S\\你", 'tx') + call assert_equal("你", getline('.')) + call assert_equal(1, col('.')) + + call feedkeys("S\\fb\", 'tx') + call assert_equal("fobar", getline('.')) + call assert_equal(5, col('.')) + + bw! + bw! + set cot& + set omnifunc& + delfunc Omni_test + autocmd! CompleteChanged +endfunc + " vim: shiftwidth=2 sts=2 expandtab nofoldenable -- cgit From b3b255396d9fad56c074099b0cdcdbbecab79d4a Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 30 Jan 2025 18:59:01 +0800 Subject: vim-patch:9.1.1057: Superfluous cleanup steps in test_ins_complete.vim (#32257) Problem: Superfluous cleanup steps in test_ins_complete.vim. Solution: Remove unnecessary :bw! and :autocmd! commands. Also remove unnecessary STRLEN() in insexpand.c (zeertzjq) closes: vim/vim#16542 https://github.com/vim/vim/commit/8297e2cee337c626c6691e81b25e1f1897c71b86 --- test/old/testdir/test_ins_complete.vim | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_ins_complete.vim b/test/old/testdir/test_ins_complete.vim index 969d5012f4..64a0ee3124 100644 --- a/test/old/testdir/test_ins_complete.vim +++ b/test/old/testdir/test_ins_complete.vim @@ -2927,7 +2927,6 @@ func Test_complete_info_matches() \], g:compl_info['items']) call assert_false(has_key(g:compl_info, 'matches')) - bw! bw! unlet g:what delfunc ShownInfo @@ -2958,7 +2957,6 @@ func Test_complete_info_completed() call feedkeys("Go\\\\dd", 'tx') call assert_equal({}, g:compl_info) - bw! bw! delfunc ShownInfo set cot& @@ -3021,7 +3019,7 @@ function Test_completeopt_preinsert() call assert_equal("hello fobar wo", getline('.')) call feedkeys("\\", 'tx') - " confrim + " confirm call feedkeys("S\\f\", 'tx') call assert_equal("fobar", getline('.')) call assert_equal(5, col('.')) @@ -3073,12 +3071,10 @@ function Test_completeopt_preinsert() call assert_equal("fobar", getline('.')) call assert_equal(5, col('.')) - bw! bw! set cot& set omnifunc& delfunc Omni_test - autocmd! CompleteChanged endfunc " vim: shiftwidth=2 sts=2 expandtab nofoldenable -- cgit From 9cc060218b66c600f7f50ecbec5ba6f1b3a9da82 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 1 Feb 2025 07:49:05 +0800 Subject: vim-patch:9.1.1059: completion: input text deleted with preinsert when adding leader (#32276) Problem: completion: input text deleted with preinsert when adding leader Solution: remove compl_length and check the ptr for being equal to pattern when preinsert is active (glepnir) closes: vim/vim#16545 https://github.com/vim/vim/commit/bfb4eea7869b0118221cd145a774d74191ce6130 Co-authored-by: glepnir --- test/old/testdir/test_ins_complete.vim | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_ins_complete.vim b/test/old/testdir/test_ins_complete.vim index 64a0ee3124..f276d1e719 100644 --- a/test/old/testdir/test_ins_complete.vim +++ b/test/old/testdir/test_ins_complete.vim @@ -3051,6 +3051,10 @@ function Test_completeopt_preinsert() call assert_equal("hello hero", getline('.')) call assert_equal(2, col('.')) + call feedkeys("Shello hero\h\\er", 'tx') + call assert_equal("hero", getline('.')) + call assert_equal(3, col('.')) + " can not work with fuzzy set cot+=fuzzy call feedkeys("S\\", 'tx') -- cgit From 0985e784d8dce58748343207e176bf61303b7d68 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 2 Feb 2025 07:00:45 +0800 Subject: vim-patch:9.1.1065: no digraph for "Approaches the limit" (#32289) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: no digraph for "Approaches the limit" Solution: Add the digraph using .= (Hans Ginzel) Add digraph Approaches the Limit ≐ U+2250 https://www.fileformat.info/info/unicode/char/2250/index.htm closes: vim/vim#16508 https://github.com/vim/vim/commit/3a621188ee52badfe7aa783db12588a78dcd8ed6 Co-authored-by: Hans Ginzel --- test/old/testdir/test_digraph.vim | 3 +++ 1 file changed, 3 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_digraph.vim b/test/old/testdir/test_digraph.vim index 9c32b85f61..0a71cbba99 100644 --- a/test/old/testdir/test_digraph.vim +++ b/test/old/testdir/test_digraph.vim @@ -40,6 +40,9 @@ func Test_digraphs() " Quadruple prime call Put_Dig("'4") call assert_equal("⁗", getline('.')) + " APPROACHES THE LIMIT + call Put_Dig(".=") + call assert_equal("≐", getline('.')) " Not a digraph call Put_Dig("a\") call Put_Dig("\a") -- cgit From 4bdabf9b1ae52134f50a0b75dc2c73a40c0c252f Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 2 Feb 2025 17:32:51 +0800 Subject: vim-patch:9.1.1068: getchar() can't distinguish between C-I and Tab (#32295) Problem: getchar() can't distinguish between C-I and Tab. Solution: Add {opts} to pass extra flags to getchar() and getcharstr(), with "number" and "simplify" keys. related: vim/vim#10603 closes: vim/vim#16554 https://github.com/vim/vim/commit/e0a2ab397fd13a71efec85b017d5d4d62baf7f63 Cherry-pick tv_dict_has_key() from patch 8.2.4683. --- test/old/testdir/test_functions.vim | 71 +++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_functions.vim b/test/old/testdir/test_functions.vim index 01e6001dcc..f57743900a 100644 --- a/test/old/testdir/test_functions.vim +++ b/test/old/testdir/test_functions.vim @@ -2390,6 +2390,77 @@ func Test_getchar() call assert_equal("\", getchar(0)) call assert_equal(0, getchar(0)) + call feedkeys("\", '') + call assert_equal(char2nr("\"), getchar()) + call feedkeys("\", '') + call assert_equal(char2nr("\"), getchar(-1)) + call feedkeys("\", '') + call assert_equal(char2nr("\"), getchar(-1, {})) + call feedkeys("\", '') + call assert_equal(char2nr("\"), getchar(-1, #{number: v:true})) + call assert_equal(0, getchar(0)) + call assert_equal(0, getchar(1)) + call assert_equal(0, getchar(0, #{number: v:true})) + call assert_equal(0, getchar(1, #{number: v:true})) + + call feedkeys("\", '') + call assert_equal("\", getcharstr()) + call feedkeys("\", '') + call assert_equal("\", getcharstr(-1)) + call feedkeys("\", '') + call assert_equal("\", getcharstr(-1, {})) + call feedkeys("\", '') + call assert_equal("\", getchar(-1, #{number: v:false})) + call assert_equal('', getcharstr(0)) + call assert_equal('', getcharstr(1)) + call assert_equal('', getchar(0, #{number: v:false})) + call assert_equal('', getchar(1, #{number: v:false})) + + " Nvim: is never simplified + " for key in ["C-I", "C-X", "M-x"] + for key in ["C-I", "C-X"] + let lines =<< eval trim END + call feedkeys("\<*{key}>", '') + call assert_equal(char2nr("\<{key}>"), getchar()) + call feedkeys("\<*{key}>", '') + call assert_equal(char2nr("\<{key}>"), getchar(-1)) + call feedkeys("\<*{key}>", '') + call assert_equal(char2nr("\<{key}>"), getchar(-1, {{}})) + call feedkeys("\<*{key}>", '') + call assert_equal(char2nr("\<{key}>"), getchar(-1, {{'number': 1}})) + call feedkeys("\<*{key}>", '') + call assert_equal(char2nr("\<{key}>"), getchar(-1, {{'simplify': 1}})) + call feedkeys("\<*{key}>", '') + call assert_equal("\<*{key}>", getchar(-1, {{'simplify': v:false}})) + call assert_equal(0, getchar(0)) + call assert_equal(0, getchar(1)) + END + call CheckLegacyAndVim9Success(lines) + + let lines =<< eval trim END + call feedkeys("\<*{key}>", '') + call assert_equal("\<{key}>", getcharstr()) + call feedkeys("\<*{key}>", '') + call assert_equal("\<{key}>", getcharstr(-1)) + call feedkeys("\<*{key}>", '') + call assert_equal("\<{key}>", getcharstr(-1, {{}})) + call feedkeys("\<*{key}>", '') + call assert_equal("\<{key}>", getchar(-1, {{'number': 0}})) + call feedkeys("\<*{key}>", '') + call assert_equal("\<{key}>", getcharstr(-1, {{'simplify': 1}})) + call feedkeys("\<*{key}>", '') + call assert_equal("\<*{key}>", getcharstr(-1, {{'simplify': v:false}})) + call assert_equal('', getcharstr(0)) + call assert_equal('', getcharstr(1)) + END + call CheckLegacyAndVim9Success(lines) + endfor + + call assert_fails('call getchar(1, 1)', 'E1206:') + call assert_fails('call getcharstr(1, 1)', 'E1206:') + call assert_fails('call getcharstr(1, #{number: v:true})', 'E475:') + call assert_fails('call getcharstr(1, #{number: v:false})', 'E475:') + call setline(1, 'xxxx') call Ntest_setmouse(1, 3) let v:mouse_win = 9 -- cgit From 3e882bf81c5f0761b98d29a6c986026d5962e5f7 Mon Sep 17 00:00:00 2001 From: glepnir Date: Sun, 2 Feb 2025 18:02:25 +0800 Subject: vim-patch:9.1.1069: preinsert text completions not deleted with / (#32296) Problem: preinsert text completions not deleted with / (ddad431, after v9.1.1059) Solution: handle or specifically and clear the completion (glepnir) fixes: vim/vim#16557 closes: vim/vim#16565 https://github.com/vim/vim/commit/001c26cd6194fba2bfccb06dec30fdc9e1410e62 --- test/old/testdir/test_ins_complete.vim | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_ins_complete.vim b/test/old/testdir/test_ins_complete.vim index f276d1e719..2fb1715634 100644 --- a/test/old/testdir/test_ins_complete.vim +++ b/test/old/testdir/test_ins_complete.vim @@ -3042,6 +3042,14 @@ function Test_completeopt_preinsert() call assert_equal("fo ", getline('.')) call assert_equal(3, col('.')) + call feedkeys("She\\\", 'tx') + call assert_equal("", getline('.')) + call assert_equal(1, col('.')) + + call feedkeys("She\\\", 'tx') + call assert_equal("", getline('.')) + call assert_equal(1, col('.')) + " whole line call feedkeys("Shello hero\\\", 'tx') call assert_equal("hello hero", getline('.')) -- cgit From af069c5c05ad99623345071007ad23da51973601 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 3 Feb 2025 08:09:03 +0800 Subject: vim-patch:9.1.1070: Cannot control cursor positioning of getchar() (#32303) Problem: Cannot control cursor positioning of getchar(). Solution: Add "cursor" flag to {opts}, with possible values "hide", "keep" and "msg". related: vim/vim#10603 closes: vim/vim#16569 https://github.com/vim/vim/commit/edf0f7db28f87611368e158210e58ed30f673098 --- test/old/testdir/test_functions.vim | 63 +++++++++++++++++++++++++++++++++++-- 1 file changed, 60 insertions(+), 3 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_functions.vim b/test/old/testdir/test_functions.vim index f57743900a..738a417b86 100644 --- a/test/old/testdir/test_functions.vim +++ b/test/old/testdir/test_functions.vim @@ -2458,6 +2458,14 @@ func Test_getchar() call assert_fails('call getchar(1, 1)', 'E1206:') call assert_fails('call getcharstr(1, 1)', 'E1206:') + call assert_fails('call getchar(1, #{cursor: "foo"})', 'E475:') + call assert_fails('call getcharstr(1, #{cursor: "foo"})', 'E475:') + call assert_fails('call getchar(1, #{cursor: 0z})', 'E976:') + call assert_fails('call getcharstr(1, #{cursor: 0z})', 'E976:') + call assert_fails('call getchar(1, #{simplify: 0z})', 'E974:') + call assert_fails('call getcharstr(1, #{simplify: 0z})', 'E974:') + call assert_fails('call getchar(1, #{number: []})', 'E745:') + call assert_fails('call getchar(1, #{number: {}})', 'E728:') call assert_fails('call getcharstr(1, #{number: v:true})', 'E475:') call assert_fails('call getcharstr(1, #{number: v:false})', 'E475:') @@ -2476,10 +2484,59 @@ func Test_getchar() enew! endfunc +func Test_getchar_cursor_position() + CheckRunVimInTerminal + + let lines =<< trim END + call setline(1, ['foobar', 'foobar', 'foobar']) + call cursor(3, 6) + nnoremap echo 1234call getchar() + nnoremap call getchar() + nnoremap call getchar(-1, {}) + nnoremap call getchar(-1, #{cursor: 'msg'}) + nnoremap call getchar(-1, #{cursor: 'keep'}) + nnoremap call getchar(-1, #{cursor: 'hide'}) + END + call writefile(lines, 'XgetcharCursorPos', 'D') + let buf = RunVimInTerminal('-S XgetcharCursorPos', {'rows': 6}) + call WaitForAssert({-> assert_equal([3, 6], term_getcursor(buf)[0:1])}) + + call term_sendkeys(buf, "\") + call WaitForAssert({-> assert_equal([6, 5], term_getcursor(buf)[0:1])}) + call assert_true(term_getcursor(buf)[2].visible) + call term_sendkeys(buf, 'a') + call WaitForAssert({-> assert_equal([3, 6], term_getcursor(buf)[0:1])}) + call assert_true(term_getcursor(buf)[2].visible) + + for key in ["\", "\", "\"] + call term_sendkeys(buf, key) + call WaitForAssert({-> assert_equal([6, 1], term_getcursor(buf)[0:1])}) + call assert_true(term_getcursor(buf)[2].visible) + call term_sendkeys(buf, 'a') + call WaitForAssert({-> assert_equal([3, 6], term_getcursor(buf)[0:1])}) + call assert_true(term_getcursor(buf)[2].visible) + endfor + + call term_sendkeys(buf, "\") + call TermWait(buf, 50) + call assert_equal([3, 6], term_getcursor(buf)[0:1]) + call assert_true(term_getcursor(buf)[2].visible) + call term_sendkeys(buf, 'a') + call TermWait(buf, 50) + call assert_equal([3, 6], term_getcursor(buf)[0:1]) + call assert_true(term_getcursor(buf)[2].visible) + + call term_sendkeys(buf, "\") + call WaitForAssert({-> assert_false(term_getcursor(buf)[2].visible)}) + call term_sendkeys(buf, 'a') + call WaitForAssert({-> assert_true(term_getcursor(buf)[2].visible)}) + call assert_equal([3, 6], term_getcursor(buf)[0:1]) + + call StopVimInTerminal(buf) +endfunc + func Test_libcall_libcallnr() - if !has('libcall') - return - endif + CheckFeature libcall if has('win32') let libc = 'msvcrt.dll' -- cgit From 82ac8294c22a15899548a1cb408ca114a598f434 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 2 Feb 2025 16:00:04 +0800 Subject: vim-patch:9.1.1066: heap-use-after-free and stack-use-after-scope with :14verbose Problem: heap-use-after-free and stack-use-after-scope with :14verbose when using :return and :try (after 9.1.1063). Solution: Move back the vim_free(tofree) and the scope of numbuf[]. (zeertzjq) closes: vim/vim#16563 https://github.com/vim/vim/commit/2101230f4013860dbafcb0cab3f4e6bc92fb6f35 --- test/old/testdir/test_user_func.vim | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_user_func.vim b/test/old/testdir/test_user_func.vim index b509b03778..da6a6d8dc4 100644 --- a/test/old/testdir/test_user_func.vim +++ b/test/old/testdir/test_user_func.vim @@ -910,4 +910,36 @@ func Test_func_curly_brace_invalid_name() delfunc Fail endfunc +func Test_func_return_in_try_verbose() + func TryReturnList() + try + return [1, 2, 3] + endtry + endfunc + func TryReturnNumber() + try + return 123 + endtry + endfunc + func TryReturnOverlongString() + try + return repeat('a', 9999) + endtry + endfunc + + " This should not cause heap-use-after-free + call assert_match('\n:return \[1, 2, 3\] made pending\n', + \ execute('14verbose call TryReturnList()')) + " This should not cause stack-use-after-scope + call assert_match('\n:return 123 made pending\n', + \ execute('14verbose call TryReturnNumber()')) + " An overlong string is truncated + call assert_match('\n:return a\{100,}\.\.\.', + \ execute('14verbose call TryReturnOverlongString()')) + + delfunc TryReturnList + delfunc TryReturnNumber + delfunc TryReturnOverlongString +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From db7db783a2d634d5589ebe12605e3989cb30650c Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 3 Feb 2025 10:49:06 +0800 Subject: vim-patch:9.1.1071: args missing after failing to redefine a function Problem: Arguments of a function are missing after failing to redefine it (after 8.2.2505), and heap-use-after-free with script-local function (after 9.1.1063). Solution: Don't clear arguments or free uf_name_exp when failing to redefine an existing function (zeertzjq) closes: vim/vim#16567 https://github.com/vim/vim/commit/04d2a3fdc051d6a419dc0ea4de7a9640cefccd31 --- test/old/testdir/test_user_func.vim | 40 +++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_user_func.vim b/test/old/testdir/test_user_func.vim index da6a6d8dc4..b1543c8f24 100644 --- a/test/old/testdir/test_user_func.vim +++ b/test/old/testdir/test_user_func.vim @@ -421,12 +421,48 @@ func Test_func_def_error() call assert_fails('exe l', 'E717:') " Define an autoload function with an incorrect file name - call writefile(['func foo#Bar()', 'return 1', 'endfunc'], 'Xscript') + call writefile(['func foo#Bar()', 'return 1', 'endfunc'], 'Xscript', 'D') call assert_fails('source Xscript', 'E746:') - call delete('Xscript') " Try to list functions using an invalid search pattern call assert_fails('function /\%(/', 'E53:') + + " Use a script-local function to cover uf_name_exp. + func s:TestRedefine(arg1 = 1, arg2 = 10) + let caught_E122 = 0 + try + func s:TestRedefine(arg1 = 1, arg2 = 10) + endfunc + catch /E122:/ + let caught_E122 = 1 + endtry + call assert_equal(1, caught_E122) + + let caught_E127 = 0 + try + func! s:TestRedefine(arg1 = 1, arg2 = 10) + endfunc + catch /E127:/ + let caught_E127 = 1 + endtry + call assert_equal(1, caught_E127) + + " The failures above shouldn't cause heap-use-after-free here. + return [a:arg1 + a:arg2, expand('')] + endfunc + + let stacks = [] + " Call the function twice. + " Failing to redefine a function shouldn't clear its argument list. + for i in range(2) + let [val, stack] = s:TestRedefine(1000) + call assert_equal(1010, val) + call assert_match(expand('') .. 'TestRedefine\[20\]$', stack) + call add(stacks, stack) + endfor + call assert_equal(stacks[0], stacks[1]) + + delfunc s:TestRedefine endfunc " Test for deleting a function -- cgit From d7426bc9e99a44e5c79a3645aa74fc2a300e3ae6 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 17 Dec 2024 09:06:26 +0800 Subject: vim-patch:9.1.0935: SpotBugs compiler can be improved MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: SpotBugs compiler can be improved Solution: runtime(compiler): Improve defaults and error handling for SpotBugs; update test_compiler.vim (Aliaksei Budavei) runtime(compiler): Improve defaults and error handling for SpotBugs * Keep "spotbugs#DefaultPreCompilerTestAction()" defined but do not assign its Funcref to the "PreCompilerTestAction" key of "g:spotbugs_properties": there are no default and there can only be introduced arbitrary "*sourceDirPath" entries; therefore, this assignment is confusing at best, given that the function's implementation delegates to whatever "PreCompilerAction" is. * Allow for the possibility of relative source pathnames passed as arguments to Vim for the Javac default actions, and the necessity to have them properly reconciled when the current working directory is changed. * Do not expect users to remember or know that new source files ‘must be’ ":argadd"'d to be then known to the Javac default actions; so collect the names of Java-file buffers and Java-file Vim arguments; and let users providing the "@sources" file-lists in the "g:javac_makeprg_params" variable update these file-lists themselves. * Strive to not leave behind a fire-once Syntax ":autocmd" for a Java buffer whenever an arbitrary pre-compile action errors out. * Only attempt to run a post-compiler action in the absence of failures for a pre-compiler action. Note that warnings and failures are treated alike (?!) by the Javac compiler, so when previews are tried out with "--enable-preview", remember about passing "-Xlint:-preview" too to also let SpotBugs have a go. * Properly group conditional operators when testing for key entries in a user-defined variable. * Also test whether "javaExternal" is defined when choosing an implementation for source-file parsing. * Two commands are provided to toggle actions for buffer-local autocommands: - SpotBugsRemoveBufferAutocmd; - SpotBugsDefineBufferAutocmd. For example, try this from "~/.vim/after/ftplugin/java.vim": ------------------------------------------------------------ if exists(':SpotBugsDefineBufferAutocmd') == 2 SpotBugsDefineBufferAutocmd BufWritePost SigUSR1 endif ------------------------------------------------------------ And ":doautocmd java_spotbugs User" can be manually used at will. closes: vim/vim#16140 https://github.com/vim/vim/commit/368ef5a48c7a41af7fe2c32a5d5659e23aff63d0 Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com> --- test/old/testdir/test_compiler.vim | 404 +++++++++++++++++++++++++++++++++++-- 1 file changed, 389 insertions(+), 15 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_compiler.vim b/test/old/testdir/test_compiler.vim index 3ad6b365de..e6d5e57824 100644 --- a/test/old/testdir/test_compiler.vim +++ b/test/old/testdir/test_compiler.vim @@ -18,6 +18,8 @@ func Test_compiler() endif e Xfoo.pl + " Play nice with other tests. + defer setqflist([]) compiler perl call assert_equal('perl', b:current_compiler) call assert_fails('let g:current_compiler', 'E121:') @@ -91,6 +93,7 @@ func s:SpotBugsParseFilterMakePrg(dirname, makeprg) endif let offset += 1 + strlen('-sourcepath') let result.sourcepath = matchstr(strpart(a:makeprg, offset), '.\{-}\ze[ \t]') + let offset += 1 + strlen(result.sourcepath) " Get the class file arguments, dropping the pathname prefix. let offset = stridx(a:makeprg, a:dirname, offset) @@ -140,7 +143,8 @@ func Test_compiler_spotbugs_makeprg() " THE EXPECTED RESULTS. let results = {} let results['Xspotbugs/src/tests/𐌂1.java'] = { - \ 'sourcepath': '%:p:h:S', + \ 'Sourcepath': {-> fnamemodify('Xspotbugs/src/tests/𐌂1.java', + \ ':p:h:S')}, \ 'classfiles': sort([ \ 'Xspotbugs/tests/𐌂1$1.class', \ 'Xspotbugs/tests/𐌂1$1𐌉𐌉1.class', @@ -153,11 +157,12 @@ func Test_compiler_spotbugs_makeprg() \ } " No class file for an empty source file even with "-Xpkginfo:always". let results['Xspotbugs/src/tests/package-info.java'] = { - \ 'sourcepath': '', + \ 'Sourcepath': {-> ''}, \ 'classfiles': [], \ } let results['Xspotbugs/src/tests/α/𐌂1.java'] = { - \ 'sourcepath': '%:p:h:h:S', + \ 'Sourcepath': {-> fnamemodify('Xspotbugs/src/tests/α/𐌂1.java', + \ ':p:h:h:S')}, \ 'classfiles': sort([ \ 'Xspotbugs/tests/α/𐌂1$1.class', \ 'Xspotbugs/tests/α/𐌂1$1𐌉𐌉1.class', @@ -169,11 +174,13 @@ func Test_compiler_spotbugs_makeprg() \ 'Xspotbugs/tests/α/𐌂2.class']), \ } let results['Xspotbugs/src/tests/α/package-info.java'] = { - \ 'sourcepath': '%:p:h:S', + \ 'Sourcepath': {-> fnamemodify('Xspotbugs/src/tests/α/package-info.java', + \ ':p:h:S')}, \ 'classfiles': ['Xspotbugs/tests/α/package-info.class'], \ } let results['Xspotbugs/src/tests/α/β/𐌂1.java'] = { - \ 'sourcepath': '%:p:h:h:h:S', + \ 'Sourcepath': {-> fnamemodify('Xspotbugs/src/tests/α/β/𐌂1.java', + \ ':p:h:h:h:S')}, \ 'classfiles': sort([ \ 'Xspotbugs/tests/α/β/𐌂1$1.class', \ 'Xspotbugs/tests/α/β/𐌂1$1𐌉𐌉1.class', @@ -185,11 +192,13 @@ func Test_compiler_spotbugs_makeprg() \ 'Xspotbugs/tests/α/β/𐌂2.class']), \ } let results['Xspotbugs/src/tests/α/β/package-info.java'] = { - \ 'sourcepath': '%:p:h:S', + \ 'Sourcepath': {-> fnamemodify('Xspotbugs/src/tests/α/β/package-info.java', + \ ':p:h:S')}, \ 'classfiles': ['Xspotbugs/tests/α/β/package-info.class'], \ } let results['Xspotbugs/src/tests/α/β/γ/𐌂1.java'] = { - \ 'sourcepath': '%:p:h:h:h:h:S', + \ 'Sourcepath': {-> fnamemodify('Xspotbugs/src/tests/α/β/γ/𐌂1.java', + \ ':p:h:h:h:h:S')}, \ 'classfiles': sort([ \ 'Xspotbugs/tests/α/β/γ/𐌂1$1.class', \ 'Xspotbugs/tests/α/β/γ/𐌂1$1𐌉𐌉1.class', @@ -201,11 +210,13 @@ func Test_compiler_spotbugs_makeprg() \ 'Xspotbugs/tests/α/β/γ/𐌂2.class']), \ } let results['Xspotbugs/src/tests/α/β/γ/package-info.java'] = { - \ 'sourcepath': '%:p:h:S', + \ 'Sourcepath': {-> fnamemodify('Xspotbugs/src/tests/α/β/γ/package-info.java', + \ ':p:h:S')}, \ 'classfiles': ['Xspotbugs/tests/α/β/γ/package-info.class'], \ } let results['Xspotbugs/src/tests/α/β/γ/δ/𐌂1.java'] = { - \ 'sourcepath': '%:p:h:h:h:h:h:S', + \ 'Sourcepath': {-> fnamemodify('Xspotbugs/src/tests/α/β/γ/δ/𐌂1.java', + \ ':p:h:h:h:h:h:S')}, \ 'classfiles': sort([ \ 'Xspotbugs/tests/α/β/γ/δ/𐌂1$1.class', \ 'Xspotbugs/tests/α/β/γ/δ/𐌂1$1𐌉𐌉1.class', @@ -217,14 +228,15 @@ func Test_compiler_spotbugs_makeprg() \ 'Xspotbugs/tests/α/β/γ/δ/𐌂2.class']), \ } let results['Xspotbugs/src/tests/α/β/γ/δ/package-info.java'] = { - \ 'sourcepath': '%:p:h:S', + \ 'Sourcepath': {-> fnamemodify('Xspotbugs/src/tests/α/β/γ/δ/package-info.java', + \ ':p:h:S')}, \ 'classfiles': ['Xspotbugs/tests/α/β/γ/δ/package-info.class'], \ } " MAKE CLASS FILES DISCOVERABLE! let g:spotbugs_properties = { - \ 'sourceDirPath': 'src/tests', - \ 'classDirPath': 'tests', + \ 'sourceDirPath': ['src/tests'], + \ 'classDirPath': ['tests'], \ } call assert_true(has_key(s:SpotBugsParseFilterMakePrg('Xspotbugs', ''), 'sourcepath')) @@ -249,20 +261,22 @@ func Test_compiler_spotbugs_makeprg() let package_file = src_dir .. 'package-info.java' call writefile([package], src_dir .. 'package-info.java') - for s in ['on', 'off'] + " Note that using "off" for the first _outer_ iteration is preferable + " because only then "hlexists()" may be 0 (see "compiler/spotbugs.vim"). + for s in ['off', 'on'] execute 'syntax ' .. s execute 'edit ' .. type_file compiler spotbugs let result = s:SpotBugsParseFilterMakePrg('Xspotbugs', &l:makeprg) - call assert_equal(results[type_file].sourcepath, result.sourcepath) + call assert_equal(results[type_file].Sourcepath(), result.sourcepath) call assert_equal(results[type_file].classfiles, result.classfiles) bwipeout execute 'edit ' .. package_file compiler spotbugs let result = s:SpotBugsParseFilterMakePrg('Xspotbugs', &l:makeprg) - call assert_equal(results[package_file].sourcepath, result.sourcepath) + call assert_equal(results[package_file].Sourcepath(), result.sourcepath) call assert_equal(results[package_file].classfiles, result.classfiles) bwipeout endfor @@ -271,4 +285,364 @@ func Test_compiler_spotbugs_makeprg() let &shellslash = save_shellslash endfunc +func s:SpotBugsBeforeFileTypeTryPluginAndClearCache(state) + " Ponder over "extend(spotbugs#DefaultProperties(), g:spotbugs_properties)" + " in "ftplugin/java.vim". + let g:spotbugs#state = a:state + runtime autoload/spotbugs.vim +endfunc + +func Test_compiler_spotbugs_properties() + let save_shellslash = &shellslash + set shellslash + setlocal makeprg= + filetype plugin on + + call assert_true(mkdir('Xspotbugs/src', 'pR')) + call assert_true(mkdir('Xspotbugs/tests', 'pR')) + let type_file = 'Xspotbugs/src/𐌄.java' + let test_file = 'Xspotbugs/tests/𐌄$.java' + call writefile(['enum 𐌄{}'], type_file) + call writefile(['class 𐌄${}'], test_file) + + " TEST INTEGRATION WITH A BOGUS COMPILER PLUGIN. + if !filereadable($VIMRUNTIME .. '/compiler/foo.vim') && !executable('foo') + let g:spotbugs_properties = {'compiler': 'foo'} + " XXX: In case this "if" block is no longer first. + call s:SpotBugsBeforeFileTypeTryPluginAndClearCache({ + \ 'compiler': g:spotbugs_properties.compiler, + \ }) + execute 'edit ' .. type_file + call assert_equal('java', &l:filetype) + " This variable will indefinitely keep the compiler name. + call assert_equal('foo', g:spotbugs#state.compiler) + " The "compiler" entry should be gone after FileType and default entries + " should only appear for a supported compiler. + call assert_false(has_key(g:spotbugs_properties, 'compiler')) + call assert_true(empty(g:spotbugs_properties)) + " Query default implementations. + call assert_true(exists('*spotbugs#DefaultProperties')) + call assert_true(exists('*spotbugs#DefaultPreCompilerAction')) + call assert_true(exists('*spotbugs#DefaultPreCompilerTestAction')) + call assert_true(empty(spotbugs#DefaultProperties())) + " Get a ":message". + redir => out + call spotbugs#DefaultPreCompilerAction() + redir END + call assert_equal('Not supported: "foo"', out[stridx(out, 'Not') :]) + " Get a ":message". + redir => out + call spotbugs#DefaultPreCompilerTestAction() + redir END + call assert_equal('Not supported: "foo"', out[stridx(out, 'Not') :]) + " No ":autocmd"s without one of "PreCompiler*Action", "PostCompilerAction". + call assert_false(exists('#java_spotbugs')) + bwipeout + endif + + let s:spotbugs_results = { + \ 'preActionDone': 0, + \ 'preTestActionDone': 0, + \ 'preTestLocalActionDone': 0, + \ 'postActionDone': 0, + \ 'preCommandArguments': '', + \ 'preTestCommandArguments': '', + \ 'postCommandArguments': '', + \ } + defer execute('unlet s:spotbugs_results') + + func! g:SpotBugsPreAction() abort + let s:spotbugs_results.preActionDone = 1 + " XXX: Notify the spotbugs compiler about success or failure. + cc + endfunc + defer execute('delfunction g:SpotBugsPreAction') + + func! g:SpotBugsPreTestAction() abort + let s:spotbugs_results.preTestActionDone = 1 + " XXX: Let see compilation fail. + throw 'Oops' + endfunc + defer execute('delfunction g:SpotBugsPreTestAction') + + func! g:SpotBugsPreTestLocalAction() abort + let s:spotbugs_results.preTestLocalActionDone = 1 + " XXX: Notify the spotbugs compiler about success or failure. + cc + endfunc + defer execute('delfunction g:SpotBugsPreTestLocalAction') + + func! g:SpotBugsPostAction() abort + let s:spotbugs_results.postActionDone = 1 + endfunc + defer execute('delfunction g:SpotBugsPostAction') + + func! g:SpotBugsPreCommand(arguments) abort + let s:spotbugs_results.preActionDone = 1 + let s:spotbugs_results.preCommandArguments = a:arguments + " XXX: Notify the spotbugs compiler about success or failure. + cc + endfunc + defer execute('delfunction g:SpotBugsPreCommand') + + func! g:SpotBugsPreTestCommand(arguments) abort + let s:spotbugs_results.preTestActionDone = 1 + let s:spotbugs_results.preTestCommandArguments = a:arguments + " XXX: Notify the spotbugs compiler about success or failure. + cc + endfunc + defer execute('delfunction g:SpotBugsPreTestCommand') + + func! g:SpotBugsPostCommand(arguments) abort + let s:spotbugs_results.postActionDone = 1 + let s:spotbugs_results.postCommandArguments = a:arguments + endfunc + defer execute('delfunction g:SpotBugsPostCommand') + + " TEST INTEGRATION WITH A SUPPORTED COMPILER PLUGIN. + if filereadable($VIMRUNTIME .. '/compiler/maven.vim') + if !executable('mvn') + if has('win32') + " This is what ":help executable()" suggests. + call writefile([], 'Xspotbugs/mvn.exe') + else + let $PATH = 'Xspotbugs:' .. $PATH + call writefile([], 'Xspotbugs/mvn') + call setfperm('Xspotbugs/mvn', 'rwx------') + endif + endif + + let g:spotbugs_properties = { + \ 'compiler': 'maven', + \ 'PreCompilerAction': function('g:SpotBugsPreAction'), + \ 'PreCompilerTestAction': function('g:SpotBugsPreTestAction'), + \ 'PostCompilerAction': function('g:SpotBugsPostAction'), + \ } + " XXX: In case this is a runner-up ":edit". + call s:SpotBugsBeforeFileTypeTryPluginAndClearCache({ + \ 'compiler': g:spotbugs_properties.compiler, + \ }) + execute 'edit ' .. type_file + call assert_equal('java', &l:filetype) + call assert_equal('maven', g:spotbugs#state.compiler) + call assert_false(has_key(g:spotbugs_properties, 'compiler')) + call assert_false(empty(g:spotbugs_properties)) + " Query default implementations. + call assert_true(exists('*spotbugs#DefaultProperties')) + call assert_equal(sort([ + \ 'PreCompilerAction', + \ 'PreCompilerTestAction', + \ 'PostCompilerAction', + \ 'sourceDirPath', + \ 'classDirPath', + \ 'testSourceDirPath', + \ 'testClassDirPath', + \ ]), + \ sort(keys(spotbugs#DefaultProperties()))) + " Some ":autocmd"s with one of "PreCompiler*Action", "PostCompilerAction". + call assert_true(exists('#java_spotbugs')) + call assert_true(exists('#java_spotbugs#Syntax')) + call assert_true(exists('#java_spotbugs#User')) + call assert_equal(2, exists(':SpotBugsDefineBufferAutocmd')) + " SpotBugsDefineBufferAutocmd SigUSR1 User SigUSR1 User SigUSR1 User + " call assert_true(exists('#java_spotbugs#SigUSR1')) + SpotBugsDefineBufferAutocmd Signal User Signal User Signal User + call assert_true(exists('#java_spotbugs#Signal')) + call assert_true(exists('#java_spotbugs#Syntax')) + call assert_true(exists('#java_spotbugs#User')) + call assert_equal(2, exists(':SpotBugsRemoveBufferAutocmd')) + " SpotBugsRemoveBufferAutocmd SigUSR1 User SigUSR1 User UserGettingBored + " call assert_false(exists('#java_spotbugs#SigUSR1')) + SpotBugsRemoveBufferAutocmd Signal User Signal User UserGettingBored + call assert_false(exists('#java_spotbugs#Signal')) + call assert_true(exists('#java_spotbugs#Syntax')) + call assert_true(exists('#java_spotbugs#User')) + + let s:spotbugs_results.preActionDone = 0 + let s:spotbugs_results.preTestActionDone = 0 + let s:spotbugs_results.postActionDone = 0 + + doautocmd java_spotbugs Syntax + call assert_false(exists('#java_spotbugs#Syntax')) + + " No match: "type_file !~# 'src/main/java'". + call assert_false(s:spotbugs_results.preActionDone) + " No match: "type_file !~# 'src/test/java'". + call assert_false(s:spotbugs_results.preTestActionDone) + " No pre-match, no post-action. + call assert_false(s:spotbugs_results.postActionDone) + " Without a match, confirm that ":compiler spotbugs" has NOT run. + call assert_true(empty(&l:makeprg)) + + let s:spotbugs_results.preActionDone = 0 + let s:spotbugs_results.preTestActionDone = 0 + let s:spotbugs_results.postActionDone = 0 + " Update path entries. (Note that we cannot use just "src" because there + " is another "src" directory nearer the filesystem root directory, i.e. + " "vim/vim/src/testdir/Xspotbugs/src", and "s:DispatchAction()" (see + " "ftplugin/java.vim") will match "vim/vim/src/testdir/Xspotbugs/tests" + " against "src".) + let g:spotbugs_properties.sourceDirPath = ['Xspotbugs/src'] + let g:spotbugs_properties.classDirPath = ['Xspotbugs/src'] + let g:spotbugs_properties.testSourceDirPath = ['tests'] + let g:spotbugs_properties.testClassDirPath = ['tests'] + + doautocmd java_spotbugs User + " No match: "type_file !~# 'src/main/java'" (with old "*DirPath" values + " cached). + call assert_false(s:spotbugs_results.preActionDone) + " No match: "type_file !~# 'src/test/java'" (with old "*DirPath" values + " cached). + call assert_false(s:spotbugs_results.preTestActionDone) + " No pre-match, no post-action. + call assert_false(s:spotbugs_results.postActionDone) + " Without a match, confirm that ":compiler spotbugs" has NOT run. + call assert_true(empty(&l:makeprg)) + + let s:spotbugs_results.preActionDone = 0 + let s:spotbugs_results.preTestActionDone = 0 + let s:spotbugs_results.postActionDone = 0 + " XXX: Re-build ":autocmd"s from scratch with new values applied. + doautocmd FileType + + call assert_true(exists('b:spotbugs_syntax_once')) + doautocmd java_spotbugs User + " A match: "type_file =~# 'Xspotbugs/src'" (with new "*DirPath" values + " cached). + call assert_true(s:spotbugs_results.preActionDone) + " No match: "type_file !~# 'tests'" (with new "*DirPath" values cached). + call assert_false(s:spotbugs_results.preTestActionDone) + " For a pre-match, a post-action. + call assert_true(s:spotbugs_results.postActionDone) + + " With a match, confirm that ":compiler spotbugs" has run. + if has('win32') + call assert_match('^spotbugs\.bat\s', &l:makeprg) + else + call assert_match('^spotbugs\s', &l:makeprg) + endif + + bwipeout + setlocal makeprg= + let s:spotbugs_results.preActionDone = 0 + let s:spotbugs_results.preTestActionDone = 0 + let s:spotbugs_results.preTestLocalActionDone = 0 + let s:spotbugs_results.postActionDone = 0 + + execute 'edit ' .. test_file + " Prepare a buffer-local, incomplete variant of properties, relying on + " "ftplugin/java.vim" to take care of merging in unique entries, if any, + " from "g:spotbugs_properties". + let b:spotbugs_properties = { + \ 'PreCompilerTestAction': function('g:SpotBugsPreTestLocalAction'), + \ } + call assert_equal('java', &l:filetype) + call assert_true(exists('#java_spotbugs')) + call assert_true(exists('#java_spotbugs#Syntax')) + call assert_true(exists('#java_spotbugs#User')) + call assert_fails('doautocmd java_spotbugs Syntax', 'Oops') + call assert_false(exists('#java_spotbugs#Syntax')) + " No match: "test_file !~# 'Xspotbugs/src'". + call assert_false(s:spotbugs_results.preActionDone) + " A match: "test_file =~# 'tests'". + call assert_true(s:spotbugs_results.preTestActionDone) + call assert_false(s:spotbugs_results.preTestLocalActionDone) + " No action after pre-failure (the thrown "Oops" doesn't qualify for ":cc"). + call assert_false(s:spotbugs_results.postActionDone) + " No ":compiler spotbugs" will be run after pre-failure. + call assert_true(empty(&l:makeprg)) + + let s:spotbugs_results.preActionDone = 0 + let s:spotbugs_results.preTestActionDone = 0 + let s:spotbugs_results.preTestLocalActionDone = 0 + let s:spotbugs_results.postActionDone = 0 + " XXX: Re-build ":autocmd"s from scratch with buffer-local values applied. + doautocmd FileType + + call assert_true(exists('b:spotbugs_syntax_once')) + doautocmd java_spotbugs User + " No match: "test_file !~# 'Xspotbugs/src'". + call assert_false(s:spotbugs_results.preActionDone) + " A match: "test_file =~# 'tests'". + call assert_true(s:spotbugs_results.preTestLocalActionDone) + call assert_false(s:spotbugs_results.preTestActionDone) + " For a pre-match, a post-action. + call assert_true(s:spotbugs_results.postActionDone) + + " With a match, confirm that ":compiler spotbugs" has run. + if has('win32') + call assert_match('^spotbugs\.bat\s', &l:makeprg) + else + call assert_match('^spotbugs\s', &l:makeprg) + endif + + setlocal makeprg= + let s:spotbugs_results.preActionDone = 0 + let s:spotbugs_results.preTestActionDone = 0 + let s:spotbugs_results.preTestLocalActionDone = 0 + let s:spotbugs_results.postActionDone = 0 + let s:spotbugs_results.preCommandArguments = '' + let s:spotbugs_results.preTestCommandArguments = '' + let s:spotbugs_results.postCommandArguments = '' + " XXX: Compose the assigned "*Command"s with the default Maven "*Action"s. + let b:spotbugs_properties = { + \ 'compiler': 'maven', + \ 'DefaultPreCompilerTestCommand': function('g:SpotBugsPreTestCommand'), + \ 'DefaultPreCompilerCommand': function('g:SpotBugsPreCommand'), + \ 'DefaultPostCompilerCommand': function('g:SpotBugsPostCommand'), + \ 'sourceDirPath': ['Xspotbugs/src'], + \ 'classDirPath': ['Xspotbugs/src'], + \ 'testSourceDirPath': ['tests'], + \ 'testClassDirPath': ['tests'], + \ } + unlet g:spotbugs_properties + " XXX: Re-build ":autocmd"s from scratch with buffer-local values applied. + call s:SpotBugsBeforeFileTypeTryPluginAndClearCache({ + \ 'compiler': b:spotbugs_properties.compiler, + \ 'commands': { + \ 'DefaultPreCompilerTestCommand': + \ b:spotbugs_properties.DefaultPreCompilerTestCommand, + \ 'DefaultPreCompilerCommand': + \ b:spotbugs_properties.DefaultPreCompilerCommand, + \ 'DefaultPostCompilerCommand': + \ b:spotbugs_properties.DefaultPostCompilerCommand, + \ }, + \ }) + doautocmd FileType + + call assert_equal('maven', g:spotbugs#state.compiler) + call assert_equal(sort([ + \ 'DefaultPreCompilerTestCommand', + \ 'DefaultPreCompilerCommand', + \ 'DefaultPostCompilerCommand', + \ ]), + \ sort(keys(g:spotbugs#state.commands))) + call assert_true(exists('b:spotbugs_syntax_once')) + doautocmd java_spotbugs User + " No match: "test_file !~# 'Xspotbugs/src'". + call assert_false(s:spotbugs_results.preActionDone) + call assert_true(empty(s:spotbugs_results.preCommandArguments)) + " A match: "test_file =~# 'tests'". + call assert_true(s:spotbugs_results.preTestActionDone) + call assert_equal('test-compile', s:spotbugs_results.preTestCommandArguments) + " For a pre-match, a post-action. + call assert_true(s:spotbugs_results.postActionDone) + call assert_equal('%:S', s:spotbugs_results.postCommandArguments) + + " With a match, confirm that ":compiler spotbugs" has run. + if has('win32') + call assert_match('^spotbugs\.bat\s', &l:makeprg) + else + call assert_match('^spotbugs\s', &l:makeprg) + endif + + bwipeout + setlocal makeprg= + endif + + filetype plugin off + setlocal makeprg= + let &shellslash = save_shellslash +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From 89c294514853ee4849855f880d6d7ff349494c4d Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 28 Dec 2024 07:32:08 +0800 Subject: vim-patch:9.1.0967: SpotBugs compiler setup can be further improved Problem: SpotBugs compiler can be further improved Solution: Introduce event-driven primitives for SpotBugs (Aliaksei Budavei) closes: vim/vim#16258 https://github.com/vim/vim/commit/2e252474c4df5018b9819d86ebb70bf3b1b1a1af Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com> --- test/old/testdir/test_compiler.vim | 64 +++++++++++++++++++++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_compiler.vim b/test/old/testdir/test_compiler.vim index e6d5e57824..f9e7bf042d 100644 --- a/test/old/testdir/test_compiler.vim +++ b/test/old/testdir/test_compiler.vim @@ -399,12 +399,22 @@ func Test_compiler_spotbugs_properties() endfunc defer execute('delfunction g:SpotBugsPostCommand') + func! g:SpotBugsPostCompilerActionExecutor(action) abort + try + " XXX: Notify the spotbugs compiler about success or failure. + cc + catch /\ Date: Tue, 4 Feb 2025 06:45:14 +0800 Subject: vim-patch:9.1.1073: tests: test_compiler fails on Windows without Maven Problem: tests: test_compiler fails on Windows without Maven. Solution: Add Xspotbugs directory to $PATH when mvn is not available (zeertzjq). closes: vim/vim#16576 https://github.com/vim/vim/commit/23da16d3d023a20565dc29128208e6cb095231d9 --- test/old/testdir/test_compiler.vim | 3 +++ 1 file changed, 3 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_compiler.vim b/test/old/testdir/test_compiler.vim index f9e7bf042d..1310cbadfc 100644 --- a/test/old/testdir/test_compiler.vim +++ b/test/old/testdir/test_compiler.vim @@ -411,8 +411,10 @@ func Test_compiler_spotbugs_properties() " TEST INTEGRATION WITH A SUPPORTED COMPILER PLUGIN. if filereadable($VIMRUNTIME .. '/compiler/maven.vim') + let save_PATH = $PATH if !executable('mvn') if has('win32') + let $PATH = 'Xspotbugs;' .. $PATH " This is what ":help executable()" suggests. call writefile([], 'Xspotbugs/mvn.cmd') else @@ -700,6 +702,7 @@ func Test_compiler_spotbugs_properties() bwipeout setlocal makeprg= + let $PATH = save_PATH endif filetype plugin off -- cgit From 5a7cf85c2c7e452563a4bce9195e9a3426ca3050 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 4 Feb 2025 07:44:41 +0800 Subject: vim-patch:9.1.1074: Strange error when heredoc marker starts with "trim" (#32317) Problem: Strange error when heredoc marker starts with "trim". Solution: Check for whitespace after "trim" or "eval" (zeertzjq) For :python3 etc., a heredoc marker that starts with a lower-case letter is valid, and when it starts with "trim" it works in a script but not in a function, and this PR makes it works in a function. For :let, a heredoc marker that starts with a lower-case letter is not valid, but when it starts with "trim" or "eval" the error can be a bit confusing in a function, and this PR make it less confusing. closes: vim/vim#16574 https://github.com/vim/vim/commit/449c2e5454735fe1cfc8c21b2c6880d6bdf4cd6e --- test/old/testdir/test_let.vim | 18 ++++++++++++++++++ test/old/testdir/test_perl.vim | 5 ++++- test/old/testdir/test_python3.vim | 5 ++++- test/old/testdir/test_pyx3.vim | 5 ++++- test/old/testdir/test_ruby.vim | 5 ++++- 5 files changed, 34 insertions(+), 4 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_let.vim b/test/old/testdir/test_let.vim index 44852c1d38..22a3a35f87 100644 --- a/test/old/testdir/test_let.vim +++ b/test/old/testdir/test_let.vim @@ -436,6 +436,24 @@ func Test_let_heredoc_fails() call assert_report('Caught exception: ' .. v:exception) endtry + try + let v =<< trim trimm + trimm + call assert_report('No exception thrown') + catch /E221:/ + catch + call assert_report('Caught exception: ' .. v:exception) + endtry + + try + let v =<< trim trim evall + evall + call assert_report('No exception thrown') + catch /E221:/ + catch + call assert_report('Caught exception: ' .. v:exception) + endtry + let text =<< trim END func WrongSyntax() let v =<< that there diff --git a/test/old/testdir/test_perl.vim b/test/old/testdir/test_perl.vim index c08a042dae..2d7f8fdc10 100644 --- a/test/old/testdir/test_perl.vim +++ b/test/old/testdir/test_perl.vim @@ -316,7 +316,10 @@ VIM::DoCommand('let s ..= "B"') perl << trim eof VIM::DoCommand('let s ..= "E"') eof - call assert_equal('ABCDE', s) + perl << trimm +VIM::DoCommand('let s ..= "F"') +trimm + call assert_equal('ABCDEF', s) endfunc " vim: shiftwidth=2 sts=2 expandtab diff --git a/test/old/testdir/test_python3.vim b/test/old/testdir/test_python3.vim index c9dbc0b84e..2436587100 100644 --- a/test/old/testdir/test_python3.vim +++ b/test/old/testdir/test_python3.vim @@ -284,7 +284,10 @@ s+='B' python3 << trim eof s+='E' eof - call assert_equal('ABCDE', pyxeval('s')) + python3 << trimm +s+='F' +trimm + call assert_equal('ABCDEF', pyxeval('s')) endfunc " vim: shiftwidth=2 sts=2 expandtab diff --git a/test/old/testdir/test_pyx3.vim b/test/old/testdir/test_pyx3.vim index 89a3cc22ff..8dfeaff807 100644 --- a/test/old/testdir/test_pyx3.vim +++ b/test/old/testdir/test_pyx3.vim @@ -97,7 +97,10 @@ result+='B' pyx << trim eof result+='E' eof - call assert_equal('ABCDE', pyxeval('result')) + pyx << trimm +result+='F' +trimm + call assert_equal('ABCDEF', pyxeval('result')) endfunc " vim: shiftwidth=2 sts=2 expandtab diff --git a/test/old/testdir/test_ruby.vim b/test/old/testdir/test_ruby.vim index 4d54d29df7..94941da873 100644 --- a/test/old/testdir/test_ruby.vim +++ b/test/old/testdir/test_ruby.vim @@ -439,7 +439,10 @@ Vim.command('let s ..= "B"') ruby << trim eof Vim.command('let s ..= "E"') eof - call assert_equal('ABCDE', s) +ruby << trimm +Vim.command('let s ..= "F"') +trimm + call assert_equal('ABCDEF', s) endfunc " vim: shiftwidth=2 sts=2 expandtab -- cgit From 290bb4c64bdcc475c29b857dc8626f5c51aa2b8d Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 3 Feb 2025 21:52:53 +0800 Subject: vim-patch:9.1.1009: diff feature can be improved Problem: diff feature can be improved Solution: include the linematch diff alignment algorithm (Jonathon) closes: vim/vim#9661 https://github.com/vim/vim/commit/7c7a4e6d1ad50d5b25b42aa2d5a33a8d04a4cc8a Co-authored-by: Jonathon --- test/old/testdir/test_diffmode.vim | 442 +++++++++++++++++++++++++++++++++++++ 1 file changed, 442 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_diffmode.vim b/test/old/testdir/test_diffmode.vim index 695aeeac75..b452be5061 100644 --- a/test/old/testdir/test_diffmode.vim +++ b/test/old/testdir/test_diffmode.vim @@ -1017,6 +1017,41 @@ func Test_diff_screen() call WriteDiffFiles(buf, [], [0]) call VerifyBoth(buf, "Test_diff_22", "") + call WriteDiffFiles(buf, ['?a', '?b', '?c'], ['!b']) + call VerifyInternal(buf, 'Test_diff_23', " diffopt+=linematch:30") + + call WriteDiffFiles(buf, ['', + \ 'common line', + \ 'common line', + \ '', + \ 'DEFabc', + \ 'xyz', + \ 'xyz', + \ 'xyz', + \ 'DEFabc', + \ 'DEFabc', + \ 'DEFabc', + \ 'common line', + \ 'common line', + \ 'DEF', + \ 'common line', + \ 'DEF', + \ 'something' ], + \ ['', + \ 'common line', + \ 'common line', + \ '', + \ 'ABCabc', + \ 'ABCabc', + \ 'ABCabc', + \ 'ABCabc', + \ 'common line', + \ 'common line', + \ 'common line', + \ 'something']) + call VerifyInternal(buf, 'Test_diff_24', " diffopt+=linematch:30") + + " clean up call StopVimInTerminal(buf) call delete('Xdifile1') @@ -2040,4 +2075,411 @@ func Test_diff_topline_noscroll() call StopVimInTerminal(buf) endfunc +func Test_diffget_diffput_linematch() + CheckScreendump + call delete('.Xdifile1.swp') + call delete('.Xdifile2.swp') + call WriteDiffFiles(0, [], []) + let buf = RunVimInTerminal('-d Xdifile1 Xdifile2', {}) + call term_sendkeys(buf, ":set autoread\\w:set autoread\\w") + + " enable linematch + call term_sendkeys(buf, ":set diffopt+=linematch:30\") + call WriteDiffFiles(buf, ['', + \ 'common line', + \ 'common line', + \ '', + \ 'ABCabc', + \ 'ABCabc', + \ 'ABCabc', + \ 'ABCabc', + \ 'common line', + \ 'common line', + \ 'common line', + \ 'something' ], + \ ['', + \ 'common line', + \ 'common line', + \ '', + \ 'DEFabc', + \ 'xyz', + \ 'xyz', + \ 'xyz', + \ 'DEFabc', + \ 'DEFabc', + \ 'DEFabc', + \ 'common line', + \ 'common line', + \ 'DEF', + \ 'common line', + \ 'DEF', + \ 'something']) + call VerifyScreenDump(buf, 'Test_diff_get_put_linematch_1', {}) + + " get from window 1 from line 5 to 9 + call term_sendkeys(buf, "1\w") + call term_sendkeys(buf, ":5,9diffget\") + call VerifyScreenDump(buf, 'Test_diff_get_put_linematch_2', {}) + + " undo the last diffget + call term_sendkeys(buf, "u") + + " get from window 2 from line 5 to 10 + call term_sendkeys(buf, "2\w") + call term_sendkeys(buf, ":5,10diffget\") + call VerifyScreenDump(buf, 'Test_diff_get_put_linematch_3', {}) + + " undo the last diffget + call term_sendkeys(buf, "u") + + " get all from window 2 + call term_sendkeys(buf, "2\w") + call term_sendkeys(buf, ":4,17diffget\") + call VerifyScreenDump(buf, 'Test_diff_get_put_linematch_4', {}) + + " undo the last diffget + call term_sendkeys(buf, "u") + + " get all from window 1 + call term_sendkeys(buf, "1\w") + call term_sendkeys(buf, ":4,12diffget\") + call VerifyScreenDump(buf, 'Test_diff_get_put_linematch_5', {}) + + " undo the last diffget + call term_sendkeys(buf, "u") + + " get from window 1 using do 1 line 5 + call term_sendkeys(buf, "1\w") + call term_sendkeys(buf, "5gg") + call term_sendkeys(buf, ":diffget\") + call VerifyScreenDump(buf, 'Test_diff_get_put_linematch_6', {}) + + " undo the last diffget + call term_sendkeys(buf, "u") + + " get from window 1 using do 2 line 6 + call term_sendkeys(buf, "1\w") + call term_sendkeys(buf, "6gg") + call term_sendkeys(buf, ":diffget\") + call VerifyScreenDump(buf, 'Test_diff_get_put_linematch_7', {}) + + " undo the last diffget + call term_sendkeys(buf, "u") + + " get from window 1 using do 2 line 7 + call term_sendkeys(buf, "1\w") + call term_sendkeys(buf, "7gg") + call term_sendkeys(buf, ":diffget\") + call VerifyScreenDump(buf, 'Test_diff_get_put_linematch_8', {}) + + " undo the last diffget + call term_sendkeys(buf, "u") + + " get from window 1 using do 2 line 11 + call term_sendkeys(buf, "1\w") + call term_sendkeys(buf, "11gg") + call term_sendkeys(buf, ":diffget\") + call VerifyScreenDump(buf, 'Test_diff_get_put_linematch_9', {}) + + " undo the last diffget + call term_sendkeys(buf, "u") + + " get from window 1 using do 2 line 12 + call term_sendkeys(buf, "1\w") + call term_sendkeys(buf, "12gg") + call term_sendkeys(buf, ":diffget\") + call VerifyScreenDump(buf, 'Test_diff_get_put_linematch_10', {}) + + " undo the last diffget + call term_sendkeys(buf, "u") + + " put from window 1 using dp 1 line 5 + call term_sendkeys(buf, "1\w") + call term_sendkeys(buf, "5gg") + call term_sendkeys(buf, ":diffput\") + call VerifyScreenDump(buf, 'Test_diff_get_put_linematch_11', {}) + + " undo the last diffput + call term_sendkeys(buf, "2\w") + call term_sendkeys(buf, "u") + + " put from window 1 using dp 2 line 6 + call term_sendkeys(buf, "1\w") + call term_sendkeys(buf, "6gg") + call term_sendkeys(buf, ":diffput\") + call VerifyScreenDump(buf, 'Test_diff_get_put_linematch_12', {}) + + " undo the last diffput + call term_sendkeys(buf, "2\w") + call term_sendkeys(buf, "u") + + " put from window 1 using dp 2 line 7 + call term_sendkeys(buf, "1\w") + call term_sendkeys(buf, "7gg") + call term_sendkeys(buf, ":diffput\") + call VerifyScreenDump(buf, 'Test_diff_get_put_linematch_13', {}) + + " undo the last diffput + call term_sendkeys(buf, "2\w") + call term_sendkeys(buf, "u") + + " put from window 1 using dp 2 line 11 + call term_sendkeys(buf, "1\w") + call term_sendkeys(buf, "11gg") + call term_sendkeys(buf, ":diffput\") + call VerifyScreenDump(buf, 'Test_diff_get_put_linematch_14', {}) + + " undo the last diffput + call term_sendkeys(buf, "2\w") + call term_sendkeys(buf, "u") + + " put from window 1 using dp 2 line 12 + call term_sendkeys(buf, "1\w") + call term_sendkeys(buf, "12gg") + call term_sendkeys(buf, ":diffput\") + call VerifyScreenDump(buf, 'Test_diff_get_put_linematch_15', {}) + + " undo the last diffput + call term_sendkeys(buf, "2\w") + call term_sendkeys(buf, "u") + + " put from window 2 using dp line 6 + call term_sendkeys(buf, "2\w") + call term_sendkeys(buf, "6gg") + call term_sendkeys(buf, ":diffput\") + call VerifyScreenDump(buf, 'Test_diff_get_put_linematch_16', {}) + + " undo the last diffput + call term_sendkeys(buf, "1\w") + call term_sendkeys(buf, "u") + + " put from window 2 using dp line 8 + call term_sendkeys(buf, "2\w") + call term_sendkeys(buf, "8gg") + call term_sendkeys(buf, ":diffput\") + call VerifyScreenDump(buf, 'Test_diff_get_put_linematch_17', {}) + + " undo the last diffput + call term_sendkeys(buf, "1\w") + call term_sendkeys(buf, "u") + + " put from window 2 using dp line 9 + call term_sendkeys(buf, "2\w") + call term_sendkeys(buf, "9gg") + call term_sendkeys(buf, ":diffput\") + call VerifyScreenDump(buf, 'Test_diff_get_put_linematch_18', {}) + + " undo the last diffput + call term_sendkeys(buf, "1\w") + call term_sendkeys(buf, "u") + + " put from window 2 using dp line 17 + call term_sendkeys(buf, "2\w") + call term_sendkeys(buf, "17gg") + call term_sendkeys(buf, ":diffput\") + call VerifyScreenDump(buf, 'Test_diff_get_put_linematch_19', {}) + +endfunc + +func Test_linematch_diff() + CheckScreendump + call delete('.Xdifile1.swp') + call delete('.Xdifile2.swp') + call WriteDiffFiles(0, [], []) + let buf = RunVimInTerminal('-d Xdifile1 Xdifile2', {}) + call term_sendkeys(buf, ":set autoread\\w:set autoread\\w") + + " enable linematch + call term_sendkeys(buf, ":set diffopt+=linematch:30\") + call WriteDiffFiles(buf, ['// abc d?', + \ '// d?', + \ '// d?' ], + \ ['!', + \ 'abc d!', + \ 'd!']) + call VerifyScreenDump(buf, 'Test_linematch_diff1', {}) + +endfunc + +func Test_linematch_diff_iwhite() + CheckScreendump + call delete('.Xdifile1.swp') + call delete('.Xdifile2.swp') + call WriteDiffFiles(0, [], []) + let buf = RunVimInTerminal('-d Xdifile1 Xdifile2', {}) + call term_sendkeys(buf, ":set autoread\\w:set autoread\\w") + + " setup a diff with 2 files and set linematch:30, with ignore white + call term_sendkeys(buf, ":set diffopt+=linematch:30\") + call WriteDiffFiles(buf, ['void testFunction () {', + \ ' for (int i = 0; i < 10; i++) {', + \ ' for (int j = 0; j < 10; j++) {', + \ ' }', + \ ' }', + \ '}' ], + \ ['void testFunction () {', + \ ' // for (int j = 0; j < 10; i++) {', + \ ' // }', + \ '}']) + call VerifyScreenDump(buf, 'Test_linematch_diff_iwhite1', {}) + call term_sendkeys(buf, ":set diffopt+=iwhiteall\") + call VerifyScreenDump(buf, 'Test_linematch_diff_iwhite2', {}) + +endfunc + +func Test_linematch_diff_grouping() + CheckScreendump + call delete('.Xdifile1.swp') + call delete('.Xdifile2.swp') + call WriteDiffFiles(0, [], []) + let buf = RunVimInTerminal('-d Xdifile1 Xdifile2', {}) + call term_sendkeys(buf, ":set autoread\\w:set autoread\\w") + + " a diff that would result in multiple groups before grouping optimization + call term_sendkeys(buf, ":set diffopt+=linematch:30\") + call WriteDiffFiles(buf, ['!A', + \ '!B', + \ '!C' ], + \ ['?Z', + \ '?A', + \ '?B', + \ '?C', + \ '?A', + \ '?B', + \ '?B', + \ '?C']) + call VerifyScreenDump(buf, 'Test_linematch_diff_grouping1', {}) + call WriteDiffFiles(buf, ['!A', + \ '!B', + \ '!C' ], + \ ['?A', + \ '?Z', + \ '?B', + \ '?C', + \ '?A', + \ '?B', + \ '?C', + \ '?C']) + call VerifyScreenDump(buf, 'Test_linematch_diff_grouping2', {}) + +endfunc + +func Test_linematch_diff_scroll() + CheckScreendump + call delete('.Xdifile1.swp') + call delete('.Xdifile2.swp') + call WriteDiffFiles(0, [], []) + let buf = RunVimInTerminal('-d Xdifile1 Xdifile2', {}) + call term_sendkeys(buf, ":set autoread\\w:set autoread\\w") + + " a diff that would result in multiple groups before grouping optimization + call term_sendkeys(buf, ":set diffopt+=linematch:30\") + call WriteDiffFiles(buf, ['!A', + \ '!B', + \ '!C' ], + \ ['?A', + \ '?Z', + \ '?B', + \ '?C', + \ '?A', + \ '?B', + \ '?C', + \ '?C']) + " scroll down to show calculation of top fill and scroll to correct line in + " both windows + call VerifyScreenDump(buf, 'Test_linematch_diff_grouping_scroll0', {}) + call term_sendkeys(buf, "3\") + call VerifyScreenDump(buf, 'Test_linematch_diff_grouping_scroll1', {}) + call term_sendkeys(buf, "3\") + call VerifyScreenDump(buf, 'Test_linematch_diff_grouping_scroll2', {}) + +endfunc + + + +func Test_linematch_line_limit_exceeded() + CheckScreendump + call delete('.Xdifile1.swp') + call delete('.Xdifile2.swp') + call WriteDiffFiles(0, [], []) + let buf = RunVimInTerminal('-d Xdifile1 Xdifile2', {}) + call term_sendkeys(buf, ":set autoread\\w:set autoread\\w") + + call term_sendkeys(buf, ":set diffopt+=linematch:10\") + " a diff block will not be aligned with linematch because it's contents + " exceed 10 lines + call WriteDiffFiles(buf, + \ ['common line', + \ 'HIL', + \ '', + \ 'aABCabc', + \ 'aABCabc', + \ 'aABCabc', + \ 'aABCabc', + \ 'common line', + \ 'HIL', + \ 'common line', + \ 'something'], + \ ['common line', + \ 'DEF', + \ 'GHI', + \ 'something', + \ '', + \ 'aDEFabc', + \ 'xyz', + \ 'xyz', + \ 'xyz', + \ 'aDEFabc', + \ 'aDEFabc', + \ 'aDEFabc', + \ 'common line', + \ 'DEF', + \ 'GHI', + \ 'something else', + \ 'common line', + \ 'something']) + call VerifyScreenDump(buf, 'Test_linematch_line_limit_exceeded1', {}) + " after increasing the count to 30, the limit is not exceeded, and the + " alignment algorithm will run on the largest diff block here + call term_sendkeys(buf, ":set diffopt+=linematch:30\") + call VerifyScreenDump(buf, 'Test_linematch_line_limit_exceeded2', {}) + +endfunc + +func Test_linematch_3diffs() + CheckScreendump + call delete('.Xdifile1.swp') + call delete('.Xdifile2.swp') + call delete('.Xdifile3.swp') + call WriteDiffFiles3(0, [], [], []) + let buf = RunVimInTerminal('-d Xdifile1 Xdifile2 Xdifile3', {}) + call term_sendkeys(buf, "1\w:set autoread\") + call term_sendkeys(buf, "2\w:set autoread\") + call term_sendkeys(buf, "3\w:set autoread\") + call term_sendkeys(buf, ":set diffopt+=linematch:30\") + call WriteDiffFiles3(buf, + \ ["", + \ " common line", + \ " AAA", + \ " AAA", + \ " AAA"], + \ ["", + \ " common line", + \ " <<<<<<< HEAD", + \ " AAA", + \ " AAA", + \ " AAA", + \ " =======", + \ " BBB", + \ " BBB", + \ " BBB", + \ " >>>>>>> branch1"], + \ ["", + \ " common line", + \ " BBB", + \ " BBB", + \ " BBB"]) + call VerifyScreenDump(buf, 'Test_linematch_3diffs1', {}) + +endfunc " vim: shiftwidth=2 sts=2 expandtab -- cgit From 1c3bda7e92f6162800bc013851c8570800026420 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 4 Feb 2025 08:25:10 +0800 Subject: vim-patch:9.1.1022: linematch option value not completed Problem: linematch option value not completed (after v9.1.1009) Solution: Update diffoption completion values related: vim/vim#9661 closes: vim/vim#16437 https://github.com/vim/vim/commit/9162e636b31dcac57876cbdec15a683cedd9760e Co-authored-by: Christian Brabandt --- test/old/testdir/test_options.vim | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_options.vim b/test/old/testdir/test_options.vim index dfa140b163..2479f0ca51 100644 --- a/test/old/testdir/test_options.vim +++ b/test/old/testdir/test_options.vim @@ -711,6 +711,10 @@ func Test_set_completion_string_values() " Test empty option set diffopt= call assert_equal([], getcompletion('set diffopt-=', 'cmdline')) + " Test all possible values + call assert_equal(['filler', 'context:', 'iblank', 'icase', 'iwhite', 'iwhiteall', 'iwhiteeol', 'horizontal', + \ 'vertical', 'closeoff', 'hiddenoff', 'foldcolumn:', 'followwrap', 'internal', 'indent-heuristic', 'algorithm:', 'linematch:'], + \ getcompletion('set diffopt=', 'cmdline')) set diffopt& " Test escaping output -- cgit From bd145a6c8398fb7a3fd037bc71c1bacaeba49584 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 3 Feb 2025 22:26:32 +0800 Subject: vim-patch:9.1.1027: no sanitize check when running linematch Problem: no sanitize check when running linematch Solution: add sanitize check before applying the linematch algorithm, similar to diff_find_change() (Jonathon) closes: vim/vim#16446 https://github.com/vim/vim/commit/ca307efe486670b76563a4a287bc94dace57fb74 Co-authored-by: Jonathon --- test/old/testdir/test_diffmode.vim | 47 ++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 9 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_diffmode.vim b/test/old/testdir/test_diffmode.vim index b452be5061..ab64658bd0 100644 --- a/test/old/testdir/test_diffmode.vim +++ b/test/old/testdir/test_diffmode.vim @@ -1247,7 +1247,7 @@ func CloseoffSetup() call setline(1, ['one', 'tow', 'three']) diffthis call assert_equal(1, &diff) - only! + bw! endfunc func Test_diff_closeoff() @@ -2278,7 +2278,8 @@ func Test_diffget_diffput_linematch() call term_sendkeys(buf, "17gg") call term_sendkeys(buf, ":diffput\") call VerifyScreenDump(buf, 'Test_diff_get_put_linematch_19', {}) - + " clean up + call StopVimInTerminal(buf) endfunc func Test_linematch_diff() @@ -2298,7 +2299,8 @@ func Test_linematch_diff() \ 'abc d!', \ 'd!']) call VerifyScreenDump(buf, 'Test_linematch_diff1', {}) - + " clean up + call StopVimInTerminal(buf) endfunc func Test_linematch_diff_iwhite() @@ -2324,7 +2326,8 @@ func Test_linematch_diff_iwhite() call VerifyScreenDump(buf, 'Test_linematch_diff_iwhite1', {}) call term_sendkeys(buf, ":set diffopt+=iwhiteall\") call VerifyScreenDump(buf, 'Test_linematch_diff_iwhite2', {}) - + " clean up + call StopVimInTerminal(buf) endfunc func Test_linematch_diff_grouping() @@ -2361,7 +2364,8 @@ func Test_linematch_diff_grouping() \ '?C', \ '?C']) call VerifyScreenDump(buf, 'Test_linematch_diff_grouping2', {}) - + " clean up + call StopVimInTerminal(buf) endfunc func Test_linematch_diff_scroll() @@ -2392,11 +2396,10 @@ func Test_linematch_diff_scroll() call VerifyScreenDump(buf, 'Test_linematch_diff_grouping_scroll1', {}) call term_sendkeys(buf, "3\") call VerifyScreenDump(buf, 'Test_linematch_diff_grouping_scroll2', {}) - + " clean up + call StopVimInTerminal(buf) endfunc - - func Test_linematch_line_limit_exceeded() CheckScreendump call delete('.Xdifile1.swp') @@ -2443,7 +2446,8 @@ func Test_linematch_line_limit_exceeded() " alignment algorithm will run on the largest diff block here call term_sendkeys(buf, ":set diffopt+=linematch:30\") call VerifyScreenDump(buf, 'Test_linematch_line_limit_exceeded2', {}) - + " clean up + call StopVimInTerminal(buf) endfunc func Test_linematch_3diffs() @@ -2480,6 +2484,31 @@ func Test_linematch_3diffs() \ " BBB", \ " BBB"]) call VerifyScreenDump(buf, 'Test_linematch_3diffs1', {}) + " clean up + call StopVimInTerminal(buf) +endfunc +" this used to access invalid memory +func Test_linematch_3diffs_sanity_check() + CheckScreendump + call delete('.Xfile_linematch1.swp') + call delete('.Xfile_linematch2.swp') + call delete('.Xfile_linematch3.swp') + let lines =<< trim END + set diffopt+=linematch:60 + call feedkeys("Aq\") + call feedkeys("GAklm\") + call feedkeys("o") + END + call writefile(lines, 'Xlinematch_3diffs.vim', 'D') + call writefile(['abcd', 'def', 'hij'], 'Xfile_linematch1', 'D') + call writefile(['defq', 'hijk', 'nopq'], 'Xfile_linematch2', 'D') + call writefile(['hijklm', 'nopqr', 'stuv'], 'Xfile_linematch3', 'D') + call WriteDiffFiles3(0, [], [], []) + let buf = RunVimInTerminal('-d -S Xlinematch_3diffs.vim Xfile_linematch1 Xfile_linematch2 Xfile_linematch3', {}) + call VerifyScreenDump(buf, 'Test_linematch_3diffs2', {}) + + " clean up + call StopVimInTerminal(buf) endfunc " vim: shiftwidth=2 sts=2 expandtab -- cgit From 3a1fe4732d8b6efd5b10803e649d62dc17c2c778 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 4 Feb 2025 08:29:34 +0800 Subject: vim-patch:9.1.1072: 'diffopt' "linematch" cannot be used with {n} less than 10 Problem: 'diffopt' "linematch" cannot be used with {n} less than 10 digits (after v9.1.1022) Solution: Fix off-by-one error when checking for digit (zeertzjq) closes: vim/vim#16577 https://github.com/vim/vim/commit/ccd7f454fcac2f99085d4f50e79c111c02741166 --- test/old/testdir/gen_opt_test.vim | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/gen_opt_test.vim b/test/old/testdir/gen_opt_test.vim index f9fcc4ae1b..f12ce8c7c4 100644 --- a/test/old/testdir/gen_opt_test.vim +++ b/test/old/testdir/gen_opt_test.vim @@ -209,9 +209,11 @@ let test_values = { \ 'icase', 'iwhite', 'iwhiteall', 'horizontal', 'vertical', \ 'closeoff', 'hiddenoff', 'foldcolumn:0', 'foldcolumn:12', \ 'followwrap', 'internal', 'indent-heuristic', 'algorithm:myers', - \ 'algorithm:minimal', 'algorithm:patience', - \ 'algorithm:histogram', 'icase,iwhite'], - \ ['xxx', 'foldcolumn:xxx', 'algorithm:xxx', 'algorithm:']], + \ 'icase,iwhite', 'algorithm:minimal', 'algorithm:patience', + \ 'algorithm:histogram', 'linematch:5'], + \ ['xxx', 'foldcolumn:', 'foldcolumn:x', 'foldcolumn:xxx', + \ 'linematch:', 'linematch:x', 'linematch:xxx', 'algorithm:', + \ 'algorithm:xxx', 'context:', 'context:x', 'context:xxx']], \ 'display': [['', 'lastline', 'truncate', 'uhex', 'lastline,uhex'], \ ['xxx']], \ 'eadirection': [['both', 'ver', 'hor'], ['xxx', 'ver,hor']], -- cgit