fix(messages): make swapfile attention message part of prompt (#34414)

Problem:  The swapfile attention message is not repeated after clearing
          the screen.
          After clearing the screen `msg_scrolled` is reset without
          clearing other related variables, causing an assert.
Solution: Make the attention message part of the confirm prompt.
          Call `msg_reset_scroll()`.
This commit is contained in:
luukvbaal
2025-06-12 11:57:17 +02:00
committed by GitHub
parent 221b6ddf1c
commit d86d4bacc1
33 changed files with 152 additions and 283 deletions

View File

@ -255,7 +255,7 @@ void screenclear(void)
compute_cmdrow(); compute_cmdrow();
msg_row = cmdline_row; // put cursor on last line for messages msg_row = cmdline_row; // put cursor on last line for messages
msg_col = 0; msg_col = 0;
msg_scrolled = 0; // can't scroll back msg_reset_scroll(); // can't scroll back
msg_didany = false; msg_didany = false;
msg_didout = false; msg_didout = false;
if (HL_ATTR(HLF_MSG) > 0 && msg_use_grid() && msg_grid.chars) { if (HL_ATTR(HLF_MSG) > 0 && msg_use_grid() && msg_grid.chars) {
@ -500,7 +500,7 @@ int update_screen(void)
} }
// if the screen was scrolled up when displaying a message, scroll it down // if the screen was scrolled up when displaying a message, scroll it down
if ((msg_scrolled || msg_grid_invalid) && !cmdline_number_prompt()) { if (msg_scrolled || msg_grid_invalid) {
clear_cmdline = true; clear_cmdline = true;
int valid = MAX(Rows - msg_scrollsize(), 0); int valid = MAX(Rows - msg_scrollsize(), 0);
if (msg_grid.chars) { if (msg_grid.chars) {

View File

@ -1402,7 +1402,10 @@ int recover_names(char *fname, bool do_list, list_T *ret_list, int nr, char **fn
msg_puts(". "); msg_puts(". ");
msg_puts(path_tail(files[i])); msg_puts(path_tail(files[i]));
msg_putchar('\n'); msg_putchar('\n');
swapfile_info(files[i]); StringBuilder msg = KV_INITIAL_VALUE;
swapfile_info(files[i], &msg);
msg_outtrans(msg.items, 0, false);
kv_destroy(msg);
} }
} else { } else {
msg_puts(_(" -- none --\n")); msg_puts(_(" -- none --\n"));
@ -1500,7 +1503,7 @@ void swapfile_dict(const char *fname, dict_T *d)
/// Loads info from swapfile `fname`, and displays it to the user. /// Loads info from swapfile `fname`, and displays it to the user.
/// ///
/// @return timestamp (0 when unknown). /// @return timestamp (0 when unknown).
static time_t swapfile_info(char *fname) static time_t swapfile_info(char *fname, StringBuilder *msg)
{ {
assert(fname != NULL); assert(fname != NULL);
ZeroBlock b0; ZeroBlock b0;
@ -1515,18 +1518,17 @@ static time_t swapfile_info(char *fname)
#ifdef UNIX #ifdef UNIX
// print name of owner of the file // print name of owner of the file
if (os_get_uname((uv_uid_t)file_info.stat.st_uid, uname, B0_UNAME_SIZE) == OK) { if (os_get_uname((uv_uid_t)file_info.stat.st_uid, uname, B0_UNAME_SIZE) == OK) {
msg_puts(_(" owned by: ")); kv_printf(*msg, "%s%s", _(" owned by: "), uname);
msg_outtrans(uname, 0, false); kv_printf(*msg, _(" dated: "));
msg_puts(_(" dated: "));
} else { } else {
msg_puts(_(" dated: ")); kv_printf(*msg, _(" dated: "));
} }
#else #else
msg_puts(_(" dated: ")); msg_puts(_(" dated: "));
#endif #endif
x = file_info.stat.st_mtim.tv_sec; x = file_info.stat.st_mtim.tv_sec;
char ctime_buf[100]; // hopefully enough for every language char ctime_buf[100]; // hopefully enough for every language
msg_puts(os_ctime_r(&x, ctime_buf, sizeof(ctime_buf), true)); kv_printf(*msg, "%s", os_ctime_r(&x, ctime_buf, sizeof(ctime_buf), true));
} }
// print the original file name // print the original file name
@ -1534,56 +1536,56 @@ static time_t swapfile_info(char *fname)
if (fd >= 0) { if (fd >= 0) {
if (read_eintr(fd, &b0, sizeof(b0)) == sizeof(b0)) { if (read_eintr(fd, &b0, sizeof(b0)) == sizeof(b0)) {
if (strncmp(b0.b0_version, "VIM 3.0", 7) == 0) { if (strncmp(b0.b0_version, "VIM 3.0", 7) == 0) {
msg_puts(_(" [from Vim version 3.0]")); kv_printf(*msg, _(" [from Vim version 3.0]"));
} else if (ml_check_b0_id(&b0) == FAIL) { } else if (ml_check_b0_id(&b0) == FAIL) {
msg_puts(_(" [does not look like a Nvim swap file]")); kv_printf(*msg, _(" [does not look like a Nvim swap file]"));
} else if (!ml_check_b0_strings(&b0)) { } else if (!ml_check_b0_strings(&b0)) {
msg_puts(_(" [garbled strings (not nul terminated)]")); kv_printf(*msg, _(" [garbled strings (not nul terminated)]"));
} else { } else {
msg_puts(_(" file name: ")); kv_printf(*msg, _(" file name: "));
if (b0.b0_fname[0] == NUL) { if (b0.b0_fname[0] == NUL) {
msg_puts(_("[No Name]")); kv_printf(*msg, _("[No Name]"));
} else { } else {
msg_outtrans(b0.b0_fname, 0, false); kv_printf(*msg, "%s", b0.b0_fname);
} }
msg_puts(_("\n modified: ")); kv_printf(*msg, _("\n modified: "));
msg_puts(b0.b0_dirty ? _("YES") : _("no")); kv_printf(*msg, b0.b0_dirty ? _("YES") : _("no"));
if (*(b0.b0_uname) != NUL) { if (*(b0.b0_uname) != NUL) {
msg_puts(_("\n user name: ")); kv_printf(*msg, _("\n user name: "));
msg_outtrans(b0.b0_uname, 0, false); kv_printf(*msg, "%s", b0.b0_uname);
} }
if (*(b0.b0_hname) != NUL) { if (*(b0.b0_hname) != NUL) {
if (*(b0.b0_uname) != NUL) { if (*(b0.b0_uname) != NUL) {
msg_puts(_(" host name: ")); kv_printf(*msg, _(" host name: "));
} else { } else {
msg_puts(_("\n host name: ")); kv_printf(*msg, _("\n host name: "));
} }
msg_outtrans(b0.b0_hname, 0, false); kv_printf(*msg, "%s", b0.b0_hname);
} }
if (char_to_long(b0.b0_pid) != 0) { if (char_to_long(b0.b0_pid) != 0) {
msg_puts(_("\n process ID: ")); kv_printf(*msg, _("\n process ID: "));
msg_outnum((int)char_to_long(b0.b0_pid)); kv_printf(*msg, "%d", (int)char_to_long(b0.b0_pid));
if ((proc_running = swapfile_proc_running(&b0, fname))) { if ((proc_running = swapfile_proc_running(&b0, fname))) {
msg_puts(_(" (STILL RUNNING)")); kv_printf(*msg, _(" (STILL RUNNING)"));
} }
} }
if (b0_magic_wrong(&b0)) { if (b0_magic_wrong(&b0)) {
msg_puts(_("\n [not usable on this computer]")); kv_printf(*msg, _("\n [not usable on this computer]"));
} }
} }
} else { } else {
msg_puts(_(" [cannot be read]")); kv_printf(*msg, _(" [cannot be read]"));
} }
close(fd); close(fd);
} else { } else {
msg_puts(_(" [cannot be opened]")); kv_printf(*msg, _(" [cannot be opened]"));
} }
msg_putchar('\n'); kv_printf(*msg, "\n");
return x; return x;
} }
@ -3245,50 +3247,47 @@ char *get_file_in_dir(char *fname, char *dname)
return retval; return retval;
} }
/// Print the ATTENTION message: info about an existing swapfile. /// Build the ATTENTION message: info about an existing swapfile.
/// ///
/// @param buf buffer being edited /// @param buf buffer being edited
/// @param fname swapfile name /// @param fname swapfile name
static void attention_message(buf_T *buf, char *fname) /// @param fhname swapfile name, home replaced
/// @param msg string buffer, emitted as either a regular or confirm message
static void attention_message(buf_T *buf, char *fname, char *fhname, StringBuilder *msg)
{ {
assert(buf->b_fname != NULL); assert(buf->b_fname != NULL);
no_wait_return++;
emsg(_("E325: ATTENTION")); emsg(_("E325: ATTENTION"));
msg_puts(_("\nFound a swap file by the name \"")); kv_printf(*msg, _("Found a swap file by the name \""));
msg_home_replace(fname); kv_printf(*msg, "%s\"\n", fhname);
msg_puts("\"\n"); const time_t swap_mtime = swapfile_info(fname, msg);
const time_t swap_mtime = swapfile_info(fname); kv_printf(*msg, (_("While opening file \"")));
msg_puts(_("While opening file \"")); kv_printf(*msg, "%s\"\n", buf->b_fname);
msg_outtrans(buf->b_fname, 0, false);
msg_puts("\"\n");
FileInfo file_info; FileInfo file_info;
if (!os_fileinfo(buf->b_fname, &file_info)) { if (!os_fileinfo(buf->b_fname, &file_info)) {
msg_puts(_(" CANNOT BE FOUND")); kv_printf(*msg, _(" CANNOT BE FOUND"));
} else { } else {
msg_puts(_(" dated: ")); kv_printf(*msg, _(" dated: "));
time_t x = file_info.stat.st_mtim.tv_sec; time_t x = file_info.stat.st_mtim.tv_sec;
char ctime_buf[50]; char ctime_buf[50];
msg_puts(os_ctime_r(&x, ctime_buf, sizeof(ctime_buf), true)); kv_printf(*msg, "%s", os_ctime_r(&x, ctime_buf, sizeof(ctime_buf), true));
if (swap_mtime != 0 && x > swap_mtime) { if (swap_mtime != 0 && x > swap_mtime) {
msg_puts(_(" NEWER than swap file!\n")); kv_printf(*msg, _(" NEWER than swap file!\n"));
} }
} }
// Some of these messages are long to allow translation to // Some of these messages are long to allow translation to
// other languages. // other languages.
msg_puts(_("\n(1) Another program may be editing the same file. If this is" kv_printf(*msg, _("\n(1) Another program may be editing the same file. If this is"
" the case,\n be careful not to end up with two different" " the case,\n be careful not to end up with two different"
" instances of the same\n file when making changes." " instances of the same\n file when making changes."
" Quit, or continue with caution.\n")); " Quit, or continue with caution.\n"));
msg_puts(_("(2) An edit session for this file crashed.\n")); kv_printf(*msg, _("(2) An edit session for this file crashed.\n"));
msg_puts(_(" If this is the case, use \":recover\" or \"nvim -r ")); kv_printf(*msg, _(" If this is the case, use \":recover\" or \"nvim -r "));
msg_outtrans(buf->b_fname, 0, false); kv_printf(*msg, "%s", buf->b_fname);
msg_puts(_("\"\n to recover the changes (see \":help recovery\").\n")); kv_printf(*msg, (_("\"\n to recover the changes (see \":help recovery\").\n")));
msg_puts(_(" If you did this already, delete the swap file \"")); kv_printf(*msg, _(" If you did this already, delete the swap file \""));
msg_outtrans(fname, 0, false); kv_printf(*msg, "%s", fname);
msg_puts(_("\"\n to avoid this message.\n")); kv_printf(*msg, _("\"\n to avoid this message.\n"));
cmdline_row = msg_row;
no_wait_return--;
} }
/// Trigger the SwapExists autocommands. /// Trigger the SwapExists autocommands.
@ -3462,8 +3461,11 @@ static char *findswapname(buf_T *buf, char **dirp, char *old_fname, bool *found_
proc_running = 0; // Set by attention_message..swapfile_info. proc_running = 0; // Set by attention_message..swapfile_info.
if (choice == SEA_CHOICE_NONE) { if (choice == SEA_CHOICE_NONE) {
no_wait_return++;
// Show info about the existing swapfile. // Show info about the existing swapfile.
attention_message(buf, fname); StringBuilder msg = KV_INITIAL_VALUE;
char *fhname = home_replace_save(NULL, fname);
attention_message(buf, fname, fhname, &msg);
// We don't want a 'q' typed at the more-prompt // We don't want a 'q' typed at the more-prompt
// interrupt loading a file. // interrupt loading a file.
@ -3472,40 +3474,26 @@ static char *findswapname(buf_T *buf, char **dirp, char *old_fname, bool *found_
// If vimrc has "simalt ~x" we don't want it to // If vimrc has "simalt ~x" we don't want it to
// interfere with the prompt here. // interfere with the prompt here.
flush_buffers(FLUSH_TYPEAHEAD); flush_buffers(FLUSH_TYPEAHEAD);
}
if (swap_exists_action != SEA_NONE && choice == SEA_CHOICE_NONE) { if (swap_exists_action != SEA_NONE) {
const char *const sw_msg_1 = _("Swap file \""); kv_printf(msg, _("Swap file \""));
const char *const sw_msg_2 = _("\" already exists!"); kv_printf(msg, "%s", fhname);
kv_printf(msg, _("\" already exists!"));
char *run_but = _("&Open Read-Only\n&Edit anyway\n&Recover\n&Quit\n&Abort");
char *but = _("&Open Read-Only\n&Edit anyway\n&Recover\n&Delete it\n&Quit\n&Abort");
choice = (sea_choice_T)do_dialog(VIM_WARNING, _("VIM - ATTENTION"), msg.items,
proc_running ? run_but : but, 1, NULL, false);
const size_t fname_len = strlen(fname);
const size_t sw_msg_1_len = strlen(sw_msg_1);
const size_t sw_msg_2_len = strlen(sw_msg_2);
const size_t name_len = sw_msg_1_len + fname_len + sw_msg_2_len + 5;
char *const name = xmalloc(name_len);
memcpy(name, sw_msg_1, sw_msg_1_len + 1);
home_replace(NULL, fname, name + sw_msg_1_len, fname_len, true);
xstrlcat(name, sw_msg_2, name_len);
int dialog_result
= do_dialog(VIM_WARNING,
_("VIM - ATTENTION"),
name,
proc_running
? _("&Open Read-Only\n&Edit anyway\n&Recover\n&Quit\n&Abort")
: _("&Open Read-Only\n&Edit anyway\n&Recover\n&Delete it\n&Quit\n&Abort"),
1, NULL, false);
if (proc_running && dialog_result >= 4) {
// compensate for missing "Delete it" button // compensate for missing "Delete it" button
dialog_result++; choice += proc_running && choice >= 4;
// pretend screen didn't scroll, need redraw anyway
msg_reset_scroll();
} else {
msg_outtrans(msg.items, 0, false);
} }
choice = (sea_choice_T)dialog_result; no_wait_return--;
xfree(name); kv_destroy(msg);
xfree(fhname);
// pretend screen didn't scroll, need redraw anyway
msg_reset_scroll();
} }
switch (choice) { switch (choice) {

View File

@ -3575,12 +3575,8 @@ msgstr "E317: wyser blok id verkeerd 2"
msgid "E325: ATTENTION" msgid "E325: ATTENTION"
msgstr "E325: LET OP" msgstr "E325: LET OP"
msgid "" msgid "Found a swap file by the name \""
"\n" msgstr "Het 'n ruill<6C>er gevind met die naam \""
"Found a swap file by the name \""
msgstr ""
"\n"
"Het 'n ruill<6C>er gevind met die naam \""
msgid "While opening file \"" msgid "While opening file \""
msgstr "Tydens oopmaak van l<>er \"" msgstr "Tydens oopmaak van l<>er \""

View File

@ -3976,10 +3976,8 @@ msgid "E325: ATTENTION"
msgstr "E325: ATENCI<43>" msgstr "E325: ATENCI<43>"
#: ../memline.c:3222 #: ../memline.c:3222
msgid "" msgid "Found a swap file by the name \""
"\n" msgstr "S'ha trobat un fitxer d'intercanvi amb nom \""
"Found a swap file by the name \""
msgstr "\nS'ha trobat un fitxer d'intercanvi amb nom \""
#: ../memline.c:3226 #: ../memline.c:3226
msgid "While opening file \"" msgid "While opening file \""

View File

@ -4036,12 +4036,8 @@ msgid "E325: ATTENTION"
msgstr "E325: POZOR" msgstr "E325: POZOR"
#: ../memline.c:3222 #: ../memline.c:3222
msgid "" msgid "Found a swap file by the name \""
"\n" msgstr "Nalezen odkl<6B>dac<61> soubor se jm<6A>nem \""
"Found a swap file by the name \""
msgstr ""
"\n"
"Nalezen odkl<6B>dac<61> soubor se jm<6A>nem \""
#: ../memline.c:3226 #: ../memline.c:3226
msgid "While opening file \"" msgid "While opening file \""

View File

@ -4036,12 +4036,8 @@ msgid "E325: ATTENTION"
msgstr "E325: POZOR" msgstr "E325: POZOR"
#: ../memline.c:3222 #: ../memline.c:3222
msgid "" msgid "Found a swap file by the name \""
"\n" msgstr "Nalezen odkl<6B>dac<61> soubor se jm<6A>nem \""
"Found a swap file by the name \""
msgstr ""
"\n"
"Nalezen odkl<6B>dac<61> soubor se jm<6A>nem \""
#: ../memline.c:3226 #: ../memline.c:3226
msgid "While opening file \"" msgid "While opening file \""

View File

@ -3636,12 +3636,8 @@ msgstr "E773: Symlink-løkke for \"%s\""
msgid "E325: ATTENTION" msgid "E325: ATTENTION"
msgstr "E325: OBS" msgstr "E325: OBS"
msgid "" msgid "Found a swap file by the name \""
"\n" msgstr "Fandt en swap-fil ved navn \""
"Found a swap file by the name \""
msgstr ""
"\n"
"Fandt en swap-fil ved navn \""
msgid "While opening file \"" msgid "While opening file \""
msgstr "Ved åbning af filen \"" msgstr "Ved åbning af filen \""

View File

@ -3399,12 +3399,8 @@ msgid "E325: ATTENTION"
msgstr "E325: ACHTUNG" msgstr "E325: ACHTUNG"
#: ../memline.c:3179 #: ../memline.c:3179
msgid "" msgid "Found a swap file by the name \""
"\n" msgstr "Auslagerungsdatei mit folgendem Namen gefunden: \""
"Found a swap file by the name \""
msgstr ""
"\n"
"Auslagerungsdatei mit folgendem Namen gefunden: \""
#: ../memline.c:3183 #: ../memline.c:3183
msgid "While opening file \"" msgid "While opening file \""

View File

@ -3817,9 +3817,7 @@ msgid "E325: ATTENTION"
msgstr "" msgstr ""
#: ../memline.c:3222 #: ../memline.c:3222
msgid "" msgid "Found a swap file by the name \""
"\n"
"Found a swap file by the name \""
msgstr "" msgstr ""
#: ../memline.c:3226 #: ../memline.c:3226

View File

@ -3504,12 +3504,8 @@ msgstr "E773: Buklo de simbolaj ligiloj por \"%s\""
msgid "E325: ATTENTION" msgid "E325: ATTENTION"
msgstr "E325: ATENTO" msgstr "E325: ATENTO"
msgid "" msgid "Found a swap file by the name \""
"\n" msgstr "Trovis permutodosieron .swp kun la nomo \""
"Found a swap file by the name \""
msgstr ""
"\n"
"Trovis permutodosieron .swp kun la nomo \""
msgid "While opening file \"" msgid "While opening file \""
msgstr "Dum malfermo de dosiero \"" msgstr "Dum malfermo de dosiero \""

View File

@ -4035,12 +4035,8 @@ msgid "E325: ATTENTION"
msgstr "E325: ATENCIÓN" msgstr "E325: ATENCIÓN"
#: ../memline.c:3222 #: ../memline.c:3222
msgid "" msgid "Found a swap file by the name \""
"\n" msgstr "Se ha encontrado un archivo de intercambio con el nombre \""
"Found a swap file by the name \""
msgstr ""
"\n"
"Se ha encontrado un archivo de intercambio con el nombre \""
#: ../memline.c:3226 #: ../memline.c:3226
msgid "While opening file \"" msgid "While opening file \""

View File

@ -3633,12 +3633,8 @@ msgstr "E773: Symlinkkisilmukka kohteelle %s"
msgid "E325: ATTENTION" msgid "E325: ATTENTION"
msgstr "E325: HUOMAA" msgstr "E325: HUOMAA"
msgid "" msgid "Found a swap file by the name \""
"\n" msgstr "Swap-tiedosto löytyi: \""
"Found a swap file by the name \""
msgstr ""
"\n"
"Swap-tiedosto löytyi: \""
msgid "While opening file \"" msgid "While opening file \""
msgstr "Avattaessa tiedostoa " msgstr "Avattaessa tiedostoa "

View File

@ -3213,12 +3213,8 @@ msgstr "E773: cycle de liens symboliques avec \"%s\""
msgid "E325: ATTENTION" msgid "E325: ATTENTION"
msgstr "E325: ATTENTION" msgstr "E325: ATTENTION"
msgid "" msgid "Found a swap file by the name \""
"\n" msgstr "Trouv<75> un fichier d'<27>change nomm<6D> \""
"Found a swap file by the name \""
msgstr ""
"\n"
"Trouv<75> un fichier d'<27>change nomm<6D> \""
msgid "While opening file \"" msgid "While opening file \""
msgstr "Lors de l'ouverture du fichier \"" msgstr "Lors de l'ouverture du fichier \""

View File

@ -3667,12 +3667,8 @@ msgstr "E773: Ciogal i naisc shiombalacha le haghaidh \"%s\""
msgid "E325: ATTENTION" msgid "E325: ATTENTION"
msgstr "E325: AIRE" msgstr "E325: AIRE"
msgid "" msgid "Found a swap file by the name \""
"\n" msgstr "Fuarthas comhad babht<68>la darbh ainm \""
"Found a swap file by the name \""
msgstr ""
"\n"
"Fuarthas comhad babht<68>la darbh ainm \""
msgid "While opening file \"" msgid "While opening file \""
msgstr "Agus an comhad seo <20> oscailt: \"" msgstr "Agus an comhad seo <20> oscailt: \""

View File

@ -4001,12 +4001,8 @@ msgid "E325: ATTENTION"
msgstr "E325: ATTENZIONE" msgstr "E325: ATTENZIONE"
#: ../memline.c:3222 #: ../memline.c:3222
msgid "" msgid "Found a swap file by the name \""
"\n" msgstr "Trovato uno swap file di nome \""
"Found a swap file by the name \""
msgstr ""
"\n"
"Trovato uno swap file di nome \""
#: ../memline.c:3226 #: ../memline.c:3226
msgid "While opening file \"" msgid "While opening file \""

View File

@ -3438,12 +3438,8 @@ msgstr "E773: \"%s\"
msgid "E325: ATTENTION" msgid "E325: ATTENTION"
msgstr "E325: <20><><EFBFBD><EFBFBD>" msgstr "E325: <20><><EFBFBD><EFBFBD>"
msgid "" msgid "Found a swap file by the name \""
"\n" msgstr "<22><><EFBFBD><EFBFBD>̾<EFBFBD><CCBE><EFBFBD>ǥ<EFBFBD><C7A5><EFBFBD><EFBFBD>åץե<D7A5><D5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>򸫤Ĥ<F2B8ABA4><C4A4>ޤ<EFBFBD><DEA4><EFBFBD> \""
"Found a swap file by the name \""
msgstr ""
"\n"
"<22><><EFBFBD><EFBFBD>̾<EFBFBD><CCBE><EFBFBD>ǥ<EFBFBD><C7A5><EFBFBD><EFBFBD>åץե<D7A5><D5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>򸫤Ĥ<F2B8ABA4><C4A4>ޤ<EFBFBD><DEA4><EFBFBD> \""
msgid "While opening file \"" msgid "While opening file \""
msgstr "<22><><EFBFBD>Υե<CEA5><D5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>򳫤<EFBFBD><F2B3ABA4>Ƥ<EFBFBD><C6A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> \"" msgstr "<22><><EFBFBD>Υե<CEA5><D5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>򳫤<EFBFBD><F2B3ABA4>Ƥ<EFBFBD><C6A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> \""

View File

@ -5061,12 +5061,8 @@ msgstr "E773: \"%s\" のシンボリックリンクがループになってい
msgid "E325: ATTENTION" msgid "E325: ATTENTION"
msgstr "E325: 注意" msgstr "E325: 注意"
msgid "" msgid "Found a swap file by the name \""
"\n" msgstr "次の名前でスワップファイルを見つけました \""
"Found a swap file by the name \""
msgstr ""
"\n"
"次の名前でスワップファイルを見つけました \""
msgid "While opening file \"" msgid "While opening file \""
msgstr "次のファイルを開いている最中 \"" msgstr "次のファイルを開いている最中 \""

View File

@ -3916,12 +3916,8 @@ msgid "E325: ATTENTION"
msgstr "E325: 주목" msgstr "E325: 주목"
#: ../memline.c:3222 #: ../memline.c:3222
msgid "" msgid "Found a swap file by the name \""
"\n" msgstr "Found a swap file by the name \""
"Found a swap file by the name \""
msgstr ""
"\n"
"Found a swap file by the name \""
#: ../memline.c:3226 #: ../memline.c:3226
msgid "While opening file \"" msgid "While opening file \""

View File

@ -3937,12 +3937,8 @@ msgid "E325: ATTENTION"
msgstr "E325: VIKTIG" msgstr "E325: VIKTIG"
#: ../memline.c:3222 #: ../memline.c:3222
msgid "" msgid "Found a swap file by the name \""
"\n" msgstr "Fant en swapfil ved navn \""
"Found a swap file by the name \""
msgstr ""
"\n"
"Fant en swapfil ved navn \""
#: ../memline.c:3226 #: ../memline.c:3226
msgid "While opening file \"" msgid "While opening file \""

View File

@ -3943,12 +3943,8 @@ msgid "E325: ATTENTION"
msgstr "E325: OPGELET" msgstr "E325: OPGELET"
#: ../memline.c:3222 #: ../memline.c:3222
msgid "" msgid "Found a swap file by the name \""
"\n" msgstr "Er is een wisselbestand aangetroffen met de naam \""
"Found a swap file by the name \""
msgstr ""
"\n"
"Er is een wisselbestand aangetroffen met de naam \""
#: ../memline.c:3226 #: ../memline.c:3226
msgid "While opening file \"" msgid "While opening file \""

View File

@ -3937,12 +3937,8 @@ msgid "E325: ATTENTION"
msgstr "E325: VIKTIG" msgstr "E325: VIKTIG"
#: ../memline.c:3222 #: ../memline.c:3222
msgid "" msgid "Found a swap file by the name \""
"\n" msgstr "Fant en swapfil ved navn \""
"Found a swap file by the name \""
msgstr ""
"\n"
"Fant en swapfil ved navn \""
#: ../memline.c:3226 #: ../memline.c:3226
msgid "While opening file \"" msgid "While opening file \""

View File

@ -3909,12 +3909,8 @@ msgid "E325: ATTENTION"
msgstr "E325: UWAGA" msgstr "E325: UWAGA"
#: ../memline.c:3222 #: ../memline.c:3222
msgid "" msgid "Found a swap file by the name \""
"\n" msgstr "Znalazłem plik wymiany o nazwie \""
"Found a swap file by the name \""
msgstr ""
"\n"
"Znalazłem plik wymiany o nazwie \""
#: ../memline.c:3226 #: ../memline.c:3226
msgid "While opening file \"" msgid "While opening file \""

View File

@ -584,12 +584,8 @@ msgid "E325: ATTENTION"
msgstr "E325: ATEN<45><4E>O" msgstr "E325: ATEN<45><4E>O"
#: ../memline.c:3181 #: ../memline.c:3181
msgid "" msgid "Found a swap file by the name \""
"\n" msgstr "Foi encontrado um arquivo de troca de nome \""
"Found a swap file by the name \""
msgstr ""
"\n"
"Foi encontrado um arquivo de troca de nome \""
#: ../memline.c:3185 #: ../memline.c:3185
msgid "While opening file \"" msgid "While opening file \""

View File

@ -3946,12 +3946,8 @@ msgid "E325: ATTENTION"
msgstr "E325: ВНИМАНИЕ" msgstr "E325: ВНИМАНИЕ"
#: ../memline.c:3222 #: ../memline.c:3222
msgid "" msgid "Found a swap file by the name \""
"\n" msgstr "Обнаружен своп-файл с именем \""
"Found a swap file by the name \""
msgstr ""
"\n"
"Обнаружен своп-файл с именем \""
# С маленькой буквы, чтобы соответствовало по стилю соседним сообщениям. # С маленькой буквы, чтобы соответствовало по стилю соседним сообщениям.
#: ../memline.c:3226 #: ../memline.c:3226

View File

@ -3934,12 +3934,8 @@ msgid "E325: ATTENTION"
msgstr "E325: POZOR" msgstr "E325: POZOR"
#: ../memline.c:3222 #: ../memline.c:3222
msgid "" msgid "Found a swap file by the name \""
"\n" msgstr "N<>jden<65> odkladac<61> s<>bor s menom \""
"Found a swap file by the name \""
msgstr ""
"\n"
"N<>jden<65> odkladac<61> s<>bor s menom \""
#: ../memline.c:3226 #: ../memline.c:3226
msgid "While opening file \"" msgid "While opening file \""

View File

@ -4021,12 +4021,8 @@ msgstr "E773: Symlink петља за \"%s\""
msgid "E325: ATTENTION" msgid "E325: ATTENTION"
msgstr "E325: ПАЖЊА" msgstr "E325: ПАЖЊА"
msgid "" msgid "Found a swap file by the name \""
"\n" msgstr "Пронађена је swap датотека под именом \""
"Found a swap file by the name \""
msgstr ""
"\n"
"Пронађена је swap датотека под именом \""
msgid "While opening file \"" msgid "While opening file \""
msgstr "Док се отварала датотекa \"" msgstr "Док се отварала датотекa \""

View File

@ -6135,12 +6135,8 @@ msgid "E325: ATTENTION"
msgstr "E325: LYSTRING" msgstr "E325: LYSTRING"
#: ../memline.c:3175 #: ../memline.c:3175
msgid "" msgid "Found a swap file by the name \""
"\n" msgstr "Hittade en v<>xlingsfil med namnet \""
"Found a swap file by the name \""
msgstr ""
"\n"
"Hittade en v<>xlingsfil med namnet \""
#: ../memline.c:3179 #: ../memline.c:3179
msgid "While opening file \"" msgid "While opening file \""

View File

@ -3917,12 +3917,8 @@ msgstr "E773: \"%s\" için sembol bağı döngüsü"
msgid "E325: ATTENTION" msgid "E325: ATTENTION"
msgstr "E325: DİKKAT" msgstr "E325: DİKKAT"
msgid "" msgid "Found a swap file by the name \""
"\n" msgstr "Şu adla bir takas dosyası bulundu: \""
"Found a swap file by the name \""
msgstr ""
"\n"
"Şu adla bir takas dosyası bulundu: \""
msgid "While opening file \"" msgid "While opening file \""
msgstr "şu dosya açılırken: \"" msgstr "şu dosya açılırken: \""

View File

@ -5078,12 +5078,8 @@ msgstr "E773: Циклічні символьні посилання «%s»"
msgid "E325: ATTENTION" msgid "E325: ATTENTION"
msgstr "E325: УВАГА" msgstr "E325: УВАГА"
msgid "" msgid "Found a swap file by the name \""
"\n" msgstr "Знайдено файл обміну з назвою \""
"Found a swap file by the name \""
msgstr ""
"\n"
"Знайдено файл обміну з назвою \""
msgid "While opening file \"" msgid "While opening file \""
msgstr "При відкритті файлу \"" msgstr "При відкритті файлу \""

View File

@ -3004,12 +3004,8 @@ msgstr "E317: Giá trị của cái chỉ (pointer) khối số 2 không đúng"
msgid "E325: ATTENTION" msgid "E325: ATTENTION"
msgstr "E325: CHÚ Ý" msgstr "E325: CHÚ Ý"
msgid "" msgid "Found a swap file by the name \""
"\n" msgstr "Tìm thấy một tập tin trao đổi (swap) với tên \""
"Found a swap file by the name \""
msgstr ""
"\n"
"Tìm thấy một tập tin trao đổi (swap) với tên \""
msgid "While opening file \"" msgid "While opening file \""
msgstr "Khi mở tập tin: \"" msgstr "Khi mở tập tin: \""

View File

@ -4741,12 +4741,8 @@ msgid "E325: ATTENTION"
msgstr "E325: 注意" msgstr "E325: 注意"
#: ../memline.c:3073 #: ../memline.c:3073
msgid "" msgid "Found a swap file by the name \""
"\n" msgstr "发现交换文件 \""
"Found a swap file by the name \""
msgstr ""
"\n"
"发现交换文件 \""
#: ../memline.c:3077 #: ../memline.c:3077
msgid "While opening file \"" msgid "While opening file \""

View File

@ -3977,12 +3977,8 @@ msgid "E325: ATTENTION"
msgstr "E325: 注意" msgstr "E325: 注意"
#: ../memline.c:3222 #: ../memline.c:3222
msgid "" msgid "Found a swap file by the name \""
"\n" msgstr "找到暫存檔 \""
"Found a swap file by the name \""
msgstr ""
"\n"
"找到暫存檔 \""
#: ../memline.c:3226 #: ../memline.c:3226
msgid "While opening file \"" msgid "While opening file \""

View File

@ -186,6 +186,8 @@ pcall(vim.cmd.edit, 'Xtest_swapredraw.lua')
foreground = Screen.colors.NvimDarkGrey3, foreground = Screen.colors.NvimDarkGrey3,
background = Screen.colors.NvimLightGrey3, background = Screen.colors.NvimLightGrey3,
}, },
[107] = { foreground = Screen.colors.NvimLightGrey2, bold = true },
[108] = { foreground = Screen.colors.NvimLightBlue },
}) })
exec(init) exec(init)
command('autocmd! nvim.swapfile') -- Delete the default handler (which skips the dialog). command('autocmd! nvim.swapfile') -- Delete the default handler (which skips the dialog).
@ -322,11 +324,6 @@ pcall(vim.cmd.edit, 'Xtest_swapredraw.lua')
command('preserve') -- Make sure the swap file exists. command('preserve') -- Make sure the swap file exists.
local screen = Screen.new(75, 18) local screen = Screen.new(75, 18)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[1] = { bold = true, foreground = Screen.colors.SeaGreen }, -- MoreMsg
})
local nvim1 = n.new_session(true) local nvim1 = n.new_session(true)
set_session(nvim1) set_session(nvim1)
screen:attach() screen:attach()
@ -335,13 +332,18 @@ pcall(vim.cmd.edit, 'Xtest_swapredraw.lua')
feed(':split Xfile1\n') feed(':split Xfile1\n')
-- The default SwapExists handler does _not_ skip this prompt. -- The default SwapExists handler does _not_ skip this prompt.
screen:expect({ screen:expect({
any = pesc('{1:[O]pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort: }^'), any = pesc('{6:[O]pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort: }^'),
}) })
feed('q') feed('q')
screen:expect([[
^ |
{1:~ }|*16
|
]])
feed(':<CR>') feed(':<CR>')
screen:expect([[ screen:expect([[
^ | ^ |
{0:~ }|*16 {1:~ }|*16
: | : |
]]) ]])
nvim1:close() nvim1:close()
@ -354,16 +356,16 @@ pcall(vim.cmd.edit, 'Xtest_swapredraw.lua')
command('set more') command('set more')
command('au bufadd * let foo_w = wincol()') command('au bufadd * let foo_w = wincol()')
feed(':e Xfile1<CR>') feed(':e Xfile1<CR>')
screen:expect({ any = pesc('{1:-- More --}^') }) screen:expect({ any = pesc('{6:-- More --}^') })
feed('<Space>') feed('<Space>')
screen:expect({ screen:expect({
any = pesc('{1:[O]pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort: }^'), any = pesc('{6:[O]pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort: }^'),
}) })
feed('q') feed('q')
command([[echo 'hello']]) command([[echo 'hello']])
screen:expect([[ screen:expect([[
^ | ^ |
{0:~ }|*16 {1:~ }|*16
hello | hello |
]]) ]])
nvim2:close() nvim2:close()
@ -373,11 +375,6 @@ pcall(vim.cmd.edit, 'Xtest_swapredraw.lua')
--- @param on_swapfile_running fun(screen: any) Called after swapfile ("STILL RUNNING") prompt. --- @param on_swapfile_running fun(screen: any) Called after swapfile ("STILL RUNNING") prompt.
local function test_swapfile_after_reboot(swapexists, on_swapfile_running) local function test_swapfile_after_reboot(swapexists, on_swapfile_running)
local screen = Screen.new(75, 30) local screen = Screen.new(75, 30)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[1] = { bold = true, foreground = Screen.colors.SeaGreen }, -- MoreMsg
[2] = { background = Screen.colors.Red, foreground = Screen.colors.White }, -- ErrorMsg
})
exec(init) exec(init)
if not swapexists then if not swapexists then
@ -437,8 +434,8 @@ pcall(vim.cmd.edit, 'Xtest_swapredraw.lua')
feed(':edit Xswaptest<CR>') feed(':edit Xswaptest<CR>')
screen:expect({ screen:expect({
any = table.concat({ any = table.concat({
pesc('{2:E325: ATTENTION}'), '{9:E325: ATTENTION}',
pesc('{1:[O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit, (A)bort: }^'), pesc('{6:[O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit, (A)bort: }^'),
}, '.*'), }, '.*'),
}) })
@ -450,10 +447,10 @@ pcall(vim.cmd.edit, 'Xtest_swapredraw.lua')
test_swapfile_after_reboot(false, function(screen) test_swapfile_after_reboot(false, function(screen)
screen:expect({ screen:expect({
any = table.concat({ any = table.concat({
pesc('{2:E325: ATTENTION}'), '{9:E325: ATTENTION}',
'\n process ID: %d* %(STILL RUNNING%)', '{6: process ID: %d* %(STILL RUNNING%)}',
'\nWhile opening file "Xswaptest"', '{6:While opening file "Xswaptest"}',
pesc('{1:[O]pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort: }^'), pesc('{6:[O]pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort: }^'),
}, '.*'), }, '.*'),
}) })
end) end)