Skip to content

Commit 00e8452

Browse files
64-bitmanchrisbra
authored andcommitted
patch 9.1.1873: Clipboard provider feature broke clipboard support
Problem: Clipboard provider feature broke clipboard support (Yee Cheng Chin) Solution: Revert clipboard changes (Foxe Chen). fixes: #18600 closes: #18633 Signed-off-by: Foxe Chen <[email protected]> Signed-off-by: Christian Brabandt <[email protected]>
1 parent 97b6e8b commit 00e8452

28 files changed

+188
-1121
lines changed

runtime/doc/builtin.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*builtin.txt* For Vim version 9.1. Last change: 2025 Oct 14
1+
*builtin.txt* For Vim version 9.1. Last change: 2025 Oct 26
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -13061,7 +13061,6 @@ channel Compiled with support for |channel| and |job|
1306113061
cindent Compiled with 'cindent' support. (always true)
1306213062
clientserver Compiled with remote invocation support |clientserver|.
1306313063
clipboard Compiled with 'clipboard' support.
13064-
clipboard_provider Compiled with |clipboard-providers| support
1306513064
clipboard_working Compiled with 'clipboard' support and it can be used.
1306613065
cmdline_compl Compiled with |cmdline-completion| support.
1306713066
cmdline_hist Compiled with |cmdline-history| support.

runtime/doc/eval.txt

Lines changed: 3 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*eval.txt* For Vim version 9.1. Last change: 2025 Oct 18
1+
*eval.txt* For Vim version 9.1. Last change: 2025 Oct 26
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -38,7 +38,6 @@ a remark is given.
3838
12. The sandbox |eval-sandbox|
3939
13. Textlock |textlock|
4040
14. Vim script library |vim-script-library|
41-
15. Clipboard providers |clipboard-providers|
4241

4342
Testing support is documented in |testing.txt|.
4443
Profiling is documented at |profiling|.
@@ -2246,17 +2245,10 @@ v:clipmethod The current method of accessing the clipboard that is being
22462245
used. Can either have the value of:
22472246
wayland The Wayland protocol is being used.
22482247
x11 X11 selections are being used.
2249-
gui GUI specific method is being used
2250-
other Some other method is being used
2251-
none Clipboard functionality is disabled or
2252-
unavailable.
2248+
none The above methods are unavailable or
2249+
cannot be used.
22532250
See 'clipmethod' for more details.
22542251

