summaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-04-04 16:57:21 +0100
committerBram Moolenaar <Bram@vim.org>2022-04-04 16:57:21 +0100
commit188639d75c363dffaf813e8e2209f7350ad1e871 (patch)
tree5ad1a2954a8a4a821125a7f20e9667a85f3a6196 /src/buffer.c
parentcc766a85f460ebb7f8c915508447548b5f5b99bc (diff)
patch 8.2.4685: when a swap file is found for a popup there is no dialogv8.2.4685
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 #10073)
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 8b50540e4e..bd378302cd 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -150,7 +150,8 @@ buffer_ensure_loaded(buf_T *buf)
aco_save_T aco;
aucmd_prepbuf(&aco, buf);
- swap_exists_action = SEA_NONE;
+ if (swap_exists_action != SEA_READONLY)
+ swap_exists_action = SEA_NONE;
open_buffer(FALSE, NULL, 0);
aucmd_restbuf(&aco);
}
@@ -1053,10 +1054,12 @@ goto_buffer(
int count)
{
bufref_T old_curbuf;
+ int save_sea = swap_exists_action;
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);
if (swap_exists_action == SEA_QUIT && *eap->cmd == 's')
@@ -1071,7 +1074,7 @@ goto_buffer(
// Quitting means closing the split window, nothing else.
win_close(curwin, TRUE);
- swap_exists_action = SEA_NONE;
+ swap_exists_action = save_sea;
swap_exists_did_quit = TRUE;
#if defined(FEAT_EVAL)