aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ops.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/ops.c')
-rw-r--r--src/nvim/ops.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index cc67b0d0c1..0bcc5ecd0e 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -4349,6 +4349,9 @@ static void op_format(oparg_T *oap, int keep_cursor)
if (keep_cursor) {
curwin->w_cursor = saved_cursor;
saved_cursor.lnum = 0;
+
+ // formatting may have made the cursor position invalid
+ check_cursor();
}
if (oap->is_VIsual) {