diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-01-02 03:41:36 -0500 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2020-01-02 00:41:36 -0800 |
commit | 67d7906652e8511f28882fb64b5b3317da93e29a (patch) | |
tree | 50639dc0973f452d23c0112ae9ea1545a6fab5ec | |
parent | 391706450445fc040d3b3766ace7d91ec13b1936 (diff) | |
download | rneovim-67d7906652e8511f28882fb64b5b3317da93e29a.tar.gz rneovim-67d7906652e8511f28882fb64b5b3317da93e29a.tar.bz2 rneovim-67d7906652e8511f28882fb64b5b3317da93e29a.zip |
clipboard: close stdout when copying via xclip #11617
test_registers.vim can fail even if a clipboard manager is running.
If a clipboard manager is not running, this test always fails with xclip.
Use xsel as a workaround.
https://github.com/astrand/xclip/issues/20 suggests closing stdout
when sending input via stdin.
Environment
- Ubuntu Xenial
- Vim 7.4 (any app with broken clipboard code will do)
- Neovim nightly
Steps to reproduce:
0. Start the clipboard manager.
1. Open a file in Vim on Linux.
Vim should have +clipboard enabled.
'set clipboard='
2. Yank some text to the clipboard register.
3. Quit Vim.
4. Run 'cd /path/to/neovim/repo/'
5. Run 'make oldtest'.
Do not run any individual tests.
They likely pass with or without this fix.
Before fix: test_registers.vim can fail.
After fix: test_registers.vim always passes.
Close https://github.com/neovim/neovim/issues/7958
https://wiki.ubuntu.com/ClipboardPersistence#The_state_of_things
-rw-r--r-- | runtime/autoload/provider/clipboard.vim | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/runtime/autoload/provider/clipboard.vim b/runtime/autoload/provider/clipboard.vim index e33dc31f6d..e54d6ad95c 100644 --- a/runtime/autoload/provider/clipboard.vim +++ b/runtime/autoload/provider/clipboard.vim @@ -172,6 +172,11 @@ function! s:clipboard.set(lines, regtype, reg) abort if jobid > 0 call jobsend(jobid, a:lines) call jobclose(jobid, 'stdin') + " xclip does not close stdout,stderr when receiving input via stdin + if argv[0] ==# 'xclip' + call jobclose(jobid, 'stdout') + call jobclose(jobid, 'stderr') + endif let selection.owner = jobid let ret = 1 else |