vim-patch: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

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
This commit is contained in:
zeertzjq
2022-11-14 11:23:33 +08:00
committed by GitHub
parent f2695919bb
commit 6d996f78ef

View File

@@ -242,7 +242,6 @@ static expand_T compl_xp;
// List of flags for method of completion. // List of flags for method of completion.
static int compl_cont_status = 0; static int compl_cont_status = 0;
#define CONT_ADDING 1 ///< "normal" or "adding" expansion #define CONT_ADDING 1 ///< "normal" or "adding" expansion
#define CONT_INTRPT (2 + 4) ///< a ^X interrupted the current expansion #define CONT_INTRPT (2 + 4) ///< a ^X interrupted the current expansion
///< it's set only iff N_ADDS is set ///< it's set only iff N_ADDS is set
@@ -422,7 +421,7 @@ void compl_status_clear(void)
compl_cont_status = 0; compl_cont_status = 0;
} }
// @return true if completion is using the forward direction matches /// @return true if completion is using the forward direction matches
static bool compl_dir_forward(void) static bool compl_dir_forward(void)
{ {
return compl_direction == FORWARD; return compl_direction == FORWARD;
@@ -3297,7 +3296,7 @@ static int ins_compl_get_exp(pos_T *ini)
assert(st.ins_buf != NULL); assert(st.ins_buf != NULL);
compl_old_match = compl_curr_match; // remember the last current match compl_old_match = compl_curr_match; // remember the last current match
st.cur_match_pos = (compl_dir_forward() ? &st.last_match_pos : &st.first_match_pos); st.cur_match_pos = compl_dir_forward() ? &st.last_match_pos : &st.first_match_pos;
// For ^N/^P loop over all the flags/windows/buffers in 'complete' // For ^N/^P loop over all the flags/windows/buffers in 'complete'
for (;;) { for (;;) {