Below is a patch fixing this item from the todo list (I guess you could
say I'm on a roll... :-)
8 When the clipboard isn't supported: ":yank*" gives a confusing error
message. Specifically mention that the register name is invalid.
However I am unclear as to the error number to give to the new error
message. How is that determined? (see the very bottom of the patch)
--
JR
diff -r 73a3554fc015 src/ex_docmd.c
--- a/src/ex_docmd.c Sun May 01 18:54:13 2011 -0400
+++ b/src/ex_docmd.c Sun May 01 23:29:23 2011 -0400
@@ -2424,25 +2424,39 @@
if ( (ea.argt & REGSTR)
&& *ea.arg != NUL
#ifdef FEAT_USR_CMDS
- && valid_yank_reg(*ea.arg, (ea.cmdidx != CMD_put
- && USER_CMDIDX(ea.cmdidx)))
/* Do not allow register = for user commands */
&& (!USER_CMDIDX(ea.cmdidx) || *ea.arg != '=')
+#endif
+ && !((ea.argt & COUNT) && VIM_ISDIGIT(*ea.arg)))
+ {
+#ifndef FEAT_CLIPBOARD
+ /* check these explicitly for a more specific error message */
+ if (*ea.arg == '*' || *ea.arg == '+')
+ {
+ errormsg = (char_u *)_(e_invalidreg);
+ goto doend;
+ }
+#endif
+ if (
+#ifdef FEAT_USR_CMDS
+ valid_yank_reg(*ea.arg, (ea.cmdidx != CMD_put
+ && USER_CMDIDX(ea.cmdidx)))
#else
- && valid_yank_reg(*ea.arg, ea.cmdidx != CMD_put)
-#endif
- && !((ea.argt & COUNT) && VIM_ISDIGIT(*ea.arg)))
- {
- ea.regname = *ea.arg++;
+ valid_yank_reg(*ea.arg, ea.cmdidx != CMD_put)
+#endif
+ )
+ {
+ ea.regname = *ea.arg++;
#ifdef FEAT_EVAL
- /* for '=' register: accept the rest of the line as an expression */
- if (ea.arg[-1] == '=' && ea.arg[0] != NUL)
- {
- set_expr_line(vim_strsave(ea.arg));
- ea.arg += STRLEN(ea.arg);
- }
-#endif
- ea.arg = skipwhite(ea.arg);
+ /* for '=' register: accept the rest of the line as an expression */
+ if (ea.arg[-1] == '=' && ea.arg[0] != NUL)
+ {
+ set_expr_line(vim_strsave(ea.arg));
+ ea.arg += STRLEN(ea.arg);
+ }
+#endif
+ ea.arg = skipwhite(ea.arg);
+ }
}
/*
diff -r 73a3554fc015 src/globals.h
--- a/src/globals.h Sun May 01 18:54:13 2011 -0400
+++ b/src/globals.h Sun May 01 23:29:23 2011 -0400
@@ -1561,6 +1561,9 @@
(defined(FEAT_INS_EXPAND) && defined(FEAT_COMPL_FUNC))
EXTERN char_u e_notset[] INIT(= N_("E764: Option '%s' is not set"));
#endif
+#ifndef FEAT_CLIPBOARD
+EXTERN char_u e_invalidreg[] INIT(= N_("E???: Invalid register name"));
+#endif
#ifdef MACOS_X_UNIX
EXTERN short disallow_gui INIT(= FALSE);
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php