goneovim
goneovim copied to clipboard
goneovim window does not close with latest neovim releases
Steps to reproduce:
- Download Nvim development (prerelease) build and install it
- open any file in goneovim
- make change, then
:wq
Expected: file saved, then goneovim closed Problem: goneovim window isn't closed. The neovim process (ps ax) does not exist, but goneovim process still exists.
It is not goneovim specific, nvui also has it, but not nvim-qt. Seems, something changed in nvim API.
Hi, Thanks for this issue report. I cannot reproduce the problem on my machine using the steps you provided. I think the problem may be related to a specific plugin.
Is the problem reproducible with the following steps?
- Run goneovim with the following
/path/to/goneovim -u NONE /path/to/file
- make change, then :wq
@akiyosi You right, it works without plugins. Strange that same plugins used with neovim-qt without any problem. I will check my plugins. P.S. Will you add binaries for Ubuntu 20.04 (older libc)?
@damanis Thanks, it would be useful to know which plugins are affecting the problem.
P.S. Will you add binaries for Ubuntu 20.04 (older libc)?
Would this one work?
https://github.com/akiyosi/goneovim/actions/runs/3992430747
@akiyosi
I found that problem is not in plugin, but in set clipboard command vim.o.clipboard = [[unnamed]]
If comment out it, the problem is not reproduced (but without it PRIMARY selection does not work).
Since neovim-qt works properly with clipboard
command, it sound like problem in goneovim.
Would this one work? https://github.com/akiyosi/goneovim/actions/runs/3992430747
Yes, this image works.
@damanis Thanks for info!
In other words, am I correct in understanding that the problem is reproduced in your environment by the following steps?
- Run goneovim with the following
/path/to/goneovim -u NONE --cmd 'set clipboard=unnamed' /path/to/file
- make change, then :wq
@akiyosi Yes, these steps cause the problem.
@damanis I have tried to reproduce the problem on my MacOS, archlinux and pop!os machines, but have not been able to reproduce it at this time.
I am thinking that perhaps it has something to do with the clipboard provider. What is the neovim clipboard provider on your system?
Reading :h provider-clipboard
, it seems that on Linux, there are wl-copy
, wl-paste
, xclip
, etc.
@akiyosi
Since commit b042f6d90
neovim prefer xsel
. I have it installed.
:checkhealth
...
Clipboard (optional) ~
- OK Clipboard tool found: xsel
...
I also test with xclip
- same behavior.
Seems, any operation with clipboard cause the problem, not change then read only. The goneovim
just wait until xsel
exists.
@akiyosi
I see /usr/bin/xsel --nodetach -i -p
in ps ax
output when goneovim exits. This command tries copy selection to primary buffer, but, seems, the selection is empty, so goneovim can't exit, because of it waits xsel
finishes. If double click (i.e., select something) on any word, for example, in a terminal, goneovim immediately exits.
@akiyosi
May be this will help.
The workaround clears primary selection buffer before exit. It is default behavior in vim
(as I know, it according freedesktop specification), but changed in neovim
(nvim-qt
successfully saves primary selection on exit).
if vim.g.goneovim then
-- Workaround: clear primary before exit
vim.api.nvim_exec([[
:autocmd VimLeavePre * call setreg('*', [])
]], false)
end
@damanis
Thanks for the info. What are your settings.toml
settings?
@damanis
goneovim adds the following settings if Clipboard = true
and the default value is true
https://github.com/akiyosi/goneovim/blob/d91125000f3aa70b1d34a08a8c8a963b05b5d813/editor/workspace.go#L766
If this clipboard setting is enabled, Goneovim will copy the yanked text to the clipboard using https://github.com/atotto/clipboard; on Linux, this copying seems to be done using xsel
.
Perhaps you can work around this problem by adding the following to settings.toml It is arguable whether the default value should be true or false.
[Editor]
# Copy yanked text to clipboard
Clipboard = false
@akiyosi
I have clipboard = false
in ~/.config/goneovim/settings.toml
- it doesn't help.
I compared goneovim
and nvim-qt
behavior on exit by execsnoop-bpfcc
(it show execv
calls): goneovim
calls /usr/bin/xsel --nodetach -i -p
at exit, while nvim-qt
doesn't, so it doesn't stuck.
nvim-qt
doesn't touch primary selection, so previously copied content exists in primary selection after nvim-qt
exit.
@akiyosi
As I understand, clipboard
module copy primary selection
to clipboard
. This is another action, not what xsel --nodetach -i -p
does: the xsel
call copies nvim's *
register to primary selection
.
I think the problem causes, because of nvim
process already exited, so *
register isn't accessible. The proper behavior, seems, is do not call xsel
at exit like nvim-qt
does.
@damanis Can you post the file contents of your settings.toml?
[Editor]
WindowGeometryBasedOnFontmetrics = true
IgnoreFirstMouseClickWhenAppInactivated = false
Width = 900
Height = 780
LineToScroll = 3
FontFamily = "GoMono Nerd Font Mono"
FontSize = 11
ExtPopupmenu = true
CachedDrawing = true
DisableLigatures = false
Clipboard = false
[Cursor]
SmoothMove = false
[Palette]
[Message]
[Statusline]
Visible = false
[Tabline]
Visible = false
[Popupmenu]
[ScrollBar]
Visible = false
[MiniMap]
Disable = true
[Markdown]
Disable = true
[SideBar]
Visible = false
[FileExplore]
[Workspace]
RestoreSession = false
@damanis Thank you. I have identified the direct cause code. I am looking into ways to resolve the issue.
Ummm, It seems to be the cause is that the following autocmd. But I have no idea why this autocmd causes such problems...
https://github.com/akiyosi/goneovim/blob/eb1ed9b5ad0e581202bfecf88616a33672ef93e8/editor/workspace.go#L753
I believe you can confirm that the problem does not occur by executing the following command to override the above autocmd after starting goneovim.
:aug Goneovim | au! | aug END
After start goneovim, I entered :aug Goneovim | au! | aug END
, then make changes and :wq
- problem reproduced.
Really? The problem does not reproduce in my Linux environment. I don't understand it even more. I will continue to investigate.
Tested again - reproduced. Goneovim
waits until xsel
exits as written above. Workaround with clearing *
register works.
Could you reproduce the problem with the following binaries?
https://github.com/akiyosi/goneovim/actions/runs/4134917312
Yes, reproduced, also after aug
command you provided.
@damanis Thanks for confirming. Hmmm, so the problem I was able to reproduce in my environment and the problem in yours is the same problem, but the cause is slightly different.
If you exec both of the following commands in your environment, do you reproduce the problem? This will disable all autocmd's that Goneovim needs, so Goneovim may not work properly, but it will isolate the problem.
:aug Goneovim | au! | aug END
:aug GoneovimCore | au! | aug END
@akiyosi
I tested on Ubuntu 22: after goneovim
started, I entered two commands your provided - problem reproduced.
It possible, that the problem not in goneovim
hooks, but in QT code: may be, it need to configure some QT option. I tried find something in neovim-qt
code (it works with new nvim
releases), but didn't find any yet.
@damanis The contents of the commit on the neovim side that triggered this problem may tell us something. Do you know the hash value of the commit?
@akiyosi
I'm not sure what exactly commit. I thought it is b042f6d9022
, but it too old, after it was no problem.
I see problem only in GUI uses QT (excluding neovim-qt), all other neovim GUI works properly.
I run goneovim with --debug
.
After :wq
last two line in log should be:
Received GUI event from neovim
The application was quitted with the exit of Neovim.
If problem occurs, second line added only after I select some word by mouse.
@akiyosi
I found that problem xsel
process ran by jobstart
command from
runtime/autoload/provider/clipboard.vim (from neovim package):
let jobid = jobstart(selection.argv, selection)
@damanis
Thanks for this info.
I noticed that a change directly related to clipboard is trivial on the commit history in neovim repo.
The changes in clipboard.vim
seems to be included in this kind of changes.
I will make time to investigate with bisect.
b042f6d 2022-11-07 11:46 +0800 wzy fix(clipboard): prefer xsel #20918
ef1d291 2022-11-09 16:21 -0700 Gregory Anders fix(clipboard): update version regex pattern (#21012)
fdeb20d 2022-11-18 15:39 +0000 XDream8 feat(clipboard): added wayclip support (#21091)
5529b07 2023-01-04 07:17 +0800 zeertzjq fix(clipboard): show provider warning when not during batch changes #21451
@damanis Here is a follow-up report on the survey results. I have identified the neovim commit where this problem began to occur as https://github.com/neovim/neovim/commit/1d16bba4d8b8b648d2dabd610924bcf3051a0f29. I have also identified the code for the problem on the Goneovim side.
I am currently working on a fix.