Patch 8.1.1903
Problem: Cannot build without the +eval feature.
Solution: Add missing #ifdefs
Files: src/insexpand.c, src/popupmnu.c
*** ../vim-8.1.1902/src/insexpand.c 2019-08-21 14:36:29.387376100 +0200
--- src/insexpand.c 2019-08-21 15:28:43.232610801 +0200
***************
*** 62,67 ****
--- 62,68 ----
NULL, // CTRL_X_EVAL doesn't use msg.
};
+ #if defined(FEAT_COMPL_FUNC) || defined(FEAT_EVAL)
static char *ctrl_x_mode_names[] = {
"keyword",
"ctrl_x",
***************
*** 81,86 ****
--- 82,88 ----
NULL, // CTRL_X_LOCAL_MSG only used in "ctrl_x_msgs"
"eval"
};
+ #endif
/*
* Array indexes used for cp_text[].
***************
*** 191,197 ****
static void ins_compl_files(int count, char_u **files, int thesaurus, int
flags, regmatch_T *regmatch, char_u *buf, int *dir);
static char_u *find_line_end(char_u *ptr);
static void ins_compl_free(void);
- static char_u *ins_compl_mode(void);
static int ins_compl_need_restart(void);
static void ins_compl_new_leader(void);
static int ins_compl_len(void);
--- 193,198 ----
***************
*** 202,208 ****
static void ins_compl_add_list(list_T *list);
static void ins_compl_add_dict(dict_T *dict);
# endif
- static dict_T *ins_compl_dict_alloc(compl_T *match);
static int ins_compl_key2dir(int c);
static int ins_compl_pum_key(int c);
static int ins_compl_key2count(int c);
--- 203,208 ----
***************
*** 851,913 ****
compl_no_insert = TRUE;
}
- /*
- * Start completion for the complete() function.
- * "startcol" is where the matched text starts (1 is first column).
- * "list" is the list of matches.
- */
- static void
- set_completion(colnr_T startcol, list_T *list)
- {
- int save_w_wrow = curwin->w_wrow;
- int save_w_leftcol = curwin->w_leftcol;
- int flags = CP_ORIGINAL_TEXT;
-
- // If already doing completions stop it.
- if (ctrl_x_mode != CTRL_X_NORMAL)
- ins_compl_prep(' ');
- ins_compl_clear();
- ins_compl_free();
-
- compl_direction = FORWARD;
- if (startcol > curwin->w_cursor.col)
- startcol = curwin->w_cursor.col;
- compl_col = startcol;
- compl_length = (int)curwin->w_cursor.col - (int)startcol;
- // compl_pattern doesn't need to be set
- compl_orig_text = vim_strnsave(ml_get_curline() + compl_col,
compl_length);
- if (p_ic)
- flags |= CP_ICASE;
- if (compl_orig_text == NULL || ins_compl_add(compl_orig_text,
- -1, NULL, NULL, 0, flags, FALSE) != OK)
- return;
-
- ctrl_x_mode = CTRL_X_EVAL;
-
- ins_compl_add_list(list);
- compl_matches = ins_compl_make_cyclic();
- compl_started = TRUE;
- compl_used_match = TRUE;
- compl_cont_status = 0;
-
- compl_curr_match = compl_first_match;
- if (compl_no_insert || compl_no_select)
- {
- ins_complete(K_DOWN, FALSE);
- if (compl_no_select)
- // Down/Up has no real effect.
- ins_complete(K_UP, FALSE);
- }
- else
- ins_complete(Ctrl_N, FALSE);
- compl_enter_selects = compl_no_insert;
-
- // Lazily show the popup menu, unless we got interrupted.
- if (!compl_interrupted)
- show_pum(save_w_wrow, save_w_leftcol);
- out_flush();
- }
-
// "compl_match_array" points the currently displayed list of entries in the
// popup menu. It is NULL when there is no popup menu.
--- 851,856 ----
***************
*** 992,997 ****
--- 935,962 ----
return (i >= 2);
}
+ #ifdef FEAT_EVAL
+ /*
+ * Allocate Dict for the completed item.
+ * { word, abbr, menu, kind, info }
+ */
+ static dict_T *
+ ins_compl_dict_alloc(compl_T *match)
+ {
+ dict_T *dict = dict_alloc_lock(VAR_FIXED);
+
+ if (dict != NULL)
+ {
+ dict_add_string(dict, "word", match->cp_str);
+ dict_add_string(dict, "abbr", match->cp_text[CPT_ABBR]);
+ dict_add_string(dict, "menu", match->cp_text[CPT_MENU]);
+ dict_add_string(dict, "kind", match->cp_text[CPT_KIND]);
+ dict_add_string(dict, "info", match->cp_text[CPT_INFO]);
+ dict_add_string(dict, "user_data", match->cp_text[CPT_USER_DATA]);
+ }
+ return dict;
+ }
+
static void
trigger_complete_changed_event(int cur)
{
***************
*** 1022,1027 ****
--- 987,993 ----
dict_free_contents(v_event);
hash_init(&v_event->dv_hashtab);
}
+ #endif
/*
* Show the popup menu for the list of matches.
***************
*** 1164,1171 ****
--- 1130,1139 ----
pum_display(compl_match_array, compl_match_arraysize, cur);
curwin->w_cursor.col = col;
+ #ifdef FEAT_EVAL
if (has_completechanged())
trigger_complete_changed_event(cur);
+ #endif
}
}
***************
*** 1503,1510 ****
--- 1471,1480 ----
edit_submode_extra = NULL;
VIM_CLEAR(compl_orig_text);
compl_enter_selects = FALSE;
+ #ifdef FEAT_EVAL
// clear v:completed_item
set_vim_var_dict(VV_COMPLETED_ITEM, dict_alloc_lock(VAR_FIXED));
+ #endif
}
/*
***************
*** 1517,1623 ****
}
/*
- * Get complete information
- */
- static void
- get_complete_info(list_T *what_list, dict_T *retdict)
- {
- int ret = OK;
- listitem_T *item;
- #define CI_WHAT_MODE 0x01
- #define CI_WHAT_PUM_VISIBLE 0x02
- #define CI_WHAT_ITEMS 0x04
- #define CI_WHAT_SELECTED 0x08
- #define CI_WHAT_INSERTED 0x10
- #define CI_WHAT_ALL 0xff
- int what_flag;
-
- if (what_list == NULL)
- what_flag = CI_WHAT_ALL;
- else
- {
- what_flag = 0;
- for (item = what_list->lv_first; item != NULL; item = item->li_next)
- {
- char_u *what = tv_get_string(&item->li_tv);
-
- if (STRCMP(what, "mode") == 0)
- what_flag |= CI_WHAT_MODE;
- else if (STRCMP(what, "pum_visible") == 0)
- what_flag |= CI_WHAT_PUM_VISIBLE;
- else if (STRCMP(what, "items") == 0)
- what_flag |= CI_WHAT_ITEMS;
- else if (STRCMP(what, "selected") == 0)
- what_flag |= CI_WHAT_SELECTED;
- else if (STRCMP(what, "inserted") == 0)
- what_flag |= CI_WHAT_INSERTED;
- }
- }
-
- if (ret == OK && (what_flag & CI_WHAT_MODE))
- ret = dict_add_string(retdict, "mode", ins_compl_mode());
-
- if (ret == OK && (what_flag & CI_WHAT_PUM_VISIBLE))
- ret = dict_add_number(retdict, "pum_visible", pum_visible());
-
- if (ret == OK && (what_flag & CI_WHAT_ITEMS))
- {
- list_T *li;
- dict_T *di;
- compl_T *match;
-
- li = list_alloc();
- if (li == NULL)
- return;
- ret = dict_add_list(retdict, "items", li);
- if (ret == OK && compl_first_match != NULL)
- {
- match = compl_first_match;
- do
- {
- if (!(match->cp_flags & CP_ORIGINAL_TEXT))
- {
- di = dict_alloc();
- if (di == NULL)
- return;
- ret = list_append_dict(li, di);
- if (ret != OK)
- return;
- dict_add_string(di, "word", match->cp_str);
- dict_add_string(di, "abbr", match->cp_text[CPT_ABBR]);
- dict_add_string(di, "menu", match->cp_text[CPT_MENU]);
- dict_add_string(di, "kind", match->cp_text[CPT_KIND]);
- dict_add_string(di, "info", match->cp_text[CPT_INFO]);
- dict_add_string(di, "user_data",
- match->cp_text[CPT_USER_DATA]);
- }
- match = match->cp_next;
- }
- while (match != NULL && match != compl_first_match);
- }
- }
-
- if (ret == OK && (what_flag & CI_WHAT_SELECTED))
- ret = dict_add_number(retdict, "selected", (compl_curr_match != NULL) ?
- compl_curr_match->cp_number - 1 : -1);
-
- // TODO
- // if (ret == OK && (what_flag & CI_WHAT_INSERTED))
- }
-
- /*
- * Return Insert completion mode name string
- */
- static char_u *
- ins_compl_mode(void)
- {
- if (ctrl_x_mode == CTRL_X_NOT_DEFINED_YET || compl_started)
- return (char_u *)ctrl_x_mode_names[ctrl_x_mode & ~CTRL_X_WANT_IDENT];
-
- return (char_u *)"";
- }
-
- /*
* Selected one of the matches. When FALSE the match was edited or using the
* longest common string.
*/
--- 1487,1492 ----
***************
*** 1927,1933 ****
--- 1796,1804 ----
ins_compl_prep(int c)
{
char_u *ptr;
+ #ifdef FEAT_CINDENT
int want_cindent;
+ #endif
int retval = FALSE;
// Forget any previous 'special' messages if this is actually
***************
*** 2475,2480 ****
--- 2346,2408 ----
}
/*
+ * Start completion for the complete() function.
+ * "startcol" is where the matched text starts (1 is first column).
+ * "list" is the list of matches.
+ */
+ static void
+ set_completion(colnr_T startcol, list_T *list)
+ {
+ int save_w_wrow = curwin->w_wrow;
+ int save_w_leftcol = curwin->w_leftcol;
+ int flags = CP_ORIGINAL_TEXT;
+
+ // If already doing completions stop it.
+ if (ctrl_x_mode != CTRL_X_NORMAL)
+ ins_compl_prep(' ');
+ ins_compl_clear();
+ ins_compl_free();
+
+ compl_direction = FORWARD;
+ if (startcol > curwin->w_cursor.col)
+ startcol = curwin->w_cursor.col;
+ compl_col = startcol;
+ compl_length = (int)curwin->w_cursor.col - (int)startcol;
+ // compl_pattern doesn't need to be set
+ compl_orig_text = vim_strnsave(ml_get_curline() + compl_col,
compl_length);
+ if (p_ic)
+ flags |= CP_ICASE;
+ if (compl_orig_text == NULL || ins_compl_add(compl_orig_text,
+ -1, NULL, NULL, 0, flags, FALSE) != OK)
+ return;
+
+ ctrl_x_mode = CTRL_X_EVAL;
+
+ ins_compl_add_list(list);
+ compl_matches = ins_compl_make_cyclic();
+ compl_started = TRUE;
+ compl_used_match = TRUE;
+ compl_cont_status = 0;
+
+ compl_curr_match = compl_first_match;
+ if (compl_no_insert || compl_no_select)
+ {
+ ins_complete(K_DOWN, FALSE);
+ if (compl_no_select)
+ // Down/Up has no real effect.
+ ins_complete(K_UP, FALSE);
+ }
+ else
+ ins_complete(Ctrl_N, FALSE);
+ compl_enter_selects = compl_no_insert;
+
+ // Lazily show the popup menu, unless we got interrupted.
+ if (!compl_interrupted)
+ show_pum(save_w_wrow, save_w_leftcol);
+ out_flush();
+ }
+
+ /*
* "complete()" function
*/
void
***************
*** 2530,2535 ****
--- 2458,2564 ----
}
/*
+ * Return Insert completion mode name string
+ */
+ static char_u *
+ ins_compl_mode(void)
+ {
+ if (ctrl_x_mode == CTRL_X_NOT_DEFINED_YET || compl_started)
+ return (char_u *)ctrl_x_mode_names[ctrl_x_mode & ~CTRL_X_WANT_IDENT];
+
+ return (char_u *)"";
+ }
+
+ /*
+ * Get complete information
+ */
+ static void
+ get_complete_info(list_T *what_list, dict_T *retdict)
+ {
+ int ret = OK;
+ listitem_T *item;
+ #define CI_WHAT_MODE 0x01
+ #define CI_WHAT_PUM_VISIBLE 0x02
+ #define CI_WHAT_ITEMS 0x04
+ #define CI_WHAT_SELECTED 0x08
+ #define CI_WHAT_INSERTED 0x10
+ #define CI_WHAT_ALL 0xff
+ int what_flag;
+
+ if (what_list == NULL)
+ what_flag = CI_WHAT_ALL;
+ else
+ {
+ what_flag = 0;
+ for (item = what_list->lv_first; item != NULL; item = item->li_next)
+ {
+ char_u *what = tv_get_string(&item->li_tv);
+
+ if (STRCMP(what, "mode") == 0)
+ what_flag |= CI_WHAT_MODE;
+ else if (STRCMP(what, "pum_visible") == 0)
+ what_flag |= CI_WHAT_PUM_VISIBLE;
+ else if (STRCMP(what, "items") == 0)
+ what_flag |= CI_WHAT_ITEMS;
+ else if (STRCMP(what, "selected") == 0)
+ what_flag |= CI_WHAT_SELECTED;
+ else if (STRCMP(what, "inserted") == 0)
+ what_flag |= CI_WHAT_INSERTED;
+ }
+ }
+
+ if (ret == OK && (what_flag & CI_WHAT_MODE))
+ ret = dict_add_string(retdict, "mode", ins_compl_mode());
+
+ if (ret == OK && (what_flag & CI_WHAT_PUM_VISIBLE))
+ ret = dict_add_number(retdict, "pum_visible", pum_visible());
+
+ if (ret == OK && (what_flag & CI_WHAT_ITEMS))
+ {
+ list_T *li;
+ dict_T *di;
+ compl_T *match;
+
+ li = list_alloc();
+ if (li == NULL)
+ return;
+ ret = dict_add_list(retdict, "items", li);
+ if (ret == OK && compl_first_match != NULL)
+ {
+ match = compl_first_match;
+ do
+ {
+ if (!(match->cp_flags & CP_ORIGINAL_TEXT))
+ {
+ di = dict_alloc();
+ if (di == NULL)
+ return;
+ ret = list_append_dict(li, di);
+ if (ret != OK)
+ return;
+ dict_add_string(di, "word", match->cp_str);
+ dict_add_string(di, "abbr", match->cp_text[CPT_ABBR]);
+ dict_add_string(di, "menu", match->cp_text[CPT_MENU]);
+ dict_add_string(di, "kind", match->cp_text[CPT_KIND]);
+ dict_add_string(di, "info", match->cp_text[CPT_INFO]);
+ dict_add_string(di, "user_data",
+ match->cp_text[CPT_USER_DATA]);
+ }
+ match = match->cp_next;
+ }
+ while (match != NULL && match != compl_first_match);
+ }
+ }
+
+ if (ret == OK && (what_flag & CI_WHAT_SELECTED))
+ ret = dict_add_number(retdict, "selected", (compl_curr_match != NULL) ?
+ compl_curr_match->cp_number - 1 : -1);
+
+ // TODO
+ // if (ret == OK && (what_flag & CI_WHAT_INSERTED))
+ }
+
+ /*
* "complete_info()" function
*/
void
***************
*** 3041,3048 ****
--- 3070,3079 ----
// TODO: is this sufficient for redrawing? Redrawing everything causes
// flicker, thus we can't do that.
changed_cline_bef_curs();
+ #ifdef FEAT_EVAL
// clear v:completed_item
set_vim_var_dict(VV_COMPLETED_ITEM, dict_alloc_lock(VAR_FIXED));
+ #endif
}
/*
***************
*** 3052,3089 ****
void
ins_compl_insert(int in_compl_func)
{
- dict_T *dict;
-
ins_bytes(compl_shown_match->cp_str + ins_compl_len());
if (compl_shown_match->cp_flags & CP_ORIGINAL_TEXT)
compl_used_match = FALSE;
else
compl_used_match = TRUE;
! dict = ins_compl_dict_alloc(compl_shown_match);
! set_vim_var_dict(VV_COMPLETED_ITEM, dict);
! if (!in_compl_func)
! compl_curr_match = compl_shown_match;
! }
!
! /*
! * Allocate Dict for the completed item.
! * { word, abbr, menu, kind, info }
! */
! static dict_T *
! ins_compl_dict_alloc(compl_T *match)
! {
! dict_T *dict = dict_alloc_lock(VAR_FIXED);
!
! if (dict != NULL)
{
! dict_add_string(dict, "word", match->cp_str);
! dict_add_string(dict, "abbr", match->cp_text[CPT_ABBR]);
! dict_add_string(dict, "menu", match->cp_text[CPT_MENU]);
! dict_add_string(dict, "kind", match->cp_text[CPT_KIND]);
! dict_add_string(dict, "info", match->cp_text[CPT_INFO]);
! dict_add_string(dict, "user_data", match->cp_text[CPT_USER_DATA]);
}
! return dict;
}
/*
--- 3083,3102 ----
void
ins_compl_insert(int in_compl_func)
{
ins_bytes(compl_shown_match->cp_str + ins_compl_len());
if (compl_shown_match->cp_flags & CP_ORIGINAL_TEXT)
compl_used_match = FALSE;
else
compl_used_match = TRUE;
! #ifdef FEAT_EVAL
{
! dict_T *dict = ins_compl_dict_alloc(compl_shown_match);
!
! set_vim_var_dict(VV_COMPLETED_ITEM, dict);
}
! #endif
! if (!in_compl_func)
! compl_curr_match = compl_shown_match;
}
/*
***************
*** 3477,3483 ****
--- 3490,3498 ----
int save_w_wrow;
int save_w_leftcol;
int insert_match;
+ #ifdef FEAT_COMPL_FUNC
int save_did_ai = did_ai;
+ #endif
int flags = CP_ORIGINAL_TEXT;
compl_direction = ins_compl_key2dir(c);
*** ../vim-8.1.1902/src/popupmnu.c 2019-08-21 15:13:24.565040301 +0200
--- src/popupmnu.c 2019-08-21 15:29:26.296374624 +0200
***************
*** 632,638 ****
* must be recomputed.
*/
static int
! pum_set_selected(int n, int repeat)
{
int resized = FALSE;
int context = pum_height / 2;
--- 632,638 ----
* must be recomputed.
*/
static int
! pum_set_selected(int n, int repeat UNUSED)
{
int resized = FALSE;
int context = pum_height / 2;
***************
*** 996,1001 ****
--- 996,1002 ----
return pum_height;
}
+ #if defined(FEAT_EVAL) || defined(PROTO)
/*
* Add size information about the pum to "dict".
*/
***************
*** 1011,1016 ****
--- 1012,1018 ----
dict_add_number(dict, "size", pum_size);
dict_add_special(dict, "scrollbar", pum_scrollbar ? VVAL_TRUE :
VVAL_FALSE);
}
+ #endif
#if defined(FEAT_BEVAL_TERM) || defined(FEAT_TERM_POPUP_MENU) ||
defined(PROTO)
static void
*** ../vim-8.1.1902/src/version.c 2019-08-21 15:13:24.569040281 +0200
--- src/version.c 2019-08-21 15:21:18.122900177 +0200
***************
*** 763,764 ****
--- 763,766 ----
{ /* Add new patch number below this line */
+ /**/
+ 1903,
/**/
--
Bare feet magnetize sharp metal objects so they point upward from the
floor -- especially in the dark.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/201908211331.x7LDVA1Z017849%40masaka.moolenaar.net.