Skip to content

Commit c020042

Browse files
committed
patch 7.4.1753
Problem: "noinsert" in 'completeopt' is sometimes ignored. Solution: Set the variables when the 'completeopt' was set. (Ozaki Kiichi)
1 parent 8d8aa0a commit c020042

4 files changed

Lines changed: 20 additions & 7 deletions

File tree

src/edit.c

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2760,6 +2760,21 @@ ins_compl_make_cyclic(void)
27602760
return count;
27612761
}
27622762

2763+
/*
2764+
* Set variables that store noselect and noinsert behavior from the
2765+
* 'completeopt' value.
2766+
*/
2767+
void
2768+
completeopt_was_set()
2769+
{
2770+
compl_no_insert = FALSE;
2771+
compl_no_select = FALSE;
2772+
if (strstr((char *)p_cot, "noselect") != NULL)
2773+
compl_no_select = TRUE;
2774+
if (strstr((char *)p_cot, "noinsert") != NULL)
2775+
compl_no_insert = TRUE;
2776+
}
2777+
27632778
/*
27642779
* Start completion for the complete() function.
27652780
* "startcol" is where the matched text starts (1 is first column).
@@ -3675,13 +3690,6 @@ ins_compl_prep(int c)
36753690

36763691
}
36773692

3678-
compl_no_insert = FALSE;
3679-
compl_no_select = FALSE;
3680-
if (strstr((char *)p_cot, "noselect") != NULL)
3681-
compl_no_select = TRUE;
3682-
if (strstr((char *)p_cot, "noinsert") != NULL)
3683-
compl_no_insert = TRUE;
3684-
36853693
if (ctrl_x_mode == CTRL_X_NOT_DEFINED_YET)
36863694
{
36873695
/*

src/option.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6951,6 +6951,8 @@ did_set_string_option(
69516951
{
69526952
if (check_opt_strings(p_cot, p_cot_values, TRUE) != OK)
69536953
errmsg = e_invarg;
6954+
else
6955+
completeopt_was_set();
69546956
}
69556957
#endif /* FEAT_INS_EXPAND */
69566958

src/proto/edit.pro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ void truncate_spaces(char_u *line);
88
void backspace_until_column(int col);
99
int vim_is_ctrl_x_key(int c);
1010
int ins_compl_add_infercase(char_u *str, int len, int icase, char_u *fname, int dir, int flags);
11+
void completeopt_was_set(void);
1112
void set_completion(colnr_T startcol, list_T *list);
1213
void ins_compl_show_pum(void);
1314
char_u *find_word_start(char_u *ptr);

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,8 @@ static char *(features[]) =
748748

749749
static int included_patches[] =
750750
{ /* Add new patch number below this line */
751+
/**/
752+
1753,
751753
/**/
752754
1752,
753755
/**/

0 commit comments

Comments
 (0)