2255-
*v:clipproviders*
2256-
v:clipproviders
2257-
A dictionary containing clipboard providers, see
2258-
|clipboard-providers| for more information.
2259-
22602252
*v:cmdarg* *cmdarg-variable*
22612253
v:cmdarg This variable is used for two purposes:
22622254
1. The extra arguments given to a file read/write command.
@@ -5269,134 +5261,5 @@ Usage: >vim
52695261
:call dist#vim9#Launch(<args>)
52705262
:Launch <app> <args>.
52715263
<
5272-
==============================================================================
5273-
15. Clipboard providers *clipboard-providers*
5274-
5275-
When Vim is compiled with the |+clipboard_provider| feature, which requires
5276-
the |+eval| feature, creating custom clipboards is possible. These providers
5277-
handle the "+" and "*" registers. Note that if |+wayland_clipboard| or
5278-
|+xterm_clipboard| features are not compiled in, then the "+" register will
5279-
not be available.
5280-
5281-
To add a provider, add a new entry to the |v:clipproviders| dictionary, in the
5282-
format of: >
5283-
let v:clipproviders["name"] = {
5284-
\ "available": function("Available"),
5285-
\ "paste": {
5286-
\ '+': function("Paste"), " For the + register
5287-
\ '*': function("Paste"), " For the * register
5288-
\ },
5289-
\ "copy": {
5290-
\ '+': function("Copy"), " Same thing as above
5291-
\ '*': function("Copy"),
5292-
\ },
5293-
\ }
5294-
5295-
The key is the provider name, which should be used in 'clipmethod', for
5296-
example in the following example, you would add "name" to 'clipmethod' in
5297-
order to use it. >
5298-
set clipmethod=name,wayland,x11,gui
5299-
5300-
Each callback can either be a name of a function in a string, a |Funcref|, or
5301-
a |lambda| expression.
5302-
5303-
Note that these dictionary entries are optional, for example, if you don't
5304-
care about the "copy" functions, then you can simply exclude them. When Vim
5305-
yanks/copies something, then simply nothing will be done.
5306-
5307-
*clipboard-provider-available*
5308-
The "available" callback should return a string, which should contain which
5309-
clipboard registers are available. For example, if the "+" register is only
5310-
available, then the function would return "+", or if both "+" and "*" are
5311-
available, then return "+*".
5312-
5313-
*clipboard-provider-paste*
5314-
The "paste" callback takes a first argument which is the register being put
5315-
(string), and a second argument which is the type of access (string). It
5316-
should return either a tuple/list or string. If a tuple/list is returned, it
5317-
should have two elements:
5318-
- The register type conforming to |setreg()|.
5319-
- A list of strings
5320-
If the register type is an empty string, then the type is automatically
5321-
chosen, see |setreg()|. If a string is returned, then it can either be "clear"
5322-
or "previous". "clear" makes Vim clear the register, and "previous" makes Vim
5323-
use the previous register contents (or current depending on how you view it).
5324-
5325-
The second argument, the access type, can either be "explicit" or "implicit".
5326-
"explicit" means that the user is directly accessing the clipboard, such as
5327-
putting text, or calling |getreg()|; "implicit" means that the clipboard is
5328-
being accessed indirectly, such when |:registers| is called, or when an
5329-
unrelated operation causes Vim to access the clipboard.
5330-
5331-
This is useful since some operations in Vim implicity access the clipboard
5332-
indirectly. For example, if when you want to create a provider for the OSC52
5333-
command (accessing the clipboard via an escape code). Many terminals show a
5334-
confirmation if you want Vim to access the clipboard. This can be very
5335-
annoying with the terminal asking for permission everytime you do something
5336-
that accesses the clipboard behind the scenes. A good way to handle implicit
5337-
access is to return "previous", which leaves the register contents unchanged.
5338-
5339-
*clipboard-provider-copy*
5340-
The "copy" callback returns nothing, and takes the given arguments in order:
5341-
- The register being operated on
5342-
- The register type, conforming to |getregtype()|
5343-
- A list of strings to copy
5344-
5345-
The provider can do whatever it wants with the given information. This
5346-
function is called on every request to change the clipboard register(s).
5347-
5348-
*clipboard-provider-textlock*
5349-
In both the "paste" and "copy" callbacks, it is not allowed to change the
5350-
buffer text, see |textlock|.
5351-
5352-
*clipboard-provider-example*
5353-
Here is an example script that uses the clipboard provider feature through the
5354-
OSC52 command: >vim
5355-
5356-
func Available()
5357-
return "*"
5358-
endfunc
5359-
5360-
func Paste(reg, type)
5361-
" If implicit access, don't do anything
5362-
if a:type == "implicit"
5363-
return "previous"
5364-
endif
53655264

5366-
augroup OSC
5367-
autocmd!
5368-
autocmd TermResponseAll osc ++once call feedkeys("\<F30>", '!')
5369-
augroup END
5370-
5371-
" Send command
5372-
call echoraw("\<Esc>]52;;?\<Esc>\\")
5373-
5374-
" Wait until autocmd is triggered
5375-
while getchar(-1) != "\<F30>"
5376-
endwhile
5377-
5378-
autocmd! OSC
5379-
5380-
" Extract the base64 stuff
5381-
let l:stuff = matchstr(v:termosc, '52;.\+;\zs[A-Za-z0-9+/=]\+')
5382-
5383-
return ("", blob2str(base64_decode(l:stuff)))
5384-
endfunc
5385-
5386-
func Copy(reg, type, lines)
5387-
call echoraw("\<Esc>]52;c;" ..
5388-
\ base64_encode(str2blob(a:lines)) .. "\<Esc>\\")
5389-
endfunc
5390-
let v:clipproviders["myosc"] = {
5391-
\ "available": function("Available"),
5392-
\ "paste": {
5393-
\ '*': function("Paste")
5394-
\ },
5395-
\ "copy": {
5396-
\ '*': function("Copy")
5397-
\ },
5398-
\ }
5399-
set clipmethod=myosc
5400-
5401-
<
54025265
vim:tw=78:ts=8:noet:ft=help:norl:

