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 / 7.2 / 7.2.353 < prev    next >
Encoding:
Internet Message Format  |  2010-02-02  |  4.7 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 7.2.353
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 7.2.353
  11. Problem:    No command line completion for ":profile".
  12. Solution:   Complete the subcommand and file name.
  13. Files:        src/ex_docmd.c, src/ex_cmds2.c, src/ex_getln.c,
  14.         src/proto/ex_cmds2.pro, src/vim.h
  15.  
  16.  
  17. *** ../vim-7.2.352/src/ex_docmd.c    2009-11-03 12:38:50.000000000 +0100
  18. --- src/ex_docmd.c    2010-02-03 14:40:14.000000000 +0100
  19. ***************
  20. *** 3804,3809 ****
  21. --- 3804,3814 ----
  22.           xp->xp_context = EXPAND_NOTHING;
  23.           break;
  24.   #endif
  25. + #if defined(FEAT_PROFILE)
  26. +     case CMD_profile:
  27. +         set_context_in_profile_cmd(xp, arg);
  28. +         break;
  29. + #endif
  30.   
  31.   #endif /* FEAT_CMDL_COMPL */
  32.   
  33. *** ../vim-7.2.352/src/ex_cmds2.c    2010-01-20 21:41:40.000000000 +0100
  34. --- src/ex_cmds2.c    2010-02-03 14:50:08.000000000 +0100
  35. ***************
  36. *** 1115,1120 ****
  37. --- 1115,1193 ----
  38.       }
  39.   }
  40.   
  41. + /* Command line expansion for :profile. */
  42. + static enum
  43. + {
  44. +     PEXP_SUBCMD,    /* expand :profile sub-commands */
  45. +     PEXP_FUNC,        /* expand :profile func {funcname} */
  46. + } pexpand_what;
  47. + static char *pexpand_cmds[] = {
  48. +             "start",
  49. + #define PROFCMD_START    0
  50. +             "pause",
  51. + #define PROFCMD_PAUSE    1
  52. +             "continue",
  53. + #define PROFCMD_CONTINUE 2
  54. +             "func",
  55. + #define PROFCMD_FUNC    3
  56. +             "file",
  57. + #define PROFCMD_FILE    4
  58. +             NULL
  59. + #define PROFCMD_LAST    5
  60. + };
  61. + /*
  62. +  * Function given to ExpandGeneric() to obtain the profile command
  63. +  * specific expansion.
  64. +  */
  65. +     char_u *
  66. + get_profile_name(xp, idx)
  67. +     expand_T    *xp UNUSED;
  68. +     int        idx;
  69. + {
  70. +     switch (pexpand_what)
  71. +     {
  72. +     case PEXP_SUBCMD:
  73. +     return (char_u *)pexpand_cmds[idx];
  74. +     /* case PEXP_FUNC: TODO */
  75. +     default:
  76. +     return NULL;
  77. +     }
  78. + }
  79. + /*
  80. +  * Handle command line completion for :profile command.
  81. +  */
  82. +     void
  83. + set_context_in_profile_cmd(xp, arg)
  84. +     expand_T    *xp;
  85. +     char_u    *arg;
  86. + {
  87. +     char_u    *end_subcmd;
  88. +     int        len;
  89. +     /* Default: expand subcommands. */
  90. +     xp->xp_context = EXPAND_PROFILE;
  91. +     pexpand_what = PEXP_SUBCMD;
  92. +     xp->xp_pattern = arg;
  93. +     end_subcmd = skiptowhite(arg);
  94. +     if (*end_subcmd == NUL)
  95. +     return;
  96. +     len = end_subcmd - arg;
  97. +     if (len == 5 && STRNCMP(arg, "start", 5) == 0)
  98. +     {
  99. +     xp->xp_context = EXPAND_FILES;
  100. +     xp->xp_pattern = skipwhite(end_subcmd);
  101. +     return;
  102. +     }
  103. +     /* TODO: expand function names after "func" */
  104. +     xp->xp_context = EXPAND_NOTHING;
  105. + }
  106.   /*
  107.    * Dump the profiling info.
  108.    */
  109. *** ../vim-7.2.352/src/ex_getln.c    2010-01-19 14:59:14.000000000 +0100
  110. --- src/ex_getln.c    2010-02-03 14:38:43.000000000 +0100
  111. ***************
  112. *** 4522,4527 ****
  113. --- 4522,4530 ----
  114.   #ifdef FEAT_SIGNS
  115.           {EXPAND_SIGN, get_sign_name, TRUE},
  116.   #endif
  117. + #ifdef FEAT_PROFILE
  118. +         {EXPAND_PROFILE, get_profile_name, TRUE},
  119. + #endif
  120.   #if (defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \
  121.       && (defined(FEAT_GETTEXT) || defined(FEAT_MBYTE))
  122.           {EXPAND_LANGUAGE, get_lang_arg, TRUE},
  123. *** ../vim-7.2.352/src/proto/ex_cmds2.pro    2008-01-06 20:07:25.000000000 +0100
  124. --- src/proto/ex_cmds2.pro    2010-02-03 14:43:12.000000000 +0100
  125. ***************
  126. *** 24,29 ****
  127. --- 24,31 ----
  128.   int profile_equal __ARGS((proftime_T *tm1, proftime_T *tm2));
  129.   int profile_cmp __ARGS((proftime_T *tm1, proftime_T *tm2));
  130.   void ex_profile __ARGS((exarg_T *eap));
  131. + char_u *get_profile_name __ARGS((expand_T *xp, int idx));
  132. + void set_context_in_profile_cmd __ARGS((expand_T *xp, char_u *arg));
  133.   void profile_dump __ARGS((void));
  134.   void script_prof_save __ARGS((proftime_T *tm));
  135.   void script_prof_restore __ARGS((proftime_T *tm));
  136. *** ../vim-7.2.352/src/vim.h    2009-06-16 11:08:13.000000000 +0200
  137. --- src/vim.h    2010-02-03 14:40:42.000000000 +0100
  138. ***************
  139. *** 718,723 ****
  140. --- 718,724 ----
  141.   #define EXPAND_SHELLCMD        32
  142.   #define EXPAND_CSCOPE        33
  143.   #define EXPAND_SIGN        34
  144. + #define EXPAND_PROFILE        35
  145.   
  146.   /* Values for exmode_active (0 is no exmode) */
  147.   #define EXMODE_NORMAL        1
  148. *** ../vim-7.2.352/src/version.c    2010-02-03 12:23:16.000000000 +0100
  149. --- src/version.c    2010-02-03 15:07:26.000000000 +0100
  150. ***************
  151. *** 683,684 ****
  152. --- 683,686 ----
  153.   {   /* Add new patch number below this line */
  154. + /**/
  155. +     353,
  156.   /**/
  157.  
  158. -- 
  159. hundred-and-one symptoms of being an internet addict:
  160. 188. You purchase a laptop so you can surf while sitting on the can.
  161.  
  162.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  163. ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  164. \\\        download, build and distribute -- http://www.A-A-P.org        ///
  165.  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
  166.