aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/normal.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index aeada66964..0293bb4a73 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -1847,13 +1847,12 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
CancelRedo();
} else {
(void)op_delete(oap);
- if (oap->motion_type == kMTLineWise && has_format_option(FO_AUTO)) {
- // cursor line wasn't saved yet
- if (u_save_cursor() == FAIL) {
- break;
- }
+ // save cursor line for undo if it wasn't saved yet
+ if (oap->motion_type == kMTLineWise
+ && has_format_option(FO_AUTO)
+ && u_save_cursor() == OK) {
+ auto_format(false, true);
}
- auto_format(false, true);
}
break;