]>
Commit | Line | Data |
---|---|---|
c9934a4a ER |
1 | To: vim_dev@googlegroups.com |
2 | Subject: Patch 7.3.054 | |
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.3.054 | |
11 | Problem: Can define a user command for :Print, but it doesn't work. (Aaron | |
12 | Thoma) | |
13 | Solution: Let user command :Print overrule the builtin command (Christian | |
14 | Brabandt) Disallow :X and :Next as a user defined command. | |
15 | Files: src/ex_docmd.c | |
16 | ||
17 | ||
18 | *** ../vim-7.3.053/src/ex_docmd.c 2010-10-13 17:50:02.000000000 +0200 | |
19 | --- src/ex_docmd.c 2010-11-10 18:33:18.000000000 +0100 | |
20 | *************** | |
21 | *** 2871,2878 **** | |
22 | } | |
23 | ||
24 | #ifdef FEAT_USR_CMDS | |
25 | ! /* Look for a user defined command as a last resort */ | |
26 | ! if (eap->cmdidx == CMD_SIZE && *eap->cmd >= 'A' && *eap->cmd <= 'Z') | |
27 | { | |
28 | /* User defined commands may contain digits. */ | |
29 | while (ASCII_ISALNUM(*p)) | |
30 | --- 2871,2880 ---- | |
31 | } | |
32 | ||
33 | #ifdef FEAT_USR_CMDS | |
34 | ! /* Look for a user defined command as a last resort. Let ":Print" be | |
35 | ! * overruled by a user defined command. */ | |
36 | ! if ((eap->cmdidx == CMD_SIZE || eap->cmdidx == CMD_Print) | |
37 | ! && *eap->cmd >= 'A' && *eap->cmd <= 'Z') | |
38 | { | |
39 | /* User defined commands may contain digits. */ | |
40 | while (ASCII_ISALNUM(*p)) | |
41 | *************** | |
42 | *** 5588,5593 **** | |
43 | --- 5590,5596 ---- | |
44 | int compl = EXPAND_NOTHING; | |
45 | char_u *compl_arg = NULL; | |
46 | int has_attr = (eap->arg[0] == '-'); | |
47 | + int name_len; | |
48 | ||
49 | p = eap->arg; | |
50 | ||
51 | *************** | |
52 | *** 5613,5618 **** | |
53 | --- 5616,5622 ---- | |
54 | return; | |
55 | } | |
56 | end = p; | |
57 | + name_len = (int)(end - name); | |
58 | ||
59 | /* If there is nothing after the name, and no attributes were specified, | |
60 | * we are listing commands | |
61 | *************** | |
62 | *** 5627,5632 **** | |
63 | --- 5631,5643 ---- | |
64 | EMSG(_("E183: User defined commands must start with an uppercase letter")); | |
65 | return; | |
66 | } | |
67 | + else if ((name_len == 1 && *name == 'X') | |
68 | + || (name_len <= 4 | |
69 | + && STRNCMP(name, "Next", name_len > 4 ? 4 : name_len) == 0)) | |
70 | + { | |
71 | + EMSG(_("E841: Reserved name, cannot be used for user defined command")); | |
72 | + return; | |
73 | + } | |
74 | else | |
75 | uc_add_command(name, end - name, p, argt, def, flags, compl, compl_arg, | |
76 | eap->forceit); | |
77 | *************** | |
78 | *** 9394,9400 **** | |
79 | ex_ptag(eap) | |
80 | exarg_T *eap; | |
81 | { | |
82 | ! g_do_tagpreview = p_pvh; | |
83 | ex_tag_cmd(eap, cmdnames[eap->cmdidx].cmd_name + 1); | |
84 | } | |
85 | ||
86 | --- 9405,9411 ---- | |
87 | ex_ptag(eap) | |
88 | exarg_T *eap; | |
89 | { | |
90 | ! g_do_tagpreview = p_pvh; /* will be reset to 0 in ex_tag_cmd() */ | |
91 | ex_tag_cmd(eap, cmdnames[eap->cmdidx].cmd_name + 1); | |
92 | } | |
93 | ||
94 | *** ../vim-7.3.053/src/version.c 2010-11-10 17:11:29.000000000 +0100 | |
95 | --- src/version.c 2010-11-10 18:58:28.000000000 +0100 | |
96 | *************** | |
97 | *** 716,717 **** | |
98 | --- 716,719 ---- | |
99 | { /* Add new patch number below this line */ | |
100 | + /**/ | |
101 | + 54, | |
102 | /**/ | |
103 | ||
104 | -- | |
105 | You can be stopped by the police for biking over 65 miles per hour. | |
106 | You are not allowed to walk across a street on your hands. | |
107 | [real standing laws in Connecticut, United States of America] | |
108 | ||
109 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
110 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
111 | \\\ download, build and distribute -- http://www.A-A-P.org /// | |
112 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |