mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
commit
30cb66e8ba
@ -19,6 +19,9 @@
|
|||||||
#define MB_BYTE2LEN(b) utf8len_tab[b]
|
#define MB_BYTE2LEN(b) utf8len_tab[b]
|
||||||
#define MB_BYTE2LEN_CHECK(b) (((b) < 0 || (b) > 255) ? 1 : utf8len_tab[b])
|
#define MB_BYTE2LEN_CHECK(b) (((b) < 0 || (b) > 255) ? 1 : utf8len_tab[b])
|
||||||
|
|
||||||
|
// max length of an unicode char
|
||||||
|
#define MB_MAXCHAR 6
|
||||||
|
|
||||||
/* properties used in enc_canon_table[] (first three mutually exclusive) */
|
/* properties used in enc_canon_table[] (first three mutually exclusive) */
|
||||||
#define ENC_8BIT 0x01
|
#define ENC_8BIT 0x01
|
||||||
#define ENC_DBCS 0x02
|
#define ENC_DBCS 0x02
|
||||||
|
@ -666,8 +666,6 @@ static void free_menu_string(vimmenu_T *menu, int idx)
|
|||||||
static dict_T *menu_get_recursive(const vimmenu_T *menu, int modes)
|
static dict_T *menu_get_recursive(const vimmenu_T *menu, int modes)
|
||||||
{
|
{
|
||||||
dict_T *dict;
|
dict_T *dict;
|
||||||
char buf[sizeof(menu->mnemonic)];
|
|
||||||
int mnemonic_len;
|
|
||||||
|
|
||||||
if (!menu || (menu->modes & modes) == 0x0) {
|
if (!menu || (menu->modes & modes) == 0x0) {
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -679,8 +677,8 @@ static dict_T *menu_get_recursive(const vimmenu_T *menu, int modes)
|
|||||||
tv_dict_add_nr(dict, S_LEN("hidden"), menu_is_hidden(menu->dname));
|
tv_dict_add_nr(dict, S_LEN("hidden"), menu_is_hidden(menu->dname));
|
||||||
|
|
||||||
if (menu->mnemonic) {
|
if (menu->mnemonic) {
|
||||||
mnemonic_len = utf_char2bytes(menu->mnemonic, (u_char *)buf);
|
char buf[MB_MAXCHAR + 1] = { 0 }; // > max value of utf8_char2bytes
|
||||||
buf[mnemonic_len] = '\0';
|
utf_char2bytes(menu->mnemonic, (char_u *)buf);
|
||||||
tv_dict_add_str(dict, S_LEN("shortcut"), buf);
|
tv_dict_add_str(dict, S_LEN("shortcut"), buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -717,7 +715,7 @@ static dict_T *menu_get_recursive(const vimmenu_T *menu, int modes)
|
|||||||
list_T *children_list = tv_list_alloc();
|
list_T *children_list = tv_list_alloc();
|
||||||
for (menu = menu->children; menu != NULL; menu = menu->next) {
|
for (menu = menu->children; menu != NULL; menu = menu->next) {
|
||||||
dict_T *dic = menu_get_recursive(menu, modes);
|
dict_T *dic = menu_get_recursive(menu, modes);
|
||||||
if (dict && tv_dict_len(dict) > 0) {
|
if (tv_dict_len(dict) > 0) {
|
||||||
tv_list_append_dict(children_list, dic);
|
tv_list_append_dict(children_list, dic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user