Skip to content

Commit 8b94afc

Browse files
committed
patch 9.1.0868: the warning about missing clipboard can be improved
Problem: the warning about missing clipboard can be improved (after v9.1.0852) Solution: use different warnings depending on whether or not clipboard support is included in Vim, update related documentation Improve the Warnings about missing clipboard registers - Make it translatable - Use a different warning, when clipboard support was not compiled in - add a reference to :h W24 - explain in more detail the error message closes: #16069 Signed-off-by: Christian Brabandt <[email protected]>
1 parent deda23f commit 8b94afc

6 files changed

Lines changed: 31 additions & 6 deletions

File tree

runtime/doc/gui.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*gui.txt* For Vim version 9.1. Last change: 2024 Nov 07
1+
*gui.txt* For Vim version 9.1. Last change: 2024 Nov 17
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -474,7 +474,7 @@ When the "unnamed" string is included in the 'clipboard' option, the unnamed
474474
register is the same as the "* register. Thus you can yank to and paste the
475475
selection without prepending "* to commands.
476476

477-
See also |W23|.
477+
See also |W23| and |W24|.
478478

479479
==============================================================================
480480
5. Menus *menus*

runtime/doc/gui_x11.txt

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*gui_x11.txt* For Vim version 9.1. Last change: 2024 Nov 11
1+
*gui_x11.txt* For Vim version 9.1. Last change: 2024 Nov 17
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -716,6 +716,25 @@ output a warning:
716716

717717
Warning: Clipboard register not available, using register 0 ~
718718

719+
*W24*
720+
Vim comes in different flavors, from a tiny build, that just tries to be
721+
compatible to original Vi, to enhanced builds which include many improvements
722+
(like a GUI). However, on servers and embedded systems, Vim is typically
723+
compiled without clipboard support, since this feature requires X11 libraries
724+
to be present. Check the ":version" output for the flag |+clipboard| or
725+
-clipboard. The former means clipboard support is present while the latter
726+
means your Vim does not contain clipboard support.
727+
728+
In the case when you are trying to access the "* or "+ register and Vim has
729+
no clipboard support, you will see this warning:
730+
731+
Warning: Clipboard register not available. See :h W24~
732+
733+
If you have a vim with no clipboard support but would like to use the
734+
clipboard, try to install a more enhanced Vim package like vim-enhanced or
735+
vim-gtk3 (the gui packages usually also come with a terminal Vim that has
736+
clipboard support included).
737+
719738
*x11-cut-buffer*
720739
There are, by default, 8 cut-buffers: CUT_BUFFER0 to CUT_BUFFER7. Vim only
721740
uses CUT_BUFFER0, which is the one that xterm uses by default.

runtime/doc/tags

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5821,6 +5821,7 @@ W20 if_pyth.txt /*W20*
58215821
W21 if_pyth.txt /*W21*
58225822
W22 userfunc.txt /*W22*
58235823
W23 gui_x11.txt /*W23*
5824+
W24 gui_x11.txt /*W24*
58245825
WORD motion.txt /*WORD*
58255826
WSL os_win32.txt /*WSL*
58265827
WWW intro.txt /*WWW*

src/message.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ static FILE *verbose_fd = NULL;
5656
static int verbose_did_open = FALSE;
5757

5858
static int did_warn_clipboard = FALSE;
59-
static char *warn_clipboard = "W23: Clipboard register not available, using register 0";
6059

6160
/*
6261
* When writing messages to the screen, there are many different situations.
@@ -4071,7 +4070,11 @@ msg_warn_missing_clipboard(void)
40714070
{
40724071
if (!global_busy && !did_warn_clipboard)
40734072
{
4074-
msg(_(warn_clipboard));
4073+
#ifdef FEAT_CLIPBOARD
4074+
msg(_("W23: Clipboard register not available, using register 0"));
4075+
#else
4076+
msg(_("W24: Clipboard register not available. See :h W24"));
4077+
#endif
40754078
did_warn_clipboard = TRUE;
40764079
}
40774080
}

src/testdir/test_registers.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,7 @@ func Test_clipboard_regs_not_working()
10521052
new
10531053
call append(0, "text for clipboard test")
10541054
let mess = execute(':norm "*yiw')
1055-
call assert_match('W23', mess)
1055+
call assert_match('W24', mess)
10561056
bw!
10571057
endif
10581058
endfunc

src/version.c

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

705705
static int included_patches[] =
706706
{ /* Add new patch number below this line */
707+
/**/
708+
868,
707709
/**/
708710
867,
709711
/**/

0 commit comments

Comments
 (0)