aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/edit.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-05-14 18:55:50 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-05-14 20:05:39 +0800
commit24eb1af4754b3061d0968112342ca5389b68d4f6 (patch)
treef39bf17c2160fb95f32ae0d81dd7d90d66375180 /src/nvim/edit.c
parent99f3e74fc27acb0d9d9f32161e18b5a474697074 (diff)
downloadrneovim-24eb1af4754b3061d0968112342ca5389b68d4f6.tar.gz
rneovim-24eb1af4754b3061d0968112342ca5389b68d4f6.tar.bz2
rneovim-24eb1af4754b3061d0968112342ca5389b68d4f6.zip
vim-patch:8.2.4951: smart indenting done when not enabled
Problem: Smart indenting done when not enabled. Solution: Check option values before setting can_si. (closes vim/vim#10420) https://github.com/vim/vim/commit/de5cf287812510d2c8ffe66b99cf33c4e1a6e6f1
Diffstat (limited to 'src/nvim/edit.c')
-rw-r--r--src/nvim/edit.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index c2e61271c7..f2982aa187 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -1396,7 +1396,7 @@ static void insert_do_complete(InsertState *s)
compl_cont_status = 0;
}
compl_busy = false;
- can_si = true; // allow smartindenting
+ can_si = may_do_si(); // allow smartindenting
}
static void insert_do_cindent(InsertState *s)
@@ -9403,7 +9403,7 @@ static void ins_try_si(int c)
/*
* set indent of '#' always to 0
*/
- if (curwin->w_cursor.col > 0 && can_si && c == '#') {
+ if (curwin->w_cursor.col > 0 && can_si && c == '#' && inindent(0)) {
// remember current indent for next line
old_indent = get_indent();
(void)set_indent(0, SIN_CHANGED);