diff options
author | zeertzjq <zeertzjq@outlook.com> | 2025-03-15 17:18:08 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-15 17:18:08 +0800 |
commit | 1b1af8aae83e86a6d313d20682d9e02562e94edb (patch) | |
tree | 2345fd198c79ffa85886fafe02254505c8619ffe /test | |
parent | 25ba8392f2d128eb81e9d1928e65fba6a8e0570c (diff) | |
download | rneovim-1b1af8aae83e86a6d313d20682d9e02562e94edb.tar.gz rneovim-1b1af8aae83e86a6d313d20682d9e02562e94edb.tar.bz2 rneovim-1b1af8aae83e86a6d313d20682d9e02562e94edb.zip |
vim-patch:9.1.1203: matchparen keeps cursor on case label in sh filetype (#32900)
Problem: matchparen keeps cursor on case label in sh filetype
(@categorical, after 9.1.1187).
Solution: Use :defer so that cursor is always restored, remove checks
for older Vims, finish early if Vim does not support :defer
fixes: vim/vim#16887
closes: vim/vim#16888
https://github.com/vim/vim/commit/47071c6076018cace96f6e567054a21c123d0c10
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/legacy/matchparen_spec.lua | 22 | ||||
-rw-r--r-- | test/old/testdir/test_plugin_matchparen.vim | 6 |
2 files changed, 28 insertions, 0 deletions
diff --git a/test/functional/legacy/matchparen_spec.lua b/test/functional/legacy/matchparen_spec.lua index 367830b564..665393463d 100644 --- a/test/functional/legacy/matchparen_spec.lua +++ b/test/functional/legacy/matchparen_spec.lua @@ -4,6 +4,7 @@ local Screen = require('test.functional.ui.screen') local clear = n.clear local exec = n.exec local feed = n.feed +local poke_eventloop = n.poke_eventloop describe('matchparen', function() before_each(clear) @@ -238,5 +239,26 @@ describe('matchparen', function() {1:~ }|*2 | ]]) + -- Send keys one by one so that CursorMoved is triggered. + for _, c in ipairs({ 'A', ' ', 'f', 'o', 'o', 'b', 'a', 'r' }) do + feed(c) + poke_eventloop() + end + screen:expect([[ + {18:#!/bin/sh} | + {25:SUSUWU_PRINT() (} | + {15:case} {15:"}{100:${LEVEL}}{15:"} {15:in} | + {15:"}{100:$SUSUWU_SH_NOTICE}{15:")} foobar^ | + {100:${SUSUWU_S}} {15:&&} {15:return} {26:1} | + {15:;;} | + {15:"}{100:$SUSUWU_SH_DEBUG}{15:")} | + {100:(}{15:!} {100:${SUSUWU_VERBOSE})} {15:&&} {15:return} {26:1} | + {15:;;} | + {15:esac} | + {18:# snip} | + {25:)} | + {1:~ }|*2 + {5:-- INSERT --} | + ]]) end) end) diff --git a/test/old/testdir/test_plugin_matchparen.vim b/test/old/testdir/test_plugin_matchparen.vim index 0739906a42..6739abcfde 100644 --- a/test/old/testdir/test_plugin_matchparen.vim +++ b/test/old/testdir/test_plugin_matchparen.vim @@ -168,6 +168,12 @@ func Test_matchparen_ignore_sh_case() let buf = RunVimInTerminal('-S '.filename, #{rows: 10}) call VerifyScreenDump(buf, 'Test_matchparen_sh_case_1', {}) + " Send keys one by one so that CursorMoved is triggered. + for c in 'A foobar' + call term_sendkeys(buf, c) + call term_wait(buf) + endfor + call VerifyScreenDump(buf, 'Test_matchparen_sh_case_2', {}) call StopVimInTerminal(buf) endfunc |