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