]>
Commit | Line | Data |
---|---|---|
4c0a682a AG |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 7.2.156 | |
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 7.2.156 (after 7.2.143) | |
11 | Problem: No completion for :scscope and :lcscope commands. | |
12 | Solution: Implement the completion. (Dominique Pelle) | |
13 | Files: src/if_cscope.c, src/ex_docmd.c, src/proto/if_cscope.pro | |
14 | ||
15 | ||
16 | *** ../vim-7.2.155/src/if_cscope.c Wed Mar 18 14:30:46 2009 | |
17 | --- src/if_cscope.c Wed Apr 22 11:57:49 2009 | |
18 | *************** | |
19 | *** 98,103 **** | |
20 | --- 98,104 ---- | |
21 | static enum | |
22 | { | |
23 | EXP_CSCOPE_SUBCMD, /* expand ":cscope" sub-commands */ | |
24 | + EXP_SCSCOPE_SUBCMD, /* expand ":scscope" sub-commands */ | |
25 | EXP_CSCOPE_FIND, /* expand ":cscope find" arguments */ | |
26 | EXP_CSCOPE_KILL /* expand ":cscope kill" arguments */ | |
27 | } expand_what; | |
28 | *************** | |
29 | *** 112,123 **** | |
30 | --- 113,135 ---- | |
31 | expand_T *xp; | |
32 | int idx; | |
33 | { | |
34 | + int current_idx; | |
35 | + int i; | |
36 | + | |
37 | switch (expand_what) | |
38 | { | |
39 | case EXP_CSCOPE_SUBCMD: | |
40 | /* Complete with sub-commands of ":cscope": | |
41 | * add, find, help, kill, reset, show */ | |
42 | return (char_u *)cs_cmds[idx].name; | |
43 | + case EXP_SCSCOPE_SUBCMD: | |
44 | + /* Complete with sub-commands of ":scscope": same sub-commands as | |
45 | + * ":cscope" but skip commands which don't support split windows */ | |
46 | + for (i = 0, current_idx = 0; cs_cmds[i].name != NULL; i++) | |
47 | + if (cs_cmds[i].cansplit) | |
48 | + if (current_idx++ == idx) | |
49 | + break; | |
50 | + return (char_u *)cs_cmds[i].name; | |
51 | case EXP_CSCOPE_FIND: | |
52 | { | |
53 | const char *query_type[] = | |
54 | *************** | |
55 | *** 133,147 **** | |
56 | } | |
57 | case EXP_CSCOPE_KILL: | |
58 | { | |
59 | - int i; | |
60 | - int current_idx = 0; | |
61 | static char_u connection[2]; | |
62 | ||
63 | /* ":cscope kill" accepts connection numbers or partial names of | |
64 | * the pathname of the cscope database as argument. Only complete | |
65 | * with connection numbers. -1 can also be used to kill all | |
66 | * connections. */ | |
67 | ! for (i = 0; i < CSCOPE_MAX_CONNECTIONS; i++) | |
68 | { | |
69 | if (csinfo[i].fname == NULL) | |
70 | continue; | |
71 | --- 145,157 ---- | |
72 | } | |
73 | case EXP_CSCOPE_KILL: | |
74 | { | |
75 | static char_u connection[2]; | |
76 | ||
77 | /* ":cscope kill" accepts connection numbers or partial names of | |
78 | * the pathname of the cscope database as argument. Only complete | |
79 | * with connection numbers. -1 can also be used to kill all | |
80 | * connections. */ | |
81 | ! for (i = 0, current_idx = 0; i < CSCOPE_MAX_CONNECTIONS; i++) | |
82 | { | |
83 | if (csinfo[i].fname == NULL) | |
84 | continue; | |
85 | *************** | |
86 | *** 165,180 **** | |
87 | * Handle command line completion for :cscope command. | |
88 | */ | |
89 | void | |
90 | ! set_context_in_cscope_cmd(xp, arg) | |
91 | expand_T *xp; | |
92 | char_u *arg; | |
93 | { | |
94 | char_u *p; | |
95 | ||
96 | /* Default: expand subcommands */ | |
97 | xp->xp_context = EXPAND_CSCOPE; | |
98 | - expand_what = EXP_CSCOPE_SUBCMD; | |
99 | xp->xp_pattern = arg; | |
100 | ||
101 | /* (part of) subcommand already typed */ | |
102 | if (*arg != NUL) | |
103 | --- 175,192 ---- | |
104 | * Handle command line completion for :cscope command. | |
105 | */ | |
106 | void | |
107 | ! set_context_in_cscope_cmd(xp, arg, cmdidx) | |
108 | expand_T *xp; | |
109 | char_u *arg; | |
110 | + cmdidx_T cmdidx; | |
111 | { | |
112 | char_u *p; | |
113 | ||
114 | /* Default: expand subcommands */ | |
115 | xp->xp_context = EXPAND_CSCOPE; | |
116 | xp->xp_pattern = arg; | |
117 | + expand_what = (cmdidx == CMD_scscope) | |
118 | + ? EXP_SCSCOPE_SUBCMD : EXP_CSCOPE_SUBCMD; | |
119 | ||
120 | /* (part of) subcommand already typed */ | |
121 | if (*arg != NUL) | |
122 | *** ../vim-7.2.155/src/ex_docmd.c Wed Apr 22 14:42:26 2009 | |
123 | --- src/ex_docmd.c Wed Apr 22 11:57:49 2009 | |
124 | *************** | |
125 | *** 3690,3696 **** | |
126 | break; | |
127 | #ifdef FEAT_CSCOPE | |
128 | case CMD_cscope: | |
129 | ! set_context_in_cscope_cmd(xp, arg); | |
130 | break; | |
131 | #endif | |
132 | #ifdef FEAT_LISTCMDS | |
133 | --- 3690,3698 ---- | |
134 | break; | |
135 | #ifdef FEAT_CSCOPE | |
136 | case CMD_cscope: | |
137 | ! case CMD_lcscope: | |
138 | ! case CMD_scscope: | |
139 | ! set_context_in_cscope_cmd(xp, arg, ea.cmdidx); | |
140 | break; | |
141 | #endif | |
142 | #ifdef FEAT_LISTCMDS | |
143 | *** ../vim-7.2.155/src/proto/if_cscope.pro Wed Mar 18 12:50:58 2009 | |
144 | --- src/proto/if_cscope.pro Wed Apr 22 11:57:49 2009 | |
145 | *************** | |
146 | *** 1,6 **** | |
147 | /* if_cscope.c */ | |
148 | char_u *get_cscope_name __ARGS((expand_T *xp, int idx)); | |
149 | ! void set_context_in_cscope_cmd __ARGS((expand_T *xp, char_u *arg)); | |
150 | void do_cscope __ARGS((exarg_T *eap)); | |
151 | void do_scscope __ARGS((exarg_T *eap)); | |
152 | void do_cstag __ARGS((exarg_T *eap)); | |
153 | --- 1,6 ---- | |
154 | /* if_cscope.c */ | |
155 | char_u *get_cscope_name __ARGS((expand_T *xp, int idx)); | |
156 | ! void set_context_in_cscope_cmd __ARGS((expand_T *xp, char_u *arg, cmdidx_T cmdidx)); | |
157 | void do_cscope __ARGS((exarg_T *eap)); | |
158 | void do_scscope __ARGS((exarg_T *eap)); | |
159 | void do_cstag __ARGS((exarg_T *eap)); | |
160 | *** ../vim-7.2.155/src/version.c Wed Apr 22 16:07:57 2009 | |
161 | --- src/version.c Wed Apr 22 16:21:43 2009 | |
162 | *************** | |
163 | *** 678,679 **** | |
164 | --- 678,681 ---- | |
165 | { /* Add new patch number below this line */ | |
166 | + /**/ | |
167 | + 156, | |
168 | /**/ | |
169 | ||
170 | -- | |
171 | ARTHUR: Shut up! Will you shut up! | |
172 | DENNIS: Ah, now we see the violence inherent in the system. | |
173 | ARTHUR: Shut up! | |
174 | DENNIS: Oh! Come and see the violence inherent in the system! | |
175 | HELP! HELP! I'm being repressed! | |
176 | The Quest for the Holy Grail (Monty Python) | |
177 | ||
178 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
179 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
180 | \\\ download, build and distribute -- http://www.A-A-P.org /// | |
181 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |