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/dumps/Test_matchparen_sh_case_2.dump b/src/testdir/dumps/Test_matchparen_sh_case_2.dump
new file mode 100644
index 0000000..3ba1c04
--- /dev/null
+++ b/src/testdir/dumps/Test_matchparen_sh_case_2.dump
@@ -0,0 +1,10 @@
+|#+0#0000e05#ffffff0|!|/|b|i|n|/|s|h| +0#0000000&@65
+|S+0#00e0e07&|U|S|U|W|U|_|P|R|I|N|T|(|)| |(| +0#0000000&@58
+@2|c+0#af5f00255&|a|s|e| +0#0000000&|"+0#af5f00255&|$+0#e000e06&|{|L|E|V|E|L|}|"+0#af5f00255&| +0#0000000&|i+0#af5f00255&|n| +0#0000000&@54
+@4|"+0#af5f00255&|$+0#e000e06&|S|U|S|U|W|U|_|S|H|_|N|O|T|I|C|E|"+0#af5f00255&|)| +0#0000000&|f|o@1|b|a|r> @43
+@4|$+0#e000e06&|{|S|U|S|U|W|U|_|S|}| +0#0000000&|&+0#af5f00255&@1| +0#0000000&|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|1+0#e000002&| +0#0000000&@47
+@2|;+0#af5f00255&@1| +0#0000000&@70
+@4|"+0#af5f00255&|$+0#e000e06&|S|U|S|U|W|U|_|S|H|_|D|E|B|U|G|"+0#af5f00255&|)| +0#0000000&@51
+@4|(+0#e000e06&|!+0#af5f00255&| +0#0000000&|$+0#e000e06&|{|S|U|S|U|W|U|_|V|E|R|B|O|S|E|}|)| +0#0000000&|&+0#af5f00255&@1| +0#0000000&|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|1+0#e000002&| +0#0000000&@37
+@2|;+0#af5f00255&@1| +0#0000000&@70
+|-+2&&@1| |I|N|S|E|R|T| |-@1| +0&&@44|4|,|3|2| @9|T|o|p|
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
diff --git a/src/version.c b/src/version.c
index c129404..3380854 100644
--- a/src/version.c
+++ b/src/version.c
@@ -705,6 +705,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1203,
+/**/
1202,
/**/
1201,