Commit: patch 9.2.0941: tests: clipboard tests fail in the GUI when the terminal has no clipboard
Christian Brabandt <[email protected]> Tue, 11 Aug 2026 21:30:09 +0200
| Newsgroups | gmane.editors.vim.devel |
|---|---|
| Message-ID | <[email protected]> |
patch 9.2.0941: tests: clipboard tests fail in the GUI when the terminal has no clipboard Commit: https://github.com/vim/vim/commit/ed5302530bf379b295db2d1eb5731d4ce5173fbb Author: Hirohito Higashi <[email protected]> Date: Tue Aug 11 19:27:07 2026 +0000 patch 9.2.0941: tests: clipboard tests fail in the GUI when the terminal has no clipboard Problem: Tests that need the clipboard in a Vim started with RunVimInTerminal() are not skipped when only the Vim running the tests has a clipboard, which is always the case in the GUI. Solution: Add CheckClipboardInTerminal to ask a Vim started the same way whether it can use the clipboard. (Hirohito Higashi). closes: #21008 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Signed-off-by: Hirohito Higashi <[email protected]> Signed-off-by: Foxe Chen <[email protected]> Signed-off-by: Christian Brabandt <[email protected]> diff --git a/src/testdir/test_hlsearch.vim b/src/testdir/test_hlsearch.vim index 8bf7f0aae..df54b8b89 100644 --- a/src/testdir/test_hlsearch.vim +++ b/src/testdir/test_hlsearch.vim @@ -95,6 +95,7 @@ func Test_hlsearch_clipboard() CheckScreendump CheckRunVimInTerminal CheckFeature clipboard_working + CheckClipboardInTerminal let lines =<< trim END set incsearch hlsearch diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim index 61af5e050..e751d82dc 100644 --- a/src/testdir/test_popupwin.vim +++ b/src/testdir/test_popupwin.vim @@ -921,6 +921,7 @@ endfunc func Test_popup_select() CheckScreendump CheckFeature clipboard_working + CheckClipboardInTerminal " create a popup with some text to be selected let lines =<< trim END diff --git a/src/testdir/util/check.vim b/src/testdir/util/check.vim index 47fea7edf..7400563f5 100644 --- a/src/testdir/util/check.vim +++ b/src/testdir/util/check.vim @@ -193,6 +193,25 @@ func CheckRunVimInTerminal() endif endfunc +" Command to check that the Vim started by RunVimInTerminal() can use the +" clipboard. Checking 'clipboard_working' of the Vim that runs the tests is +" not enough: in the GUI that Vim always has a clipboard, while the Vim +" started in a terminal window may not have one. +command CheckClipboardInTerminal call CheckClipboardInTerminal() +func CheckClipboardInTerminal() + if !exists('s:clipboard_in_terminal') + call delete('Xclipcheck') + " "-v" is needed because in a GUI test run the command from "vimcmd" + " starts the GUI, which always has a clipboard. + call RunVim([], ['call writefile([has("clipboard_working")], "Xclipcheck")', 'qall!'], '-v') + let s:clipboard_in_terminal = filereadable('Xclipcheck') && readfile('Xclipcheck')->get(0, '0') == '1' + call delete('Xclipcheck') + endif + if !s:clipboard_in_terminal + throw 'Skipped: Vim in a terminal window cannot use the clipboard' + endif +endfunc + " Command to check that we can run the GUI command CheckCanRunGui call CheckCanRunGui() func CheckCanRunGui() diff --git a/src/version.c b/src/version.c index 5ea5c96e2..103220d09 100644 --- a/src/version.c +++ b/src/version.c @@ -763,6 +763,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 941, /**/ 940, /**/ -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/vim_dev/E1wtsAr-007aK3-7P%40256bit.org.