runtime/doc/options.txt

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*options.txt* For Vim version 9.1. Last change: 2025 Oct 25
1+
*options.txt* For Vim version 9.1. Last change: 2025 Oct 26
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1907,35 +1907,30 @@ A jump table for the options with a short description can be found at |Q_op|.
19071907
{pattern}, this must be the last entry.
19081908

19091909
*'clipmethod'* *'cpm'*
1910-
'clipmethod' 'cpm' string (default for Unix: "wayland,x11,gui,other",
1911-
for VMS: "x11,gui,other",
1912-
otherwise: "gui,other")
1910+
'clipmethod' 'cpm' string (default for Unix: "wayland,x11",
1911+
for VMS: "x11",
1912+
otherwise: "")
19131913
global
1914-
{only when the |+clipboard| feature is included}
1914+
{only when the |+xterm_clipboard| or
1915+
|+wayland_clipboard| features are included}
19151916
Specifies which method of accessing the system clipboard is used,
19161917
depending on which method works first or is available. Supported
19171918
methods are:
19181919
wayland Wayland selections
19191920
x11 X11 selections
1920-
gui GUI specific method
1921-
other Some other method
1922-
* Clipboard provider method
19231921

1924-
Note: "other" is used on systems without X11/Wayland, such as
1925-
MS-Windows or MacOS, when running Vim without the GUI.
1926-
1927-
Note that the name of the clipboard provider should be used when you
1928-
want to use a clipboard provider. See |clipboard-providers| for more
1929-
information.
1922+
Note: This option is ignored when either the GUI is running or if Vim
1923+
is run on a system without Wayland or X11 support, such as Windows or
1924+
macOS. The GUI or system way of accessing the clipboard is always
1925+
used instead.
19301926

19311927
The option value is a list of comma separated items. The list is
19321928
parsed left to right in order, and the first method that Vim
19331929
determines is available or is working is used as the actual method for
1934-
accessing the clipboard. Setting this option to an empty value
1935-
disables the clipboard functionality on all systems.
1930+
accessing the clipboard.
19361931

1937-
The current method that is being used can be found in the
1938-
|v:clipmethod| variable.
1932+
The current method that is being used can be found in the |v:clipmethod|
1933+
variable.
19391934

19401935
*'cmdheight'* *'ch'*
19411936
'cmdheight' 'ch' number (default 1)

