patch 9.1.1203: matchparen keeps cursor on case label in sh filetype
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: #16887
closes: #16888
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/testdir/test_plugin_matchparen.vim b/src/testdir/test_plugin_matchparen.vim
index 23491ab..13d6e9e 100644
--- a/src/testdir/test_plugin_matchparen.vim
+++ b/src/testdir/test_plugin_matchparen.vim
@@ -168,6 +168,12 @@
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