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 --- src/nvim/textformat.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/nvim/textformat.c b/src/nvim/textformat.c index 06b3aa0411..b3b9cc6b44 100644 --- a/src/nvim/textformat.c +++ b/src/nvim/textformat.c @@ -35,6 +35,7 @@ #include "nvim/strings.h" #include "nvim/textformat.h" #include "nvim/textobject.h" +#include "nvim/ui.h" #include "nvim/undo.h" #include "nvim/vim_defs.h" #include "nvim/window.h" @@ -1049,12 +1050,18 @@ void format_lines(linenr_T line_count, bool avoid_fex) 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 shape may have been updated (e.g. by :normal) in insertchar(), + // so it needs to be updated here. + ui_cursor_shape(); + second_indent = -1; // at end of par.: need to set indent of next par. need_set_indent = is_end_par; -- cgit