aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/edit.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-01-31 15:44:54 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-01-31 15:44:54 +0800
commitf7801fe138d9677c9333650b4d5581489d4b0613 (patch)
tree66e433894bec49313494ef31508e3d5e236d548b /src/nvim/edit.c
parentda3b04a9e07635bab9b0d67e9b16c62c1e59e004 (diff)
downloadrneovim-f7801fe138d9677c9333650b4d5581489d4b0613.tar.gz
rneovim-f7801fe138d9677c9333650b4d5581489d4b0613.tar.bz2
rneovim-f7801fe138d9677c9333650b4d5581489d4b0613.zip
vim-patch:8.2.3935: CTRL-U in Insert mode does not fix the indent
Problem: CTRL-U in Insert mode does not fix the indent. Solution: Fix the indent when 'cindent' is set. https://github.com/vim/vim/commit/5d20fbf2e79b96a39abbdadc486b656cdcc67ed6
Diffstat (limited to 'src/nvim/edit.c')
-rw-r--r--src/nvim/edit.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index 3d2cfa5c2a..f96e7261ca 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -8299,6 +8299,7 @@ static bool ins_bs(int c, int mode, int *inserted_space_p)
int in_indent;
int oldState;
int cpc[MAX_MCO]; // composing characters
+ bool call_fix_indent = false;
// can't delete anything in an empty file
// can't backup past first character in buffer
@@ -8442,6 +8443,8 @@ static bool ins_bs(int c, int mode, int *inserted_space_p)
beginline(BL_WHITE);
if (curwin->w_cursor.col < save_col) {
mincol = curwin->w_cursor.col;
+ // should now fix the indent to match with the previous line
+ call_fix_indent = true;
}
curwin->w_cursor.col = save_col;
}
@@ -8576,6 +8579,11 @@ static bool ins_bs(int c, int mode, int *inserted_space_p)
if (curwin->w_cursor.col <= 1) {
did_ai = false;
}
+
+ if (call_fix_indent) {
+ fix_indent();
+ }
+
// It's a little strange to put backspaces into the redo
// buffer, but it makes auto-indent a lot easier to deal
// with.