summaryrefslogtreecommitdiffstats
path: root/src/edit.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-12-29 16:05:31 +0000
committerBram Moolenaar <Bram@vim.org>2021-12-29 16:05:31 +0000
commit5d20fbf2e79b96a39abbdadc486b656cdcc67ed6 (patch)
tree2601a6a32e62402ba28471be2175d67f8e2e339d /src/edit.c
parent5ea5f373729589acb38ce3f3ca338e8a6d398bdc (diff)
patch 8.2.3935: CTRL-U in Insert mode does not fix the indentv8.2.3935
Problem: CTRL-U in Insert mode does not fix the indent. Solution: Fix the indent when 'cindent' is set.
Diffstat (limited to 'src/edit.c')
-rw-r--r--src/edit.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/edit.c b/src/edit.c
index f4e9327b6d..bccf3194db 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -3980,6 +3980,9 @@ ins_bs(
int in_indent;
int oldState;
int cpc[MAX_MCO]; // composing characters
+#if defined(FEAT_LISP) || defined(FEAT_CINDENT)
+ int call_fix_indent = FALSE;
+#endif
/*
* can't delete anything in an empty file
@@ -4161,7 +4164,13 @@ ins_bs(
save_col = curwin->w_cursor.col;
beginline(BL_WHITE);
if (curwin->w_cursor.col < save_col)
+ {
mincol = curwin->w_cursor.col;
+#if defined(FEAT_LISP) || defined(FEAT_CINDENT)
+ // should now fix the indent to match with the previous line
+ call_fix_indent = TRUE;
+#endif
+ }
curwin->w_cursor.col = save_col;
}
@@ -4333,6 +4342,12 @@ ins_bs(
#endif
if (curwin->w_cursor.col <= 1)
did_ai = FALSE;
+
+#if defined(FEAT_LISP) || defined(FEAT_CINDENT)
+ if (call_fix_indent)
+ fix_indent();
+#endif
+
/*
* It's a little strange to put backspaces into the redo
* buffer, but it makes auto-indent a lot easier to deal