0
0
mirror of https://github.com/vim/vim.git synced 2025-10-26 09:14:23 -04:00

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:
Foxe Chen
2025-08-18 22:09:27 +02:00
committed by Christian Brabandt
parent 96b2154b73
commit 3e152c76ad
12 changed files with 169 additions and 182 deletions

View File

@@ -1,14 +1,12 @@
" Tests for clipmethod
source util/window_manager.vim
CheckFeature clipboard_working
CheckFeature xterm_clipboard
CheckFeature wayland_clipboard
CheckUnix
if has('unix')
source util/window_manager.vim
endif
" Test if no available clipmethod sets v:clipmethod to none and deinits clipboard
func Test_no_clipmethod_sets_v_clipmethod_none()
CheckFeature clipboard_working
CheckNotGui
set clipmethod=
@@ -19,6 +17,9 @@ endfunc
" Test if method chosen is in line with clipmethod order
func Test_clipmethod_order()
CheckNotGui
CheckFeature clipboard_working
CheckFeature xterm_clipboard
CheckFeature wayland_clipboard
set cpm=wayland,x11
@@ -62,12 +63,12 @@ func Test_clipmethod_order()
call EndWaylandCompositor(l:wayland_display)
endfunc
" Test if clipmethod is set to 'none' when gui is started
func Test_clipmethod_is_none_when_gui()
" Test if clipmethod is set to 'gui' when gui is started
func Test_clipmethod_is_gui_when_gui_started()
CheckCanRunGui
CheckFeature clipboard_working
let lines =<< trim END
set cpm=wayland,x11
call writefile([v:clipmethod != ""], 'Cbdscript')
gui -f
call writefile([v:clipmethod], 'Cbdscript', 'a')
@@ -78,12 +79,15 @@ func Test_clipmethod_is_none_when_gui()
call writefile(lines, 'Cbdscript', 'D')
call system($'{GetVimCommand()} -S Cbdscript')
call assert_equal(['1', 'none', 'none'], readfile('Cbdscript'))
call assert_equal(['1', 'gui', 'gui'], readfile('Cbdscript'))
endfunc
" Test if :clipreset switches methods when current one doesn't work
func Test_clipreset_switches()
CheckNotGui
CheckFeature clipboard_working
CheckFeature xterm_clipboard
CheckFeature wayland_clipboard
CheckFeature clientserver
CheckXServer
CheckWaylandCompositor

View File

@@ -529,7 +529,7 @@ func Test_set_completion_string_values()
if has('unix') || has('vms')
call assert_match('wayland', getcompletion('set clipmethod=', 'cmdline')[1])
else
call assert_match('wayland', getcompletion('set clipmethod=', 'cmdline')[0])
call assert_match('gui', getcompletion('set clipmethod=', 'cmdline')[0])
endif
endif
call assert_equal('.', getcompletion('set complete=', 'cmdline')[1])