comparison src/buffer.c @ 28319:427600f3b1c5 v8.2.4685

patch 8.2.4685: when a swap file is found for a popup there is no dialog Commit: https://github.com/vim/vim/commit/188639d75c363dffaf813e8e2209f7350ad1e871 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Apr 4 16:57:21 2022 +0100 patch 8.2.4685: when a swap file is found for a popup there is no dialog 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)
author Bram Moolenaar <Bram@vim.org>
date Mon, 04 Apr 2022 18:00:04 +0200
parents cdaff4db7760
children 8bc8071928ed
comparison
equal deleted inserted replaced
28318:0a9769423ce4 28319:427600f3b1c5
148 if (buf->b_ml.ml_mfp == NULL) 148 if (buf->b_ml.ml_mfp == NULL)
149 { 149 {
150 aco_save_T aco; 150 aco_save_T aco;
151 151
152 aucmd_prepbuf(&aco, buf); 152 aucmd_prepbuf(&aco, buf);
153 swap_exists_action = SEA_NONE; 153 if (swap_exists_action != SEA_READONLY)
154 swap_exists_action = SEA_NONE;
154 open_buffer(FALSE, NULL, 0); 155 open_buffer(FALSE, NULL, 0);
155 aucmd_restbuf(&aco); 156 aucmd_restbuf(&aco);
156 } 157 }
157 } 158 }
158 #endif 159 #endif
1051 int start, 1052 int start,
1052 int dir, 1053 int dir,
1053 int count) 1054 int count)
1054 { 1055 {
1055 bufref_T old_curbuf; 1056 bufref_T old_curbuf;
1057 int save_sea = swap_exists_action;
1056 1058
1057 set_bufref(&old_curbuf, curbuf); 1059 set_bufref(&old_curbuf, curbuf);
1058 1060
1059 swap_exists_action = SEA_DIALOG; 1061 if (swap_exists_action == SEA_NONE)
1062 swap_exists_action = SEA_DIALOG;
1060 (void)do_buffer(*eap->cmd == 's' ? DOBUF_SPLIT : DOBUF_GOTO, 1063 (void)do_buffer(*eap->cmd == 's' ? DOBUF_SPLIT : DOBUF_GOTO,
1061 start, dir, count, eap->forceit); 1064 start, dir, count, eap->forceit);
1062 if (swap_exists_action == SEA_QUIT && *eap->cmd == 's') 1065 if (swap_exists_action == SEA_QUIT && *eap->cmd == 's')
1063 { 1066 {
1064 #if defined(FEAT_EVAL) 1067 #if defined(FEAT_EVAL)
1069 enter_cleanup(&cs); 1072 enter_cleanup(&cs);
1070 #endif 1073 #endif
1071 1074
1072 // Quitting means closing the split window, nothing else. 1075 // Quitting means closing the split window, nothing else.
1073 win_close(curwin, TRUE); 1076 win_close(curwin, TRUE);
1074 swap_exists_action = SEA_NONE; 1077 swap_exists_action = save_sea;
1075 swap_exists_did_quit = TRUE; 1078 swap_exists_did_quit = TRUE;
1076 1079
1077 #if defined(FEAT_EVAL) 1080 #if defined(FEAT_EVAL)
1078 // Restore the error/interrupt/exception state if not discarded by a 1081 // Restore the error/interrupt/exception state if not discarded by a
1079 // new aborting error, interrupt, or uncaught exception. 1082 // new aborting error, interrupt, or uncaught exception.