Add confirmation dialog when closing window with unsaved buffers#225
Draft
Add confirmation dialog when closing window with unsaved buffers#225
Conversation
- Modify close_request to send :q command to neovim instead of closing immediately - Let neovim handle unsaved changes confirmation with its standard behavior - Preserve existing vimleavepre -> io_loop -> close() flow for clean exit - Prevent accidental data loss from Alt+F4 or window close button Co-authored-by: vhakulinen <4594126+vhakulinen@users.noreply.github.com>
Co-authored-by: vhakulinen <4594126+vhakulinen@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] @vhakulinen/gnvim/issues/147
Create PR that implements the requrested feature.
Add confirmation dialog when closing window with unsaved buffers
Aug 20, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #147
When the user tries to close the gnvim window (via Alt+F4, clicking the X button, etc.), gnvim now sends a
:qcommand to neovim instead of closing immediately. This allows neovim to handle unsaved changes with its standard confirmation behavior, preventing accidental data loss.Changes
WindowImpl::close_request()inui/src/components/appwindow/imp.rsself.parent_close_request(), the implementation now::qcommand to neovim vianvim_command("q")glib::Propagation::Stopto prevent immediate window closureBehavior
With unsaved changes:
:w) or force quit (:q!)Without unsaved changes:
This approach leverages neovim's built-in quit confirmation logic rather than duplicating it in the GUI layer, ensuring consistent behavior with terminal neovim and maintaining the existing clean exit infrastructure.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.