home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 6.0.159 < prev    next >
Encoding:
Internet Message Format  |  2002-01-31  |  5.1 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 6.0.159
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=ISO-8859-1
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 6.0.159
  11. Problem:    Wildcard expansion for ":emenu" also shows separators.
  12. Solution:   Skip menu separators for ":emenu", ":popup" and ":tearoff".
  13.         Also, don't handle ":tmenu" as if it was ":tearoff".  And leave
  14.         out the alternatives with "&" included.
  15. Files:        src/menu.c
  16.  
  17.  
  18. *** ../vim60.158/src/menu.c    Tue Jan 15 16:37:40 2002
  19. --- src/menu.c    Wed Jan 30 21:43:51 2002
  20. ***************
  21. *** 1160,1165 ****
  22. --- 1160,1166 ----
  23.    */
  24.   static vimmenu_T    *expand_menu = NULL;
  25.   static int        expand_modes = 0x0;
  26. + static int        expand_emenu;    /* TRUE for ":emenu" command */
  27.   
  28.   /*
  29.    * Work out what to complete when doing command line completion of menu names.
  30. ***************
  31. *** 1211,1218 ****
  32.       else if (*p == '.')
  33.           after_dot = p + 1;
  34.       }
  35. !     expand_menus = !(*cmd == 't' || *cmd == 'p');
  36. !     if (expand_menus  && vim_iswhite(*p))
  37.       return NULL;    /* TODO: check for next command? */
  38.       if (*p == NUL)        /* Complete the menu name */
  39.       {
  40. --- 1212,1222 ----
  41.       else if (*p == '.')
  42.           after_dot = p + 1;
  43.       }
  44. !     /* ":tearoff" and ":popup" only use menus, not entries */
  45. !     expand_menus = !((*cmd == 't' && cmd[1] == 'e') || *cmd == 'p');
  46. !     expand_emenu = (*cmd == 'e');
  47. !     if (expand_menus && vim_iswhite(*p))
  48.       return NULL;    /* TODO: check for next command? */
  49.       if (*p == NUL)        /* Complete the menu name */
  50.       {
  51. ***************
  52. *** 1277,1283 ****
  53.   }
  54.   
  55.   /*
  56. !  * Function given to ExpandGeneric() to obtain the list of group names.
  57.    */
  58.       char_u *
  59.   get_menu_name(xp, idx)
  60. --- 1281,1288 ----
  61.   }
  62.   
  63.   /*
  64. !  * Function given to ExpandGeneric() to obtain the list of (sub)menus (not
  65. !  * entries).
  66.    */
  67.       char_u *
  68.   get_menu_name(xp, idx)
  69. ***************
  70. *** 1285,1338 ****
  71.       int        idx;
  72.   {
  73.       static vimmenu_T    *menu = NULL;
  74. -     static int        get_dname = FALSE; /* return menu->dname next time */
  75.       char_u        *str;
  76.   
  77.       if (idx == 0)        /* first call: start at first item */
  78. -     {
  79.       menu = expand_menu;
  80. -     get_dname = FALSE;
  81. -     }
  82.   
  83.       /* Skip PopUp[nvoci]. */
  84.       while (menu != NULL && (menu_is_hidden(menu->dname)
  85. ! /*        || menu_is_separator(menu->dname) */
  86.           || menu_is_tearoff(menu->dname)
  87. !         || (xp->xp_context == EXPAND_MENUS && menu->children == NULL)))
  88.       menu = menu->next;
  89.   
  90.       if (menu == NULL)        /* at end of linked list */
  91.       return NULL;
  92.   
  93.       if (menu->modes & expand_modes)
  94. !     {
  95. !     if (get_dname)
  96. !     {
  97. !         str = menu->dname;
  98. !         get_dname = FALSE;
  99. !     }
  100. !     else
  101. !     {
  102. !         str = menu->name;
  103. !         if (STRCMP(menu->name, menu->dname))
  104. !         get_dname = TRUE;
  105. !     }
  106. !     }
  107.       else
  108. -     {
  109.       str = (char_u *)"";
  110. -     get_dname = FALSE;
  111. -     }
  112.   
  113.       /* Advance to next menu entry. */
  114. !     if (!get_dname)
  115. !     menu = menu->next;
  116.   
  117.       return str;
  118.   }
  119.   
  120.   /*
  121. !  * Function given to ExpandGeneric() to obtain the list of group names.
  122.    */
  123.       char_u *
  124.   get_menu_names(xp, idx)
  125. --- 1290,1324 ----
  126.       int        idx;
  127.   {
  128.       static vimmenu_T    *menu = NULL;
  129.       char_u        *str;
  130.   
  131.       if (idx == 0)        /* first call: start at first item */
  132.       menu = expand_menu;
  133.   
  134.       /* Skip PopUp[nvoci]. */
  135.       while (menu != NULL && (menu_is_hidden(menu->dname)
  136. !         || menu_is_separator(menu->dname)
  137.           || menu_is_tearoff(menu->dname)
  138. !         || menu->children == NULL))
  139.       menu = menu->next;
  140.   
  141.       if (menu == NULL)        /* at end of linked list */
  142.       return NULL;
  143.   
  144.       if (menu->modes & expand_modes)
  145. !     str = menu->dname;
  146.       else
  147.       str = (char_u *)"";
  148.   
  149.       /* Advance to next menu entry. */
  150. !     menu = menu->next;
  151.   
  152.       return str;
  153.   }
  154.   
  155.   /*
  156. !  * Function given to ExpandGeneric() to obtain the list of menus and menu
  157. !  * entries.
  158.    */
  159.       char_u *
  160.   get_menu_names(xp, idx)
  161. ***************
  162. *** 1348,1357 ****
  163.   
  164.       /* Skip Browse-style entries, popup menus and separators. */
  165.       while (menu != NULL
  166. !         && (  menu_is_hidden(menu->dname)
  167. ! /*        || menu_is_separator(menu->dname) */
  168.           || menu_is_tearoff(menu->dname)
  169. -         || (xp->xp_context == EXPAND_MENUS && menu->children == NULL)
  170.   #ifndef FEAT_BROWSE
  171.           || menu->dname[STRLEN(menu->dname) - 1] == '.'
  172.   #endif
  173. --- 1334,1342 ----
  174.   
  175.       /* Skip Browse-style entries, popup menus and separators. */
  176.       while (menu != NULL
  177. !         && (   menu_is_hidden(menu->dname)
  178. !         || (expand_emenu && menu_is_separator(menu->dname))
  179.           || menu_is_tearoff(menu->dname)
  180.   #ifndef FEAT_BROWSE
  181.           || menu->dname[STRLEN(menu->dname) - 1] == '.'
  182.   #endif
  183. *** ../vim60.158/src/version.c    Fri Feb  1 20:07:17 2002
  184. --- src/version.c    Fri Feb  1 20:01:23 2002
  185. ***************
  186. *** 608,609 ****
  187. --- 608,611 ----
  188.   {   /* Add new patch number below this line */
  189. + /**/
  190. +     159,
  191.   /**/
  192.  
  193. -- 
  194. hundred-and-one symptoms of being an internet addict:
  195. 149. You find your computer sexier than your girlfriend
  196.  
  197.  ///  Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net  \\\
  198. (((   Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim   )))
  199.  \\\  Help me helping AIDS orphans in Uganda - http://iccf-holland.org  ///
  200.