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)
d94fbfc74a

Skip changes in comments for callback-related functions (not ported).
Also make compl_busy static again.
This commit is contained in:
zeertzjq
2022-08-25 09:22:44 +08:00
parent 45d09b46ce
commit b1833bb33b
6 changed files with 160 additions and 106 deletions

View File

@@ -159,27 +159,6 @@ EXTERN colnr_T dollar_vcol INIT(= -1);
// Variables for Insert mode completion.
// Length in bytes of the text being completed (this is deleted to be replaced
// by the match.)
EXTERN int compl_length INIT(= 0);
// Set when doing something for completion that may call edit() recursively,
// which is not allowed. Also used to disable folding during completion
EXTERN bool compl_busy INIT(= false);
// List of flags for method of completion.
EXTERN int compl_cont_status INIT(= 0);
#define CONT_ADDING 1 // "normal" or "adding" expansion
#define CONT_INTRPT (2 + 4) // a ^X interrupted the current expansion
// it's set only iff N_ADDS is set
#define CONT_N_ADDS 4 // next ^X<> will add-new or expand-current
#define CONT_S_IPOS 8 // next ^X<> will set initial_pos?
// if so, word-wise-expansion will set SOL
#define CONT_SOL 16 // pattern includes start of line, just for
// word-wise expansion, not set for ^X^L
#define CONT_LOCAL 32 // for ctrl_x_mode 0, ^X^P/^X^N do a local
// expansion, (eg use complete=.)
EXTERN char_u *edit_submode INIT(= NULL); // msg for CTRL-X submode
EXTERN char_u *edit_submode_pre INIT(= NULL); // prepended to edit_submode
EXTERN char_u *edit_submode_extra INIT(= NULL); // appended to edit_submode