runtime/doc/tags

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1411,9 +1411,6 @@ $quote eval.txt /*$quote*
14111411
+cindent various.txt /*+cindent*
14121412
+clientserver various.txt /*+clientserver*
14131413
+clipboard various.txt /*+clipboard*
1414-
+clipboard_plus_avail various.txt /*+clipboard_plus_avail*
1415-
+clipboard_provider various.txt /*+clipboard_provider*
1416-
+clipboard_star_avail various.txt /*+clipboard_star_avail*
14171414
+clipboard_working various.txt /*+clipboard_working*
14181415
+cmd editing.txt /*+cmd*
14191416
+cmdline_compl various.txt /*+cmdline_compl*
@@ -6694,12 +6691,6 @@ clipboard-autoselectml options.txt /*clipboard-autoselectml*
66946691
clipboard-autoselectplus options.txt /*clipboard-autoselectplus*
66956692
clipboard-exclude options.txt /*clipboard-exclude*
66966693
clipboard-html options.txt /*clipboard-html*
6697-
clipboard-provider-available eval.txt /*clipboard-provider-available*
6698-
clipboard-provider-copy eval.txt /*clipboard-provider-copy*
6699-
clipboard-provider-example eval.txt /*clipboard-provider-example*
6700-
clipboard-provider-paste eval.txt /*clipboard-provider-paste*
6701-
clipboard-provider-textlock eval.txt /*clipboard-provider-textlock*
6702-
clipboard-providers eval.txt /*clipboard-providers*
67036694
clipboard-unnamed options.txt /*clipboard-unnamed*
67046695
clipboard-unnamedplus options.txt /*clipboard-unnamedplus*
67056696
clojure-indent indent.txt /*clojure-indent*
@@ -11264,7 +11255,6 @@ v:char eval.txt /*v:char*
1126411255
v:charconvert_from eval.txt /*v:charconvert_from*
1126511256
v:charconvert_to eval.txt /*v:charconvert_to*
1126611257
v:clipmethod eval.txt /*v:clipmethod*
11267-
v:clipproviders eval.txt /*v:clipproviders*
1126811258
v:cmdarg eval.txt /*v:cmdarg*
1126911259
v:cmdbang eval.txt /*v:cmdbang*
1127011260
v:collate eval.txt /*v:collate*

runtime/doc/various.txt

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*various.txt* For Vim version 9.1. Last change: 2025 Oct 16
1+
*various.txt* For Vim version 9.1. Last change: 2025 Oct 26
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -378,14 +378,7 @@ m *+channel* inter process communication |channel|
378378
T *+cindent* 'cindent', C indenting; Always enabled
379379
N *+clientserver* Unix and Win32: Remote invocation |clientserver|
380380
*+clipboard* |clipboard| support compiled-in
381-
N *+clipboard_provider* |clipboard-providers| support compiled-in
382381
*+clipboard_working* |clipboard| support compiled-in and working
383-
*+clipboard_star_avail*
384-
|clipboard| support compiled-in and star "*" register
385-
available
386-
*+clipboard_plus_avail*
387-
|clipboard| support compiled-in and separate plus "+"
388-
register available
389382
T *+cmdline_compl* command line completion |cmdline-completion|
390383
T *+cmdline_hist* command line history |cmdline-history|
391384
T *+cmdline_info* 'showcmd' and 'ruler'; Always enabled since
@@ -814,10 +807,7 @@ K Run a program to lookup the keyword under the
814807
:clip[reset] Attempts to choose a new method for accessing the
815808
clipboard, using the 'clipmethod' option. This is
816809
useful when the current method has become unavailable,
817-
and you want to try using another method. If the
818-
|+clipboard_provider| feature is being used, this
819-
command should be called after the availability of one
820-
of the clipboard registers changes.
810+
and you want to try using another method.
821811
{only available when compiled with the |+clipboard|
822812
feature}
823813

runtime/doc/version9.txt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*version9.txt* For Vim version 9.1. Last change: 2025 Oct 14
1+
*version9.txt* For Vim version 9.1. Last change: 2025 Oct 26
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -41653,8 +41653,6 @@ Other new features ~
4165341653

4165441654
- |items()| function now supports Blob.
4165541655

41656-
- |clipboard-providers| support.
41657-
4165841656
*changed-9.2*
4165941657
Changed~
4166041658
-------
@@ -41903,8 +41901,6 @@ Options: ~
4190341901

4190441902
Vim Variables: ~
4190541903
|v:clipmethod| The current 'clipmethod'.
41906-
|v:clipproviders| A dictionary containing clipboard providers
41907-
information.
4190841904
|v:stacktrace| The most recent caught exception.
4190941905
|v:t_enumvalue| Value of |enumvalue|.
4191041906
|v:t_enum| Value of |enum| type.
@@ -41923,8 +41919,6 @@ Configure Switches: ~
4192341919
--enable-wayland-focus-steal Enable the |wayland-focus-steal| feature.
4192441920
--enable-socketserver Enable the |socketserver-clientserver|
4192541921
feature.
41926-
--enable-clipboard-provider Enable the |clipboard-providers| feature.
41927-
4192841922

4192941923
==============================================================================
4193041924
INCOMPATIBLE CHANGES *incompatible-9.2*

runtime/doc/wayland.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*wayland.txt* For Vim version 9.1. Last change: 2025 Oct 12
1+
*wayland.txt* For Vim version 9.1. Last change: 2025 Oct 26
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -22,7 +22,7 @@ multiple Wayland seats in the same Wayland session.
2222
See |gui-wayland|. Please note that when using the GUI, Vim uses the toolkit
2323
such as GTK for accessing the clipboard, and does not access the clipboard
2424
though Wayland. You can check this though the |v:clipmethod| variable, which
25-
should equal to "gui" when running the GUI.
25+
should equal to "none" when running the GUI.
2626

2727
Wayland commands:
2828
*:wlrestore* *:wl*
@@ -73,7 +73,7 @@ selections, see |wayland-primary-selection| for more details.
7373
*wayland-persist*
7474
If you use X11 cut buffers, no such things exist on Wayland. Instead to
7575
emulate such functionality, a separate clipboard manager must be used in order
76-
to persist selection data when a Wayland client exits.
76+
to persist selection data when a Wayland client exists.
7777

7878
*wayland-and-x11*
7979
If your version of Vim comes compiled with both X11 and Wayland support, then

runtime/syntax/vim.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
" Language: Vim script
33
" Maintainer: Hirohito Higashi <h.east.727 ATMARK gmail.com>
44
" Doug Kearns <[email protected]>
5-
" Last Change: 2025 Oct 14
5+
" Last Change: 2025 Oct 26
66
" Former Maintainer: Charles E. Campbell
77

88
" DO NOT CHANGE DIRECTLY.
@@ -166,7 +166,7 @@ syn keyword vimFuncName contained win_execute win_findbuf win_getid win_gettype
166166
" Predefined variable names {{{2
167167
" GEN_SYN_VIM: vimVarName, START_STR='syn keyword vimVimVarName contained', END_STR=''
168168
syn keyword vimVimVarName contained count count1 prevcount errmsg warningmsg statusmsg shell_error this_session version lnum termresponse fname lang lc_time ctype charconvert_from charconvert_to fname_in fname_out fname_new fname_diff cmdarg foldstart foldend folddashes foldlevel progname servername dying exception throwpoint register cmdbang insertmode val key profiling fcs_reason fcs_choice beval_bufnr beval_winnr beval_winid beval_lnum beval_col beval_text scrollstart swapname swapchoice swapcommand char mouse_win mouse_winid mouse_lnum mouse_col operator searchforward hlsearch oldfiles windowid progpath completed_item option_new option_old option_oldlocal option_oldglobal option_command option_type errors false true none null numbermax numbermin numbersize
169-
syn keyword vimVimVarName contained vim_did_enter testing t_number t_string t_func t_list t_dict t_float t_bool t_none t_job t_channel t_blob t_class t_object termrfgresp termrbgresp termu7resp termstyleresp termblinkresp event versionlong echospace argv collate exiting colornames sizeofint sizeoflong sizeofpointer maxcol python3_version t_typealias t_enum t_enumvalue stacktrace t_tuple wayland_display clipmethod termda1 termosc clipproviders
169+
syn keyword vimVimVarName contained vim_did_enter testing t_number t_string t_func t_list t_dict t_float t_bool t_none t_job t_channel t_blob t_class t_object termrfgresp termrbgresp termu7resp termstyleresp termblinkresp event versionlong echospace argv collate exiting colornames sizeofint sizeoflong sizeofpointer maxcol python3_version t_typealias t_enum t_enumvalue stacktrace t_tuple wayland_display clipmethod termda1 termosc
170170

171171
"--- syntax here and above generated by runtime/syntax/generator/gen_syntax_vim.vim ---
172172

0 commit comments

Comments
 (0)