To: vim-dev@vim.org Subject: Patch 6.0.159 Fcc: outbox From: Bram Moolenaar MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.0.159 Problem: Wildcard expansion for ":emenu" also shows separators. Solution: Skip menu separators for ":emenu", ":popup" and ":tearoff". Also, don't handle ":tmenu" as if it was ":tearoff". And leave out the alternatives with "&" included. Files: src/menu.c *** ../vim60.158/src/menu.c Tue Jan 15 16:37:40 2002 --- src/menu.c Wed Jan 30 21:43:51 2002 *************** *** 1160,1165 **** --- 1160,1166 ---- */ static vimmenu_T *expand_menu = NULL; static int expand_modes = 0x0; + static int expand_emenu; /* TRUE for ":emenu" command */ /* * Work out what to complete when doing command line completion of menu names. *************** *** 1211,1218 **** else if (*p == '.') after_dot = p + 1; } ! expand_menus = !(*cmd == 't' || *cmd == 'p'); ! if (expand_menus && vim_iswhite(*p)) return NULL; /* TODO: check for next command? */ if (*p == NUL) /* Complete the menu name */ { --- 1212,1222 ---- else if (*p == '.') after_dot = p + 1; } ! ! /* ":tearoff" and ":popup" only use menus, not entries */ ! expand_menus = !((*cmd == 't' && cmd[1] == 'e') || *cmd == 'p'); ! expand_emenu = (*cmd == 'e'); ! if (expand_menus && vim_iswhite(*p)) return NULL; /* TODO: check for next command? */ if (*p == NUL) /* Complete the menu name */ { *************** *** 1277,1283 **** } /* ! * Function given to ExpandGeneric() to obtain the list of group names. */ char_u * get_menu_name(xp, idx) --- 1281,1288 ---- } /* ! * Function given to ExpandGeneric() to obtain the list of (sub)menus (not ! * entries). */ char_u * get_menu_name(xp, idx) *************** *** 1285,1338 **** int idx; { static vimmenu_T *menu = NULL; - static int get_dname = FALSE; /* return menu->dname next time */ char_u *str; if (idx == 0) /* first call: start at first item */ - { menu = expand_menu; - get_dname = FALSE; - } /* Skip PopUp[nvoci]. */ while (menu != NULL && (menu_is_hidden(menu->dname) ! /* || menu_is_separator(menu->dname) */ || menu_is_tearoff(menu->dname) ! || (xp->xp_context == EXPAND_MENUS && menu->children == NULL))) menu = menu->next; if (menu == NULL) /* at end of linked list */ return NULL; if (menu->modes & expand_modes) ! { ! if (get_dname) ! { ! str = menu->dname; ! get_dname = FALSE; ! } ! else ! { ! str = menu->name; ! if (STRCMP(menu->name, menu->dname)) ! get_dname = TRUE; ! } ! } else - { str = (char_u *)""; - get_dname = FALSE; - } /* Advance to next menu entry. */ ! if (!get_dname) ! menu = menu->next; return str; } /* ! * Function given to ExpandGeneric() to obtain the list of group names. */ char_u * get_menu_names(xp, idx) --- 1290,1324 ---- int idx; { static vimmenu_T *menu = NULL; char_u *str; if (idx == 0) /* first call: start at first item */ menu = expand_menu; /* Skip PopUp[nvoci]. */ while (menu != NULL && (menu_is_hidden(menu->dname) ! || menu_is_separator(menu->dname) || menu_is_tearoff(menu->dname) ! || menu->children == NULL)) menu = menu->next; if (menu == NULL) /* at end of linked list */ return NULL; if (menu->modes & expand_modes) ! str = menu->dname; else str = (char_u *)""; /* Advance to next menu entry. */ ! menu = menu->next; return str; } /* ! * Function given to ExpandGeneric() to obtain the list of menus and menu ! * entries. */ char_u * get_menu_names(xp, idx) *************** *** 1348,1357 **** /* Skip Browse-style entries, popup menus and separators. */ while (menu != NULL ! && ( menu_is_hidden(menu->dname) ! /* || menu_is_separator(menu->dname) */ || menu_is_tearoff(menu->dname) - || (xp->xp_context == EXPAND_MENUS && menu->children == NULL) #ifndef FEAT_BROWSE || menu->dname[STRLEN(menu->dname) - 1] == '.' #endif --- 1334,1342 ---- /* Skip Browse-style entries, popup menus and separators. */ while (menu != NULL ! && ( menu_is_hidden(menu->dname) ! || (expand_emenu && menu_is_separator(menu->dname)) || menu_is_tearoff(menu->dname) #ifndef FEAT_BROWSE || menu->dname[STRLEN(menu->dname) - 1] == '.' #endif *** ../vim60.158/src/version.c Fri Feb 1 20:07:17 2002 --- src/version.c Fri Feb 1 20:01:23 2002 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 159, /**/ -- hundred-and-one symptoms of being an internet addict: 149. You find your computer sexier than your girlfriend /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ ((( Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim ))) \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///