Closed damanis closed 1 year ago
Seems, need notify nvim process about exit.
Also, need to let user save changes (nvim provides confirm qa
command).
@akiyosi I tried this patch. It works when file saved, but goneovim window stucks if file has unsaved changes.
diff --git a/editor/editor.go b/editor/editor.go
index 8902918..9a3439e 100644
--- a/editor/editor.go
+++ b/editor/editor.go
@@ -328,6 +328,16 @@ func InitEditor(options Options, args []string) {
// When an application is closed with the Close button
e.window.ConnectCloseEvent(func(event *gui.QCloseEvent) {
e.putLog("The application was closed outside of Neovim's commands, such as the Close button.")
+ for _, ws := range e.workspaces {
+ ftChan := make(chan error)
+ go func() {
+ err = ws.nvim.Command("confirm qa");
+ ftChan <-err;
+ }()
+ select {
+ case <-ftChan:
+ }
+ }
e.cleanup()
e.saveSessions()
if runtime.GOOS == "darwin" {
@damanis Thanks for this report! I was inspired by your patch and have created a patch to remedy this issue.
https://github.com/akiyosi/goneovim/commit/675445273170c0a259fa1c706c7448222adcb16d
I tried this patch. It works when file saved, but goneovim window stucks if file has unsaved changes.
Upon investigation of the above problem, the reason for the stacks is that while nvim
is waiting for user input ([Y]es or [N]o or [C]ancel), the execution of the command is not completed and goneovim is stopped in the process of select
. Here, goneovim needed to send the nvim command and exit the function without waiting for it to be processed and ignore the QCloseEvent
event.
@akiyosi Thank for explanation! Interesting subtleties.
I have merged the patch and will close it.
OS: LInux
goneovim ~/.bashrc
ps ax | grep nvim | grep bachrc
Problem: the nvim process still exists.