* Bram Moolenaar [2011.05.02 14:00]:
> One thing you do need to do: Add the tag to the help files
> somewhere.  When a user sees an error message, he should be able to type
> :help E123 to get more information about what's wrong.

Done. The completed patch is attached once more. Note that the patch
also removes the item from the todo list. That way it's all nice and
self-contained. :-)

HTH,

-- 
JR

-- 
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
diff -r 73a3554fc015 runtime/doc/change.txt
--- a/runtime/doc/change.txt    Sun May 01 18:54:13 2011 -0400
+++ b/runtime/doc/change.txt    Mon May 02 19:35:55 2011 -0400
@@ -917,8 +917,10 @@
 {Visual}["x]Y          Yank the highlighted lines [into register x] (for
                        {Visual} see |Visual-mode|).  {not in Vi}
 
-                                                       *:y* *:yank*
-:[range]y[ank] [x]     Yank [range] lines [into register x].
+                                                       *:y* *:yank* *E???*
+:[range]y[ank] [x]     Yank [range] lines [into register x]. Yanking to the
+                       "* or "+ registers is possible only in GUI versions or
+                       when the |+xterm_clipboard| feature is included.
 
 :[range]y[ank] [x] {count}
                        Yank {count} lines, starting with last line number
diff -r 73a3554fc015 runtime/doc/todo.txt
--- a/runtime/doc/todo.txt      Sun May 01 18:54:13 2011 -0400
+++ b/runtime/doc/todo.txt      Mon May 02 19:35:55 2011 -0400
@@ -2130,8 +2130,6 @@
     works.
 8   A very long message in confirm() can't be quit.  Make this possible with
     CTRL-C.
-8   When the clipboard isn't supported: ":yank*" gives a confusing error
-    message.  Specifically mention that the register name is invalid.
 8   "gf" always excludes trailing punctuation characters.  file_name_in_line()
     is currently fixed to use ".,:;!".  Add an option to make this
     configurable?
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    Mon May 02 19:35:55 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     Mon May 02 19:35:55 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);

Raspunde prin e-mail lui