aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/textformat.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/textformat.c')
-rw-r--r--src/nvim/textformat.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/nvim/textformat.c b/src/nvim/textformat.c
index 06b3aa0411..ca2829fecb 100644
--- a/src/nvim/textformat.c
+++ b/src/nvim/textformat.c
@@ -18,6 +18,7 @@
#include "nvim/globals.h"
#include "nvim/indent.h"
#include "nvim/indent_c.h"
+#include "nvim/macros_defs.h"
#include "nvim/mark.h"
#include "nvim/mbyte.h"
#include "nvim/memline.h"
@@ -35,6 +36,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 +1051,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;