Skip to content

Commit 825b6d5

Browse files
committed
updated for version 7.3.171
Problem: When the clipboard isn't supported: ":yank*" gives a confusing error message. Solution: Specifically mention that the register name is invalid. (Jean-Rene David)
1 parent 0d9e478 commit 825b6d5

File tree

4 files changed

+34
-13
lines changed

4 files changed

+34
-13
lines changed

runtime/doc/change.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -917,8 +917,10 @@ inside of strings can change! Also see 'softtabstop' option. >
917917
{Visual}["x]Y Yank the highlighted lines [into register x] (for
918918
{Visual} see |Visual-mode|). {not in Vi}
919919

920-
*:y* *:yank*
921-
:[range]y[ank] [x] Yank [range] lines [into register x].
920+
*:y* *:yank* *E850*
921+
:[range]y[ank] [x] Yank [range] lines [into register x]. Yanking to the
922+
"* or "+ registers is possible only in GUI versions or
923+
when the |+xterm_clipboard| feature is included.
922924

923925
:[range]y[ank] [x] {count}
924926
Yank {count} lines, starting with last line number

src/ex_docmd.c

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2424,25 +2424,39 @@ do_one_cmd(cmdlinep, sourcing,
24242424
if ( (ea.argt & REGSTR)
24252425
&& *ea.arg != NUL
24262426
#ifdef FEAT_USR_CMDS
2427-
&& valid_yank_reg(*ea.arg, (ea.cmdidx != CMD_put
2428-
&& USER_CMDIDX(ea.cmdidx)))
24292427
/* Do not allow register = for user commands */
24302428
&& (!USER_CMDIDX(ea.cmdidx) || *ea.arg != '=')
2431-
#else
2432-
&& valid_yank_reg(*ea.arg, ea.cmdidx != CMD_put)
24332429
#endif
24342430
&& !((ea.argt & COUNT) && VIM_ISDIGIT(*ea.arg)))
24352431
{
2436-
ea.regname = *ea.arg++;
2437-
#ifdef FEAT_EVAL
2438-
/* for '=' register: accept the rest of the line as an expression */
2439-
if (ea.arg[-1] == '=' && ea.arg[0] != NUL)
2432+
#ifndef FEAT_CLIPBOARD
2433+
/* check these explicitly for a more specific error message */
2434+
if (*ea.arg == '*' || *ea.arg == '+')
24402435
{
2441-
set_expr_line(vim_strsave(ea.arg));
2442-
ea.arg += STRLEN(ea.arg);
2436+
errormsg = (char_u *)_(e_invalidreg);
2437+
goto doend;
24432438
}
24442439
#endif
2445-
ea.arg = skipwhite(ea.arg);
2440+
if (
2441+
#ifdef FEAT_USR_CMDS
2442+
valid_yank_reg(*ea.arg, (ea.cmdidx != CMD_put
2443+
&& USER_CMDIDX(ea.cmdidx)))
2444+
#else
2445+
valid_yank_reg(*ea.arg, ea.cmdidx != CMD_put)
2446+
#endif
2447+
)
2448+
{
2449+
ea.regname = *ea.arg++;
2450+
#ifdef FEAT_EVAL
2451+
/* for '=' register: accept the rest of the line as an expression */
2452+
if (ea.arg[-1] == '=' && ea.arg[0] != NUL)
2453+
{
2454+
set_expr_line(vim_strsave(ea.arg));
2455+
ea.arg += STRLEN(ea.arg);
2456+
}
2457+
#endif
2458+
ea.arg = skipwhite(ea.arg);
2459+
}
24462460
}
24472461

24482462
/*

src/globals.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1561,6 +1561,9 @@ EXTERN char_u e_bufloaded[] INIT(= N_("E139: File is loaded in another buffer"))
15611561
(defined(FEAT_INS_EXPAND) && defined(FEAT_COMPL_FUNC))
15621562
EXTERN char_u e_notset[] INIT(= N_("E764: Option '%s' is not set"));
15631563
#endif
1564+
#ifndef FEAT_CLIPBOARD
1565+
EXTERN char_u e_invalidreg[] INIT(= N_("E850: Invalid register name"));
1566+
#endif
15641567

15651568
#ifdef MACOS_X_UNIX
15661569
EXTERN short disallow_gui INIT(= FALSE);

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,8 @@ static char *(features[]) =
714714

715715
static int included_patches[] =
716716
{ /* Add new patch number below this line */
717+
/**/
718+
171,
717719
/**/
718720
170,
719721
/**/

0 commit comments

Comments
 (0)