diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-05-14 20:48:05 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-14 20:48:05 +0800 |
commit | d547e21f9edfb600c8a55a23db1ad847d35b53a0 (patch) | |
tree | 7e3015b0c62bc523f8171c905caffea99b6903d8 /src/nvim/edit.c | |
parent | 99f3e74fc27acb0d9d9f32161e18b5a474697074 (diff) | |
parent | dca0412d378131ca6c8a64f7adb8937493c43883 (diff) | |
download | rneovim-d547e21f9edfb600c8a55a23db1ad847d35b53a0.tar.gz rneovim-d547e21f9edfb600c8a55a23db1ad847d35b53a0.tar.bz2 rneovim-d547e21f9edfb600c8a55a23db1ad847d35b53a0.zip |
Merge pull request #18567 from zeertzjq/vim-8.2.4951
vim-patch:8.2.{4951,4953}: with 'si' inserting char after completion goes wrong
Diffstat (limited to 'src/nvim/edit.c')
-rw-r--r-- | src/nvim/edit.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c index c2e61271c7..215024f63a 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) @@ -9344,10 +9344,8 @@ static void ins_try_si(int c) /* * do some very smart indenting when entering '{' or '}' */ - if (((did_si || can_si_back) && c == '{') || (can_si && c == '}')) { - /* - * for '}' set indent equal to indent of line containing matching '{' - */ + if (((did_si || can_si_back) && c == '{') || (can_si && c == '}' && inindent(0))) { + // for '}' set indent equal to indent of line containing matching '{' if (c == '}' && (pos = findmatch(NULL, '{')) != NULL) { old_pos = curwin->w_cursor; /* @@ -9403,7 +9401,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); |