patch 9.1.1652: cannot determine non-X11/Wayland clipmethods
Problem: Cannot determine non-X11/Wayland clipmethods Solution: Add the "gui" value to the 'clipmethod' option (Foxe Chen) closes: #18006 Signed-off-by: Foxe Chen <chen.foxe@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
96b2154b73
commit
3e152c76ad
@ -1,4 +1,4 @@
|
|||||||
*eval.txt* For Vim version 9.1. Last change: 2025 Jul 22
|
*eval.txt* For Vim version 9.1. Last change: 2025 Aug 18
|
||||||
|
|
||||||
|
|
||||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||||
@ -2245,8 +2245,9 @@ v:clipmethod The current method of accessing the clipboard that is being
|
|||||||
used. Can either have the value of:
|
used. Can either have the value of:
|
||||||
wayland The Wayland protocol is being used.
|
wayland The Wayland protocol is being used.
|
||||||
x11 X11 selections are being used.
|
x11 X11 selections are being used.
|
||||||
none The above methods are unavailable or
|
gui GUI specific method is being used.
|
||||||
cannot be used.
|
none Clipboard functionality is disabled or
|
||||||
|
unavailable.
|
||||||
See 'clipmethod' for more details.
|
See 'clipmethod' for more details.
|
||||||
|
|
||||||
*v:cmdarg* *cmdarg-variable*
|
*v:cmdarg* *cmdarg-variable*
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
*options.txt* For Vim version 9.1. Last change: 2025 Aug 16
|
*options.txt* For Vim version 9.1. Last change: 2025 Aug 18
|
||||||
|
|
||||||
|
|
||||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||||
@ -1891,9 +1891,9 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
{pattern}, this must be the last entry.
|
{pattern}, this must be the last entry.
|
||||||
|
|
||||||
*'clipmethod'* *'cpm'*
|
*'clipmethod'* *'cpm'*
|
||||||
'clipmethod' 'cpm' string (default for Unix: "wayland,x11",
|
'clipmethod' 'cpm' string (default for Unix: "wayland,x11,gui",
|
||||||
for VMS: "x11",
|
for VMS: "x11,gui",
|
||||||
otherwise: "")
|
otherwise: "gui")
|
||||||
global
|
global
|
||||||
{only when the |+xterm_clipboard| or
|
{only when the |+xterm_clipboard| or
|
||||||
|+wayland_clipboard| features are included}
|
|+wayland_clipboard| features are included}
|
||||||
@ -1902,19 +1902,16 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
methods are:
|
methods are:
|
||||||
wayland Wayland selections
|
wayland Wayland selections
|
||||||
x11 X11 selections
|
x11 X11 selections
|
||||||
|
gui GUI specific method
|
||||||
Note: This option is ignored when either the GUI is running or if Vim
|
|
||||||
is run on a system without Wayland or X11 support, such as Windows or
|
|
||||||
macOS. The GUI or system way of accessing the clipboard is always
|
|
||||||
used instead.
|
|
||||||
|
|
||||||
The option value is a list of comma separated items. The list is
|
The option value is a list of comma separated items. The list is
|
||||||
parsed left to right in order, and the first method that Vim
|
parsed left to right in order, and the first method that Vim
|
||||||
determines is available or is working is used as the actual method for
|
determines is available or is working is used as the actual method for
|
||||||
accessing the clipboard.
|
accessing the clipboard. Setting this option to an empty value
|
||||||
|
disables the clipboard functionality on all systems.
|
||||||
|
|
||||||
The current method that is being used can be found in the |v:clipmethod|
|
The current method that is being used can be found in the
|
||||||
variable.
|
|v:clipmethod| variable.
|
||||||
|
|
||||||
*'cmdheight'* *'ch'*
|
*'cmdheight'* *'ch'*
|
||||||
'cmdheight' 'ch' number (default 1)
|
'cmdheight' 'ch' number (default 1)
|
||||||
|
|||||||
@ -41608,7 +41608,8 @@ Completion~
|
|||||||
|
|
||||||
Platform specific~
|
Platform specific~
|
||||||
-----------------
|
-----------------
|
||||||
- Support for Wayland UI and support for the Wayland clipboard has been added.
|
- Support for Wayland UI and support for the Wayland clipboard has been added
|
||||||
|
|wayland|.
|
||||||
|
|
||||||
- Support for the XDG Desktop Specification |xdg-base-dir| has been added and
|
- Support for the XDG Desktop Specification |xdg-base-dir| has been added and
|
||||||
the environment variable |$MYVIMDIR| is set to the users personal runtime
|
the environment variable |$MYVIMDIR| is set to the users personal runtime
|
||||||
@ -41829,6 +41830,7 @@ Options: ~
|
|||||||
'autocompletion' Enable auto completion |ins-autocompletion|
|
'autocompletion' Enable auto completion |ins-autocompletion|
|
||||||
'autocompletedelay' Delay in msec before menu appears after typing
|
'autocompletedelay' Delay in msec before menu appears after typing
|
||||||
'chistory' Size of the quickfix stack |quickfix-stack|.
|
'chistory' Size of the quickfix stack |quickfix-stack|.
|
||||||
|
'clipmethod' How to access the clipboard.
|
||||||
'completefuzzycollect' Enable fuzzy collection of candidates for (some)
|
'completefuzzycollect' Enable fuzzy collection of candidates for (some)
|
||||||
|ins-completion| modes
|
|ins-completion| modes
|
||||||
'completeitemalign' Order of |complete-items| in Insert mode completion
|
'completeitemalign' Order of |complete-items| in Insert mode completion
|
||||||
@ -41850,10 +41852,14 @@ Options: ~
|
|||||||
't_xo' Terminal uses XON/XOFF handshaking (e.g. vt420)
|
't_xo' Terminal uses XON/XOFF handshaking (e.g. vt420)
|
||||||
't_CF' Support for alternate font highlighting terminal code
|
't_CF' Support for alternate font highlighting terminal code
|
||||||
'winfixbuf' Keep buffer focused in a window
|
'winfixbuf' Keep buffer focused in a window
|
||||||
|
'wlseat' Specify Wayland seat to use for the |wayland| feature
|
||||||
|
'wlsteal' Steal focus to access the |wayland| clipboard
|
||||||
|
'wltimeout' Specify the connection timeout for the |wayland|
|
||||||
|
compositor
|
||||||
|
|
||||||
Vim Arguments: ~
|
Vim Arguments: ~
|
||||||
|-Y| Do not connect to the Wayland compositor.
|
|-Y| Do not connect to the |wayland| compositor.
|
||||||
|--clientserver| Specify backend for clientserver functionality.
|
|--clientserver| Specify backend for clientserver functionality.
|
||||||
|
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
*wayland.txt* For Vim version 9.1. Last change: 2025 Jun 28
|
*wayland.txt* For Vim version 9.1. Last change: 2025 Aug 18
|
||||||
|
|
||||||
|
|
||||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||||
@ -22,7 +22,7 @@ multiple Wayland seats in the same Wayland session.
|
|||||||
See |gui-wayland|. Please note that when using the GUI, Vim uses the toolkit
|
See |gui-wayland|. Please note that when using the GUI, Vim uses the toolkit
|
||||||
such as GTK for accessing the clipboard, and does not access the clipboard
|
such as GTK for accessing the clipboard, and does not access the clipboard
|
||||||
though Wayland. You can check this though the |v:clipmethod| variable, which
|
though Wayland. You can check this though the |v:clipmethod| variable, which
|
||||||
should equal to "none" when running the GUI.
|
should equal to "gui" when running the GUI.
|
||||||
|
|
||||||
Wayland commands:
|
Wayland commands:
|
||||||
*:wlrestore* *:wl*
|
*:wlrestore* *:wl*
|
||||||
@ -72,7 +72,7 @@ selections, see |wayland-primary-selection| for more details.
|
|||||||
*wayland-persist*
|
*wayland-persist*
|
||||||
If you use X11 cut buffers, no such things exist on Wayland. Instead to
|
If you use X11 cut buffers, no such things exist on Wayland. Instead to
|
||||||
emulate such functionality, a separate clipboard manager must be used in order
|
emulate such functionality, a separate clipboard manager must be used in order
|
||||||
to persist selection data when a Wayland client exists.
|
to persist selection data when a Wayland client exits.
|
||||||
|
|
||||||
*wayland-and-x11*
|
*wayland-and-x11*
|
||||||
If your version of Vim comes compiled with both X11 and Wayland support, then
|
If your version of Vim comes compiled with both X11 and Wayland support, then
|
||||||
|
|||||||
266
src/clipboard.c
266
src/clipboard.c
@ -142,32 +142,28 @@ clip_update_selection(Clipboard_T *clip)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
clip_gen_own_selection(Clipboard_T *cbd)
|
clip_gen_own_selection(Clipboard_T *cbd UNUSED)
|
||||||
{
|
{
|
||||||
#if defined(FEAT_XCLIPBOARD) || defined(FEAT_WAYLAND_CLIPBOARD)
|
if (clipmethod == CLIPMETHOD_GUI)
|
||||||
# ifdef FEAT_GUI
|
{
|
||||||
if (gui.in_use)
|
#ifdef FEAT_GUI
|
||||||
return clip_mch_own_selection(cbd);
|
if (gui.in_use)
|
||||||
else
|
return clip_mch_own_selection(cbd);
|
||||||
# endif
|
#endif
|
||||||
|
}
|
||||||
|
else if (clipmethod == CLIPMETHOD_WAYLAND)
|
||||||
{
|
{
|
||||||
if (clipmethod == CLIPMETHOD_WAYLAND)
|
|
||||||
{
|
|
||||||
#ifdef FEAT_WAYLAND_CLIPBOARD
|
#ifdef FEAT_WAYLAND_CLIPBOARD
|
||||||
return clip_wl_own_selection(cbd);
|
return clip_wl_own_selection(cbd);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (clipmethod == CLIPMETHOD_X11)
|
else if (clipmethod == CLIPMETHOD_X11)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_XCLIPBOARD
|
#ifdef FEAT_XCLIPBOARD
|
||||||
return clip_xterm_own_selection(cbd);
|
return clip_xterm_own_selection(cbd);
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return FAIL;
|
return FAIL;
|
||||||
#else
|
|
||||||
return clip_mch_own_selection(cbd);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -207,31 +203,27 @@ clip_own_selection(Clipboard_T *cbd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clip_gen_lose_selection(Clipboard_T *cbd)
|
clip_gen_lose_selection(Clipboard_T *cbd UNUSED)
|
||||||
{
|
{
|
||||||
#if defined(FEAT_XCLIPBOARD) || defined(FEAT_WAYLAND_CLIPBOARD)
|
if (clipmethod == CLIPMETHOD_GUI)
|
||||||
# ifdef FEAT_GUI
|
|
||||||
if (gui.in_use)
|
|
||||||
clip_mch_lose_selection(cbd);
|
|
||||||
else
|
|
||||||
# endif
|
|
||||||
{
|
{
|
||||||
if (clipmethod == CLIPMETHOD_WAYLAND)
|
#ifdef FEAT_GUI
|
||||||
{
|
if (gui.in_use)
|
||||||
#ifdef FEAT_WAYLAND_CLIPBOARD
|
clip_mch_lose_selection(cbd);
|
||||||
clip_wl_lose_selection(cbd);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
else if (clipmethod == CLIPMETHOD_X11)
|
|
||||||
{
|
|
||||||
#ifdef FEAT_XCLIPBOARD
|
|
||||||
clip_xterm_lose_selection(cbd);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#else
|
else if (clipmethod == CLIPMETHOD_WAYLAND)
|
||||||
clip_mch_lose_selection(cbd);
|
{
|
||||||
|
#ifdef FEAT_WAYLAND_CLIPBOARD
|
||||||
|
clip_wl_lose_selection(cbd);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
else if (clipmethod == CLIPMETHOD_X11)
|
||||||
|
{
|
||||||
|
#ifdef FEAT_XCLIPBOARD
|
||||||
|
clip_xterm_lose_selection(cbd);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1257,57 +1249,49 @@ clip_gen_set_selection(Clipboard_T *cbd)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if defined(FEAT_XCLIPBOARD) || defined(FEAT_WAYLAND_CLIPBOARD)
|
if (clipmethod == CLIPMETHOD_GUI)
|
||||||
# ifdef FEAT_GUI
|
|
||||||
if (gui.in_use)
|
|
||||||
clip_mch_set_selection(cbd);
|
|
||||||
else
|
|
||||||
# endif
|
|
||||||
{
|
{
|
||||||
if (clipmethod == CLIPMETHOD_WAYLAND)
|
#ifdef FEAT_GUI
|
||||||
{
|
if (gui.in_use)
|
||||||
#ifdef FEAT_WAYLAND_CLIPBOARD
|
clip_mch_set_selection(cbd);
|
||||||
clip_wl_set_selection(cbd);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
else if (clipmethod == CLIPMETHOD_X11)
|
|
||||||
{
|
|
||||||
#ifdef FEAT_XCLIPBOARD
|
|
||||||
clip_xterm_set_selection(cbd);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#else
|
else if (clipmethod == CLIPMETHOD_WAYLAND)
|
||||||
clip_mch_set_selection(cbd);
|
{
|
||||||
|
#ifdef FEAT_WAYLAND_CLIPBOARD
|
||||||
|
clip_wl_set_selection(cbd);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
else if (clipmethod == CLIPMETHOD_X11)
|
||||||
|
{
|
||||||
|
#ifdef FEAT_XCLIPBOARD
|
||||||
|
clip_xterm_set_selection(cbd);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clip_gen_request_selection(Clipboard_T *cbd)
|
clip_gen_request_selection(Clipboard_T *cbd UNUSED)
|
||||||
{
|
{
|
||||||
#if defined(FEAT_XCLIPBOARD) || defined(FEAT_WAYLAND_CLIPBOARD)
|
if (clipmethod == CLIPMETHOD_GUI)
|
||||||
# ifdef FEAT_GUI
|
|
||||||
if (gui.in_use)
|
|
||||||
clip_mch_request_selection(cbd);
|
|
||||||
else
|
|
||||||
# endif
|
|
||||||
{
|
{
|
||||||
if (clipmethod == CLIPMETHOD_WAYLAND)
|
# ifdef FEAT_GUI
|
||||||
{
|
if (gui.in_use)
|
||||||
#ifdef FEAT_WAYLAND_CLIPBOARD
|
clip_mch_request_selection(cbd);
|
||||||
clip_wl_request_selection(cbd);
|
# endif
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else if (clipmethod == CLIPMETHOD_X11)
|
|
||||||
{
|
|
||||||
#ifdef FEAT_XCLIPBOARD
|
|
||||||
clip_xterm_request_selection(cbd);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#else
|
else if (clipmethod == CLIPMETHOD_WAYLAND)
|
||||||
clip_mch_request_selection(cbd);
|
{
|
||||||
|
#ifdef FEAT_WAYLAND_CLIPBOARD
|
||||||
|
clip_wl_request_selection(cbd);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
else if (clipmethod == CLIPMETHOD_X11)
|
||||||
|
{
|
||||||
|
#ifdef FEAT_XCLIPBOARD
|
||||||
|
clip_xterm_request_selection(cbd);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (defined(FEAT_X11) && defined(FEAT_XCLIPBOARD) && defined(USE_SYSTEM)) \
|
#if (defined(FEAT_X11) && defined(FEAT_XCLIPBOARD) && defined(USE_SYSTEM)) \
|
||||||
@ -1324,31 +1308,28 @@ clip_x11_owner_exists(Clipboard_T *cbd)
|
|||||||
int
|
int
|
||||||
clip_gen_owner_exists(Clipboard_T *cbd UNUSED)
|
clip_gen_owner_exists(Clipboard_T *cbd UNUSED)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_XCLIPBOARD
|
if (clipmethod == CLIPMETHOD_OTHER)
|
||||||
# ifdef FEAT_GUI_GTK
|
|
||||||
if (gui.in_use)
|
|
||||||
return clip_gtk_owner_exists(cbd);
|
|
||||||
else
|
|
||||||
# endif
|
|
||||||
{
|
{
|
||||||
if (clipmethod == CLIPMETHOD_WAYLAND)
|
# ifdef FEAT_GUI_GTK
|
||||||
{
|
if (gui.in_use)
|
||||||
#ifdef FEAT_WAYLAND_CLIPBOARD
|
return clip_gtk_owner_exists(cbd);
|
||||||
return clip_wl_owner_exists(cbd);
|
# endif
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else if (clipmethod == CLIPMETHOD_X11)
|
|
||||||
{
|
|
||||||
#ifdef FEAT_XCLIPBOARD
|
|
||||||
return clip_x11_owner_exists(cbd);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
#else
|
else if (clipmethod == CLIPMETHOD_WAYLAND)
|
||||||
return TRUE;
|
{
|
||||||
#endif
|
# ifdef FEAT_WAYLAND_CLIPBOARD
|
||||||
|
return clip_wl_owner_exists(cbd);
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
else if (clipmethod == CLIPMETHOD_X11)
|
||||||
|
{
|
||||||
|
# ifdef FEAT_XCLIPBOARD
|
||||||
|
return clip_x11_owner_exists(cbd);
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return FALSE;
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -2735,25 +2716,42 @@ get_clipmethod(char_u *str)
|
|||||||
|
|
||||||
if (STRCMP(buf, "wayland") == 0)
|
if (STRCMP(buf, "wayland") == 0)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_WAYLAND_CLIPBOARD
|
#ifdef FEAT_GUI
|
||||||
if (wayland_cb_is_ready())
|
if (!gui.in_use)
|
||||||
method = CLIPMETHOD_WAYLAND;
|
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
|
#ifdef FEAT_WAYLAND_CLIPBOARD
|
||||||
|
if (wayland_cb_is_ready())
|
||||||
|
method = CLIPMETHOD_WAYLAND;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (STRCMP(buf, "x11") == 0)
|
else if (STRCMP(buf, "x11") == 0)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_XCLIPBOARD
|
#ifdef FEAT_GUI
|
||||||
// x_IOerror_handler() in os_unix.c should set xterm_dpy to NULL if
|
if (!gui.in_use)
|
||||||
// we lost connection to the X server.
|
#endif
|
||||||
if (xterm_dpy != NULL)
|
|
||||||
{
|
{
|
||||||
// If the X connection is lost then that handler will longjmp
|
#ifdef FEAT_XCLIPBOARD
|
||||||
// somewhere else, in that case we will call choose_clipmethod()
|
// x_IOerror_handler() in os_unix.c should set xterm_dpy to NULL
|
||||||
// again from there, and this if block won't be executed since
|
// if we lost connection to the X server.
|
||||||
// xterm_dpy will be set to NULL.
|
if (xterm_dpy != NULL)
|
||||||
xterm_update();
|
{
|
||||||
method = CLIPMETHOD_X11;
|
// If the X connection is lost then that handler will
|
||||||
|
// longjmp somewhere else, in that case we will call
|
||||||
|
// choose_clipmethod() again from there, and this if block
|
||||||
|
// won't be executed since xterm_dpy will be set to NULL.
|
||||||
|
xterm_update();
|
||||||
|
method = CLIPMETHOD_X11;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else if (STRCMP(buf, "gui") == 0)
|
||||||
|
{
|
||||||
|
#ifdef FEAT_GUI
|
||||||
|
if (gui.in_use)
|
||||||
|
method = CLIPMETHOD_GUI;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2779,17 +2777,19 @@ exit:
|
|||||||
/*
|
/*
|
||||||
* Returns name of clipmethod in a statically allocated string.
|
* Returns name of clipmethod in a statically allocated string.
|
||||||
*/
|
*/
|
||||||
static char *
|
static char_u *
|
||||||
clipmethod_to_str(clipmethod_T method)
|
clipmethod_to_str(clipmethod_T method)
|
||||||
{
|
{
|
||||||
switch(method)
|
switch(method)
|
||||||
{
|
{
|
||||||
case CLIPMETHOD_WAYLAND:
|
case CLIPMETHOD_WAYLAND:
|
||||||
return "wayland";
|
return (char_u *)"wayland";
|
||||||
case CLIPMETHOD_X11:
|
case CLIPMETHOD_X11:
|
||||||
return "x11";
|
return (char_u *)"x11";
|
||||||
|
case CLIPMETHOD_GUI:
|
||||||
|
return (char_u *)"gui";
|
||||||
default:
|
default:
|
||||||
return "none";
|
return (char_u *)"none";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2807,29 +2807,13 @@ choose_clipmethod(void)
|
|||||||
if (method == CLIPMETHOD_FAIL)
|
if (method == CLIPMETHOD_FAIL)
|
||||||
return e_invalid_argument;
|
return e_invalid_argument;
|
||||||
|
|
||||||
// If GUI is running or we are not on a system with Wayland or X11, then always
|
#if defined(FEAT_GUI) && defined(FEAT_WAYLAND)
|
||||||
// return CLIPMETHOD_NONE. System or GUI clipboard handling always overrides.
|
if (method == CLIPMETHOD_GUI)
|
||||||
#if defined(FEAT_XCLIPBOARD) || defined(FEAT_WAYLAND_CLIPBOARD)
|
|
||||||
#if defined(FEAT_GUI)
|
|
||||||
if (gui.in_use)
|
|
||||||
{
|
|
||||||
#ifdef FEAT_WAYLAND
|
|
||||||
// We only interact with Wayland for the clipboard, we can just deinit
|
// We only interact with Wayland for the clipboard, we can just deinit
|
||||||
// everything.
|
// everything.
|
||||||
wayland_uninit_client();
|
wayland_uninit_client();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
method = CLIPMETHOD_NONE;
|
|
||||||
goto lose_sel_exit;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
// If on a system like windows or macos, then clipmethod is irrelevant, we
|
|
||||||
// use their way of accessing the clipboard.
|
|
||||||
method = CLIPMETHOD_NONE;
|
|
||||||
goto exit;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Deinitialize clipboard if there is no way to access clipboard
|
// Deinitialize clipboard if there is no way to access clipboard
|
||||||
if (method == CLIPMETHOD_NONE)
|
if (method == CLIPMETHOD_NONE)
|
||||||
clip_init(FALSE);
|
clip_init(FALSE);
|
||||||
@ -2844,24 +2828,16 @@ choose_clipmethod(void)
|
|||||||
// Disown clipboard if we are switching to a new method
|
// Disown clipboard if we are switching to a new method
|
||||||
if (clipmethod != CLIPMETHOD_NONE && method != clipmethod)
|
if (clipmethod != CLIPMETHOD_NONE && method != clipmethod)
|
||||||
{
|
{
|
||||||
#if (defined(FEAT_XCLIPBOARD) || defined(FEAT_WAYLAND_CLIPBOARD)) \
|
|
||||||
&& defined(FEAT_GUI)
|
|
||||||
lose_sel_exit:
|
|
||||||
#endif
|
|
||||||
if (clip_star.owned)
|
if (clip_star.owned)
|
||||||
clip_lose_selection(&clip_star);
|
clip_lose_selection(&clip_star);
|
||||||
if (clip_plus.owned)
|
if (clip_plus.owned)
|
||||||
clip_lose_selection(&clip_plus);
|
clip_lose_selection(&clip_plus);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(FEAT_XCLIPBOARD) && !defined(FEAT_WAYLAND_CLIPBOARD)
|
|
||||||
exit:
|
|
||||||
#endif
|
|
||||||
|
|
||||||
clipmethod = method;
|
clipmethod = method;
|
||||||
|
|
||||||
#ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
set_vim_var_string(VV_CLIPMETHOD, (char_u*)clipmethod_to_str(method), -1);
|
set_vim_var_string(VV_CLIPMETHOD, clipmethod_to_str(method), -1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
@ -147,7 +147,7 @@ gui_start(char_u *arg UNUSED)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
// Reset clipmethod to CLIPMETHOD_NONE
|
// Reset clipmethod to CLIPMETHOD_GUI
|
||||||
choose_clipmethod();
|
choose_clipmethod();
|
||||||
|
|
||||||
#ifdef FEAT_SOCKETSERVER
|
#ifdef FEAT_SOCKETSERVER
|
||||||
|
|||||||
@ -634,11 +634,11 @@ static struct vimoption options[] =
|
|||||||
#ifdef FEAT_CLIPBOARD
|
#ifdef FEAT_CLIPBOARD
|
||||||
(char_u *)&p_cpm, PV_NONE, did_set_clipmethod, expand_set_clipmethod,
|
(char_u *)&p_cpm, PV_NONE, did_set_clipmethod, expand_set_clipmethod,
|
||||||
# ifdef UNIX
|
# ifdef UNIX
|
||||||
{(char_u *)"wayland,x11", (char_u *)0L}
|
{(char_u *)"wayland,x11,gui", (char_u *)0L}
|
||||||
# elif defined(VMS)
|
# elif defined(VMS)
|
||||||
{(char_u *)"x11", (char_u *)0L}
|
{(char_u *)"x11,gui", (char_u *)0L}
|
||||||
# else
|
# else
|
||||||
{(char_u *)"", (char_u *)0L}
|
{(char_u *)"gui", (char_u *)0L}
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
(char_u *)NULL, PV_NONE, NULL, NULL,
|
(char_u *)NULL, PV_NONE, NULL, NULL,
|
||||||
|
|||||||
@ -45,7 +45,7 @@ static char *(p_ff_values[]) = {FF_UNIX, FF_DOS, FF_MAC, NULL};
|
|||||||
// Note: Keep this in sync with did_set_clipboard()
|
// Note: Keep this in sync with did_set_clipboard()
|
||||||
static char *(p_cb_values[]) = {"unnamed", "unnamedplus", "autoselect", "autoselectplus", "autoselectml", "html", "exclude:", NULL};
|
static char *(p_cb_values[]) = {"unnamed", "unnamedplus", "autoselect", "autoselectplus", "autoselectml", "html", "exclude:", NULL};
|
||||||
// Note: Keep this in sync with get_clipmethod()
|
// Note: Keep this in sync with get_clipmethod()
|
||||||
static char *(p_cpm_values[]) = {"wayland", "x11", NULL};
|
static char *(p_cpm_values[]) = {"wayland", "x11", "gui", NULL};
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_CRYPT
|
#ifdef FEAT_CRYPT
|
||||||
static char *(p_cm_values[]) = {"zip", "blowfish", "blowfish2",
|
static char *(p_cm_values[]) = {"zip", "blowfish", "blowfish2",
|
||||||
|
|||||||
@ -1,14 +1,12 @@
|
|||||||
" Tests for clipmethod
|
" Tests for clipmethod
|
||||||
|
|
||||||
source util/window_manager.vim
|
if has('unix')
|
||||||
|
source util/window_manager.vim
|
||||||
CheckFeature clipboard_working
|
endif
|
||||||
CheckFeature xterm_clipboard
|
|
||||||
CheckFeature wayland_clipboard
|
|
||||||
CheckUnix
|
|
||||||
|
|
||||||
" Test if no available clipmethod sets v:clipmethod to none and deinits clipboard
|
" Test if no available clipmethod sets v:clipmethod to none and deinits clipboard
|
||||||
func Test_no_clipmethod_sets_v_clipmethod_none()
|
func Test_no_clipmethod_sets_v_clipmethod_none()
|
||||||
|
CheckFeature clipboard_working
|
||||||
CheckNotGui
|
CheckNotGui
|
||||||
|
|
||||||
set clipmethod=
|
set clipmethod=
|
||||||
@ -19,6 +17,9 @@ endfunc
|
|||||||
" Test if method chosen is in line with clipmethod order
|
" Test if method chosen is in line with clipmethod order
|
||||||
func Test_clipmethod_order()
|
func Test_clipmethod_order()
|
||||||
CheckNotGui
|
CheckNotGui
|
||||||
|
CheckFeature clipboard_working
|
||||||
|
CheckFeature xterm_clipboard
|
||||||
|
CheckFeature wayland_clipboard
|
||||||
|
|
||||||
set cpm=wayland,x11
|
set cpm=wayland,x11
|
||||||
|
|
||||||
@ -62,12 +63,12 @@ func Test_clipmethod_order()
|
|||||||
call EndWaylandCompositor(l:wayland_display)
|
call EndWaylandCompositor(l:wayland_display)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test if clipmethod is set to 'none' when gui is started
|
" Test if clipmethod is set to 'gui' when gui is started
|
||||||
func Test_clipmethod_is_none_when_gui()
|
func Test_clipmethod_is_gui_when_gui_started()
|
||||||
CheckCanRunGui
|
CheckCanRunGui
|
||||||
|
CheckFeature clipboard_working
|
||||||
|
|
||||||
let lines =<< trim END
|
let lines =<< trim END
|
||||||
set cpm=wayland,x11
|
|
||||||
call writefile([v:clipmethod != ""], 'Cbdscript')
|
call writefile([v:clipmethod != ""], 'Cbdscript')
|
||||||
gui -f
|
gui -f
|
||||||
call writefile([v:clipmethod], 'Cbdscript', 'a')
|
call writefile([v:clipmethod], 'Cbdscript', 'a')
|
||||||
@ -78,12 +79,15 @@ func Test_clipmethod_is_none_when_gui()
|
|||||||
|
|
||||||
call writefile(lines, 'Cbdscript', 'D')
|
call writefile(lines, 'Cbdscript', 'D')
|
||||||
call system($'{GetVimCommand()} -S Cbdscript')
|
call system($'{GetVimCommand()} -S Cbdscript')
|
||||||
call assert_equal(['1', 'none', 'none'], readfile('Cbdscript'))
|
call assert_equal(['1', 'gui', 'gui'], readfile('Cbdscript'))
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test if :clipreset switches methods when current one doesn't work
|
" Test if :clipreset switches methods when current one doesn't work
|
||||||
func Test_clipreset_switches()
|
func Test_clipreset_switches()
|
||||||
CheckNotGui
|
CheckNotGui
|
||||||
|
CheckFeature clipboard_working
|
||||||
|
CheckFeature xterm_clipboard
|
||||||
|
CheckFeature wayland_clipboard
|
||||||
CheckFeature clientserver
|
CheckFeature clientserver
|
||||||
CheckXServer
|
CheckXServer
|
||||||
CheckWaylandCompositor
|
CheckWaylandCompositor
|
||||||
|
|||||||
@ -529,7 +529,7 @@ func Test_set_completion_string_values()
|
|||||||
if has('unix') || has('vms')
|
if has('unix') || has('vms')
|
||||||
call assert_match('wayland', getcompletion('set clipmethod=', 'cmdline')[1])
|
call assert_match('wayland', getcompletion('set clipmethod=', 'cmdline')[1])
|
||||||
else
|
else
|
||||||
call assert_match('wayland', getcompletion('set clipmethod=', 'cmdline')[0])
|
call assert_match('gui', getcompletion('set clipmethod=', 'cmdline')[0])
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
call assert_equal('.', getcompletion('set complete=', 'cmdline')[1])
|
call assert_equal('.', getcompletion('set complete=', 'cmdline')[1])
|
||||||
|
|||||||
@ -724,6 +724,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1652,
|
||||||
/**/
|
/**/
|
||||||
1651,
|
1651,
|
||||||
/**/
|
/**/
|
||||||
|
|||||||
Reference in New Issue
Block a user