From dcf4c5744a9ad68e9cfe001b39706f914ba4c9da Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 6 Apr 2024 05:57:20 +0800 Subject: [PATCH] vim-patch:9.1.0267: File name entered in GUI dialog is ignored Problem: File name entered in GUI dialog is ignored (after v9.1.0265) Solution: Only set file name to "Untitled" if GUI dialog didn't set it. (zeertzjq) closes: vim/vim#14417 https://github.com/vim/vim/commit/c20bdf1107d48a1c14713709d12d429e761132af --- src/nvim/ex_cmds2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index 898c3fb3f9..b7f4f269e1 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -203,7 +203,6 @@ void dialog_changed(buf_T *buf, bool checkall) .append = false, .forceit = false, }; - bool empty_buf = buf->b_fname == NULL; dialog_msg(buff, _("Save changes to \"%s\"?"), buf->b_fname); if (checkall) { @@ -213,7 +212,8 @@ void dialog_changed(buf_T *buf, bool checkall) } if (ret == VIM_YES) { - if (empty_buf) { + bool empty_bufname = buf->b_fname == NULL; + if (empty_bufname) { buf_set_name(buf->b_fnum, "Untitled"); } @@ -225,7 +225,7 @@ void dialog_changed(buf_T *buf, bool checkall) } // restore to empty when write failed - if (empty_buf) { + if (empty_bufname) { XFREE_CLEAR(buf->b_fname); XFREE_CLEAR(buf->b_ffname); XFREE_CLEAR(buf->b_sfname);