patch 9.1.0940: Wrong cursor shape with "gq" and 'indentexpr' executes :normal
Problem: Wrong cursor shape with "gq" and 'indentexpr' executes :normal
Solution: Update cursor and mouse shape after restoring old_State.
(zeertzjq)
closes: #16241
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Solution: Update cursor and mouse shape after restoring old_State.
diff --git a/src/textformat.c b/src/textformat.c
index d380899..77e3eef 100644
--- a/src/textformat.c
+++ b/src/textformat.c
@@ -1163,13 +1163,24 @@
State = MODE_INSERT; // for open_line()
smd_save = p_smd;
p_smd = FALSE;
+
insertchar(NUL, INSCHAR_FORMAT
+ (do_comments ? INSCHAR_DO_COM : 0)
+ (do_comments && do_comments_list
? INSCHAR_COM_LIST : 0)
+ (avoid_fex ? INSCHAR_NO_FEX : 0), second_indent);
+
State = old_State;
p_smd = smd_save;
+ // Cursor and mouse shape shapes may have been updated (e.g. by
+ // :normal) in insertchar(), so they need to be updated here.
+#ifdef CURSOR_SHAPE
+ ui_cursor_shape();
+#endif
+#ifdef FEAT_MOUSESHAPE
+ update_mouseshape(-1);
+#endif
+
second_indent = -1;
// at end of par.: need to set indent of next par.
need_set_indent = is_end_par;