aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/edit.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-08-25 09:22:44 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-08-25 10:15:07 +0800
commitb1833bb33b49a26e7552548e3541ac1480fee452 (patch)
tree0eb53db012b149e0db32770473187f2bec10ce76 /src/nvim/edit.c
parent45d09b46cebe928693f708b777e8b11ad6ec2602 (diff)
downloadrneovim-b1833bb33b49a26e7552548e3541ac1480fee452.tar.gz
rneovim-b1833bb33b49a26e7552548e3541ac1480fee452.tar.bz2
rneovim-b1833bb33b49a26e7552548e3541ac1480fee452.zip
vim-patch:partial:8.2.4001: insert complete code uses global variables
Problem: Insert complete code uses global variables. Solution: Make variables local to the file and use accessor functions. (Yegappan Lakshmanan, closes vim/vim#9470) https://github.com/vim/vim/commit/d94fbfc74a8b8073e7a256c95fa6f39fc527c726 Skip changes in comments for callback-related functions (not ported). Also make compl_busy static again.
Diffstat (limited to 'src/nvim/edit.c')
-rw-r--r--src/nvim/edit.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index 545f3c0d9a..81a67b86c3 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -92,6 +92,10 @@ typedef struct insert_state {
#define BACKSPACE_WORD_NOT_SPACE 3
#define BACKSPACE_LINE 4
+/// Set when doing something for completion that may call edit() recursively,
+/// which is not allowed.
+static bool compl_busy = false;
+
static colnr_T Insstart_textlen; // length of line when insert started
static colnr_T Insstart_blank_vcol; // vcol for first inserted blank
static bool update_Insstart_orig = true; // set Insstart_orig to Insstart
@@ -1091,7 +1095,7 @@ check_pum:
// but it is under other ^X modes
if (*curbuf->b_p_cpt == NUL
&& (ctrl_x_mode_normal() || ctrl_x_mode_whole_line())
- && !(compl_cont_status & CONT_LOCAL)) {
+ && !compl_status_local()) {
goto normalchar;
}
@@ -1177,9 +1181,11 @@ normalchar:
static void insert_do_complete(InsertState *s)
{
compl_busy = true;
+ disable_fold_update++; // don't redraw folds here
if (ins_complete(s->c, true) == FAIL) {
- compl_cont_status = 0;
+ compl_status_clear();
}
+ disable_fold_update--;
compl_busy = false;
can_si = may_do_si(); // allow smartindenting
}