aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/buffer.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-11-25 10:50:51 +0800
committerGitHub <noreply@github.com>2023-11-25 10:50:51 +0800
commitee276f8758aea38205e04d839afc69e8537a2642 (patch)
tree1836be94b2fa9a37fe879a1ce19ed94f320a7a1e /src/nvim/buffer.c
parent6a2a37b1e102394d99b4891dc9807868f0fa3c97 (diff)
downloadrneovim-ee276f8758aea38205e04d839afc69e8537a2642.tar.gz
rneovim-ee276f8758aea38205e04d839afc69e8537a2642.tar.bz2
rneovim-ee276f8758aea38205e04d839afc69e8537a2642.zip
vim-patch:8.2.4685: when a swap file is found for a popup there is no dialog (#26207)
Problem: When a swap file is found for a popup there is no dialog and the buffer is loaded anyway. Solution: Silently load the buffer read-only. (closes vim/vim#10073) https://github.com/vim/vim/commit/188639d75c363dffaf813e8e2209f7350ad1e871 Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'src/nvim/buffer.c')
-rw-r--r--src/nvim/buffer.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index c89d4f667a..9df886ef9a 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -930,10 +930,14 @@ static void free_buffer_stuff(buf_T *buf, int free_flags)
/// Go to another buffer. Handles the result of the ATTENTION dialog.
void goto_buffer(exarg_T *eap, int start, int dir, int count)
{
+ const int save_sea = swap_exists_action;
+
bufref_T old_curbuf;
set_bufref(&old_curbuf, curbuf);
- swap_exists_action = SEA_DIALOG;
+ if (swap_exists_action == SEA_NONE) {
+ swap_exists_action = SEA_DIALOG;
+ }
(void)do_buffer(*eap->cmd == 's' ? DOBUF_SPLIT : DOBUF_GOTO,
start, dir, count, eap->forceit);
@@ -946,7 +950,7 @@ void goto_buffer(exarg_T *eap, int start, int dir, int count)
// Quitting means closing the split window, nothing else.
win_close(curwin, true, false);
- swap_exists_action = SEA_NONE;
+ swap_exists_action = save_sea;
swap_exists_did_quit = true;
// Restore the error/interrupt/exception state if not discarded by a