mirror of
https://github.com/neovim/neovim.git
synced 2026-05-06 08:26:45 -04:00
2bb426ce4a
Problem: When closing gvim with an unsaved unnamed buffer, choosing
"Yes" in the "Save changes?" dialog and then "Cancel" in the
file selection dialog either silently writes the buffer to a
file named "Untitled" (overwriting any existing file with
that name) or discards the buffer altogether
(vibs29, after v9.1.0265).
Solution: In dialog_changed(), if browse_save_fname() leaves the buffer
without a file name, treat it as a cancel and return without
saving. Also stop clearing the modified flag in the restore
path on write failure, so the unsaved changes are kept and
the caller (e.g. gui_shell_closed()) can also cancel the
close. Pre-fill the file dialog with "Untitled" to match
the preceding "Save changes to ..." prompt. Add a test for
the write-failure path (Hirohito Higashi).
fixes: vim/vim#20132
closes: vim/vim#20143
https://github.com/vim/vim/commit/cf947e7ef09fc8a63f447b54b107585b8f3b7abe
Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>