diff options
-rwxr-xr-x | src/clint.py | 2 | ||||
-rw-r--r-- | src/nvim/edit.c | 64 | ||||
-rw-r--r-- | src/nvim/eval.c | 3 |
3 files changed, 36 insertions, 33 deletions
diff --git a/src/clint.py b/src/clint.py index 1ef31820ee..6643d8956a 100755 --- a/src/clint.py +++ b/src/clint.py @@ -3246,7 +3246,7 @@ def CheckLanguage(filename, clean_lines, linenum, file_extension, r'|li_(?:next|prev|tv))\b', line) if match: error(filename, linenum, 'runtime/deprecated', 4, - 'Accessing list_T internals directly is prohibited') + 'Accessing list_T internals directly is prohibited (hint: see commit d46e37cb4c71)') # Check for suspicious usage of "if" like # } if (a == b) { diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 5304edb223..ad7a507ba0 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -87,15 +87,15 @@ // Message for CTRL-X mode, index is ctrl_x_mode. static char *ctrl_x_msgs[] = { - N_(" Keyword completion (^N^P)"), // CTRL_X_NORMAL, ^P/^N compl. + N_(" Keyword completion (^N^P)"), // CTRL_X_NORMAL, ^P/^N compl. N_(" ^X mode (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)"), - NULL, // CTRL_X_SCROLL: depends on state + NULL, // CTRL_X_SCROLL: depends on state N_(" Whole line completion (^L^N^P)"), N_(" File name completion (^F^N^P)"), N_(" Tag completion (^]^N^P)"), N_(" Path pattern completion (^N^P)"), N_(" Definition completion (^D^N^P)"), - NULL, // CTRL_X_FINISHED + NULL, // CTRL_X_FINISHED N_(" Dictionary completion (^K^N^P)"), N_(" Thesaurus completion (^T^N^P)"), N_(" Command-line completion (^V^N^P)"), @@ -3006,38 +3006,41 @@ bool ins_compl_active(void) 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 +#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 = (char_u *)tv_get_string(&item->li_tv); + for (listitem_T *item = TV_LIST_ITEM_NEXT(what_list, + tv_list_first(what_list)) + ; item != NULL + ; item = TV_LIST_ITEM_NEXT(what_list, item)) { + const char *what = tv_get_string(TV_LIST_ITEM_TV(item)); - if (STRCMP(what, "mode") == 0) + if (STRCMP(what, "mode") == 0) { what_flag |= CI_WHAT_MODE; - else if (STRCMP(what, "pum_visible") == 0) + } else if (STRCMP(what, "pum_visible") == 0) { what_flag |= CI_WHAT_PUM_VISIBLE; - else if (STRCMP(what, "items") == 0) + } else if (STRCMP(what, "items") == 0) { what_flag |= CI_WHAT_ITEMS; - else if (STRCMP(what, "selected") == 0) + } else if (STRCMP(what, "selected") == 0) { what_flag |= CI_WHAT_SELECTED; - else if (STRCMP(what, "inserted") == 0) + } else if (STRCMP(what, "inserted") == 0) { what_flag |= CI_WHAT_INSERTED; + } } } if (ret == OK && (what_flag & CI_WHAT_MODE)) { ret = tv_dict_add_str(retdict, S_LEN("mode"), - (const char *)ins_compl_mode()); + (const char *)ins_compl_mode()); } if (ret == OK && (what_flag & CI_WHAT_PUM_VISIBLE)) { @@ -3056,40 +3059,39 @@ void get_complete_info(list_T *what_list, dict_T *retdict) tv_list_append_dict(li, di); tv_dict_add_str(di, S_LEN("word"), - (const char *)match->cp_str); + (const char *)match->cp_str); tv_dict_add_str(di, S_LEN("abbr"), - (const char *)match->cp_text[CPT_ABBR]); + (const char *)match->cp_text[CPT_ABBR]); tv_dict_add_str(di, S_LEN("menu"), - (const char *)match->cp_text[CPT_MENU]); + (const char *)match->cp_text[CPT_MENU]); tv_dict_add_str(di, S_LEN("kind"), - (const char *)match->cp_text[CPT_KIND]); + (const char *)match->cp_text[CPT_KIND]); tv_dict_add_str(di, S_LEN("info"), - (const char *)match->cp_text[CPT_INFO]); + (const char *)match->cp_text[CPT_INFO]); tv_dict_add_str(di, S_LEN("user_data"), - (const char *)match->cp_text[CPT_USER_DATA]); + (const char *)match->cp_text[CPT_USER_DATA]); } match = match->cp_next; - } - while (match != NULL && match != compl_first_match); + } while (match != NULL && match != compl_first_match); } } if (ret == OK && (what_flag & CI_WHAT_SELECTED)) { ret = tv_dict_add_nr(retdict, S_LEN("selected"), - (compl_curr_match != NULL) ? - compl_curr_match->cp_number - 1 : -1); + (compl_curr_match != NULL) + ? compl_curr_match->cp_number - 1 : -1); } - // TODO + // TODO(vim): // 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) + 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 *)""; } diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 71e572cf7e..c324a9f1a2 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -7565,7 +7565,8 @@ static void f_complete_check(typval_T *argvars, typval_T *rettv, FunPtr fptr) } // "complete_info()" function -static void f_complete_info(typval_T *argvars, typval_T *rettv, FunPtr fptr) { +static void f_complete_info(typval_T *argvars, typval_T *rettv, FunPtr fptr) +{ tv_dict_alloc_ret(rettv); list_T *what_list = NULL; |