rohit-px2/nvui

nvui window does not close with latest neovim releases.

damanis opened this issue · 4 comments

Steps to reproduce:

Expected: file saved, then nvui closed
Problem: nvui window isn't closed. The neovim process (ps ax) does not exist, but nvui process still exists.

It is not nvui specific, goneovim also has it, but not nvim-qt. Seems, something changed in nvim API.

It relates to configuration option o.clipboard = [[unnamed]] in nvim init file.
When the option is commented out, there is no problem, but it required for PRIMARY selection support.

Also, the problem caused by any clipboard operation, not change/save only.

At exit the /usr/bin/xsel --nodetach -i -p is called to save * register to primary selection. Same for + register (system clipboard).
By default, primary selection of X application should be lost when the application exists, but neovim changed this behavior and tries save it. The workaround below prevents nvui stuck at exit.

if vim.g.nvui then
  -- Workaround: clear primary before exit
  vim.api.nvim_exec([[
    :autocmd VimLeavePre * call setreg('*', [])
    :autocmd VimLeavePre * call setreg('+', [])
  ]], false)

Seems, it caused by neovim/neovim@1d16bba