mirror of
https://github.com/neovim/neovim
synced 2025-07-15 16:51:49 +00:00
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:
@ -255,7 +255,7 @@ void screenclear(void)
|
||||
compute_cmdrow();
|
||||
msg_row = cmdline_row; // put cursor on last line for messages
|
||||
msg_col = 0;
|
||||
msg_scrolled = 0; // can't scroll back
|
||||
msg_reset_scroll(); // can't scroll back
|
||||
msg_didany = false;
|
||||
msg_didout = false;
|
||||
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 ((msg_scrolled || msg_grid_invalid) && !cmdline_number_prompt()) {
|
||||
if (msg_scrolled || msg_grid_invalid) {
|
||||
clear_cmdline = true;
|
||||
int valid = MAX(Rows - msg_scrollsize(), 0);
|
||||
if (msg_grid.chars) {
|
||||
|
@ -1402,7 +1402,10 @@ int recover_names(char *fname, bool do_list, list_T *ret_list, int nr, char **fn
|
||||
msg_puts(". ");
|
||||
msg_puts(path_tail(files[i]));
|
||||
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 {
|
||||
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.
|
||||
///
|
||||
/// @return timestamp (0 when unknown).
|
||||
static time_t swapfile_info(char *fname)
|
||||
static time_t swapfile_info(char *fname, StringBuilder *msg)
|
||||
{
|
||||
assert(fname != NULL);
|
||||
ZeroBlock b0;
|
||||
@ -1515,18 +1518,17 @@ static time_t swapfile_info(char *fname)
|
||||
#ifdef UNIX
|
||||
// print name of owner of the file
|
||||
if (os_get_uname((uv_uid_t)file_info.stat.st_uid, uname, B0_UNAME_SIZE) == OK) {
|
||||
msg_puts(_(" owned by: "));
|
||||
msg_outtrans(uname, 0, false);
|
||||
msg_puts(_(" dated: "));
|
||||
kv_printf(*msg, "%s%s", _(" owned by: "), uname);
|
||||
kv_printf(*msg, _(" dated: "));
|
||||
} else {
|
||||
msg_puts(_(" dated: "));
|
||||
kv_printf(*msg, _(" dated: "));
|
||||
}
|
||||
#else
|
||||
msg_puts(_(" dated: "));
|
||||
#endif
|
||||
x = file_info.stat.st_mtim.tv_sec;
|
||||
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
|
||||
@ -1534,56 +1536,56 @@ static time_t swapfile_info(char *fname)
|
||||
if (fd >= 0) {
|
||||
if (read_eintr(fd, &b0, sizeof(b0)) == sizeof(b0)) {
|
||||
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) {
|
||||
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)) {
|
||||
msg_puts(_(" [garbled strings (not nul terminated)]"));
|
||||
kv_printf(*msg, _(" [garbled strings (not nul terminated)]"));
|
||||
} else {
|
||||
msg_puts(_(" file name: "));
|
||||
kv_printf(*msg, _(" file name: "));
|
||||
if (b0.b0_fname[0] == NUL) {
|
||||
msg_puts(_("[No Name]"));
|
||||
kv_printf(*msg, _("[No Name]"));
|
||||
} else {
|
||||
msg_outtrans(b0.b0_fname, 0, false);
|
||||
kv_printf(*msg, "%s", b0.b0_fname);
|
||||
}
|
||||
|
||||
msg_puts(_("\n modified: "));
|
||||
msg_puts(b0.b0_dirty ? _("YES") : _("no"));
|
||||
kv_printf(*msg, _("\n modified: "));
|
||||
kv_printf(*msg, b0.b0_dirty ? _("YES") : _("no"));
|
||||
|
||||
if (*(b0.b0_uname) != NUL) {
|
||||
msg_puts(_("\n user name: "));
|
||||
msg_outtrans(b0.b0_uname, 0, false);
|
||||
kv_printf(*msg, _("\n user name: "));
|
||||
kv_printf(*msg, "%s", b0.b0_uname);
|
||||
}
|
||||
|
||||
if (*(b0.b0_hname) != NUL) {
|
||||
if (*(b0.b0_uname) != NUL) {
|
||||
msg_puts(_(" host name: "));
|
||||
kv_printf(*msg, _(" host name: "));
|
||||
} 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) {
|
||||
msg_puts(_("\n process ID: "));
|
||||
msg_outnum((int)char_to_long(b0.b0_pid));
|
||||
kv_printf(*msg, _("\n process ID: "));
|
||||
kv_printf(*msg, "%d", (int)char_to_long(b0.b0_pid));
|
||||
if ((proc_running = swapfile_proc_running(&b0, fname))) {
|
||||
msg_puts(_(" (STILL RUNNING)"));
|
||||
kv_printf(*msg, _(" (STILL RUNNING)"));
|
||||
}
|
||||
}
|
||||
|
||||
if (b0_magic_wrong(&b0)) {
|
||||
msg_puts(_("\n [not usable on this computer]"));
|
||||
kv_printf(*msg, _("\n [not usable on this computer]"));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
msg_puts(_(" [cannot be read]"));
|
||||
kv_printf(*msg, _(" [cannot be read]"));
|
||||
}
|
||||
close(fd);
|
||||
} else {
|
||||
msg_puts(_(" [cannot be opened]"));
|
||||
kv_printf(*msg, _(" [cannot be opened]"));
|
||||
}
|
||||
msg_putchar('\n');
|
||||
kv_printf(*msg, "\n");
|
||||
|
||||
return x;
|
||||
}
|
||||
@ -3245,50 +3247,47 @@ char *get_file_in_dir(char *fname, char *dname)
|
||||
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 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);
|
||||
|
||||
no_wait_return++;
|
||||
emsg(_("E325: ATTENTION"));
|
||||
msg_puts(_("\nFound a swap file by the name \""));
|
||||
msg_home_replace(fname);
|
||||
msg_puts("\"\n");
|
||||
const time_t swap_mtime = swapfile_info(fname);
|
||||
msg_puts(_("While opening file \""));
|
||||
msg_outtrans(buf->b_fname, 0, false);
|
||||
msg_puts("\"\n");
|
||||
kv_printf(*msg, _("Found a swap file by the name \""));
|
||||
kv_printf(*msg, "%s\"\n", fhname);
|
||||
const time_t swap_mtime = swapfile_info(fname, msg);
|
||||
kv_printf(*msg, (_("While opening file \"")));
|
||||
kv_printf(*msg, "%s\"\n", buf->b_fname);
|
||||
FileInfo file_info;
|
||||
if (!os_fileinfo(buf->b_fname, &file_info)) {
|
||||
msg_puts(_(" CANNOT BE FOUND"));
|
||||
kv_printf(*msg, _(" CANNOT BE FOUND"));
|
||||
} else {
|
||||
msg_puts(_(" dated: "));
|
||||
kv_printf(*msg, _(" dated: "));
|
||||
time_t x = file_info.stat.st_mtim.tv_sec;
|
||||
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) {
|
||||
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
|
||||
// other languages.
|
||||
msg_puts(_("\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"
|
||||
" instances of the same\n file when making changes."
|
||||
" Quit, or continue with caution.\n"));
|
||||
msg_puts(_("(2) An edit session for this file crashed.\n"));
|
||||
msg_puts(_(" If this is the case, use \":recover\" or \"nvim -r "));
|
||||
msg_outtrans(buf->b_fname, 0, false);
|
||||
msg_puts(_("\"\n to recover the changes (see \":help recovery\").\n"));
|
||||
msg_puts(_(" If you did this already, delete the swap file \""));
|
||||
msg_outtrans(fname, 0, false);
|
||||
msg_puts(_("\"\n to avoid this message.\n"));
|
||||
cmdline_row = msg_row;
|
||||
no_wait_return--;
|
||||
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"
|
||||
" instances of the same\n file when making changes."
|
||||
" Quit, or continue with caution.\n"));
|
||||
kv_printf(*msg, _("(2) An edit session for this file crashed.\n"));
|
||||
kv_printf(*msg, _(" If this is the case, use \":recover\" or \"nvim -r "));
|
||||
kv_printf(*msg, "%s", buf->b_fname);
|
||||
kv_printf(*msg, (_("\"\n to recover the changes (see \":help recovery\").\n")));
|
||||
kv_printf(*msg, _(" If you did this already, delete the swap file \""));
|
||||
kv_printf(*msg, "%s", fname);
|
||||
kv_printf(*msg, _("\"\n to avoid this message.\n"));
|
||||
}
|
||||
|
||||
/// 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.
|
||||
if (choice == SEA_CHOICE_NONE) {
|
||||
no_wait_return++;
|
||||
// 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
|
||||
// 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
|
||||
// interfere with the prompt here.
|
||||
flush_buffers(FLUSH_TYPEAHEAD);
|
||||
}
|
||||
|
||||
if (swap_exists_action != SEA_NONE && choice == SEA_CHOICE_NONE) {
|
||||
const char *const sw_msg_1 = _("Swap file \"");
|
||||
const char *const sw_msg_2 = _("\" already exists!");
|
||||
if (swap_exists_action != SEA_NONE) {
|
||||
kv_printf(msg, _("Swap file \""));
|
||||
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
|
||||
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;
|
||||
xfree(name);
|
||||
|
||||
// pretend screen didn't scroll, need redraw anyway
|
||||
msg_reset_scroll();
|
||||
no_wait_return--;
|
||||
kv_destroy(msg);
|
||||
xfree(fhname);
|
||||
}
|
||||
|
||||
switch (choice) {
|
||||
|
@ -3575,12 +3575,8 @@ msgstr "E317: wyser blok id verkeerd 2"
|
||||
msgid "E325: ATTENTION"
|
||||
msgstr "E325: LET OP"
|
||||
|
||||
msgid ""
|
||||
"\n"
|
||||
"Found a swap file by the name \""
|
||||
msgstr ""
|
||||
"\n"
|
||||
"Het 'n ruill<6C>er gevind met die naam \""
|
||||
msgid "Found a swap file by the name \""
|
||||
msgstr "Het 'n ruill<6C>er gevind met die naam \""
|
||||
|
||||
msgid "While opening file \""
|
||||
msgstr "Tydens oopmaak van l<>er \""
|
||||
|
@ -3976,10 +3976,8 @@ msgid "E325: ATTENTION"
|
||||
msgstr "E325: ATENCI<43>"
|
||||
|
||||
#: ../memline.c:3222
|
||||
msgid ""
|
||||
"\n"
|
||||
"Found a swap file by the name \""
|
||||
msgstr "\nS'ha trobat un fitxer d'intercanvi amb nom \""
|
||||
msgid "Found a swap file by the name \""
|
||||
msgstr "S'ha trobat un fitxer d'intercanvi amb nom \""
|
||||
|
||||
#: ../memline.c:3226
|
||||
msgid "While opening file \""
|
||||
|
@ -4036,12 +4036,8 @@ msgid "E325: ATTENTION"
|
||||
msgstr "E325: POZOR"
|
||||
|
||||
#: ../memline.c:3222
|
||||
msgid ""
|
||||
"\n"
|
||||
"Found a swap file by the name \""
|
||||
msgstr ""
|
||||
"\n"
|
||||
"Nalezen odkl<6B>dac<61> soubor se jm<6A>nem \""
|
||||
msgid "Found a swap file by the name \""
|
||||
msgstr "Nalezen odkl<6B>dac<61> soubor se jm<6A>nem \""
|
||||
|
||||
#: ../memline.c:3226
|
||||
msgid "While opening file \""
|
||||
|
@ -4036,12 +4036,8 @@ msgid "E325: ATTENTION"
|
||||
msgstr "E325: POZOR"
|
||||
|
||||
#: ../memline.c:3222
|
||||
msgid ""
|
||||
"\n"
|
||||
"Found a swap file by the name \""
|
||||
msgstr ""
|
||||
"\n"
|
||||
"Nalezen odkl<6B>dac<61> soubor se jm<6A>nem \""
|
||||
msgid "Found a swap file by the name \""
|
||||
msgstr "Nalezen odkl<6B>dac<61> soubor se jm<6A>nem \""
|
||||
|
||||
#: ../memline.c:3226
|
||||
msgid "While opening file \""
|
||||
|
@ -3636,12 +3636,8 @@ msgstr "E773: Symlink-løkke for \"%s\""
|
||||
msgid "E325: ATTENTION"
|
||||
msgstr "E325: OBS"
|
||||
|
||||
msgid ""
|
||||
"\n"
|
||||
"Found a swap file by the name \""
|
||||
msgstr ""
|
||||
"\n"
|
||||
"Fandt en swap-fil ved navn \""
|
||||
msgid "Found a swap file by the name \""
|
||||
msgstr "Fandt en swap-fil ved navn \""
|
||||
|
||||
msgid "While opening file \""
|
||||
msgstr "Ved åbning af filen \""
|
||||
|
@ -3399,12 +3399,8 @@ msgid "E325: ATTENTION"
|
||||
msgstr "E325: ACHTUNG"
|
||||
|
||||
#: ../memline.c:3179
|
||||
msgid ""
|
||||
"\n"
|
||||
"Found a swap file by the name \""
|
||||
msgstr ""
|
||||
"\n"
|
||||
"Auslagerungsdatei mit folgendem Namen gefunden: \""
|
||||
msgid "Found a swap file by the name \""
|
||||
msgstr "Auslagerungsdatei mit folgendem Namen gefunden: \""
|
||||
|
||||
#: ../memline.c:3183
|
||||
msgid "While opening file \""
|
||||
|
@ -3817,9 +3817,7 @@ msgid "E325: ATTENTION"
|
||||
msgstr ""
|
||||
|
||||
#: ../memline.c:3222
|
||||
msgid ""
|
||||
"\n"
|
||||
"Found a swap file by the name \""
|
||||
msgid "Found a swap file by the name \""
|
||||
msgstr ""
|
||||
|
||||
#: ../memline.c:3226
|
||||
|
@ -3504,12 +3504,8 @@ msgstr "E773: Buklo de simbolaj ligiloj por \"%s\""
|
||||
msgid "E325: ATTENTION"
|
||||
msgstr "E325: ATENTO"
|
||||
|
||||
msgid ""
|
||||
"\n"
|
||||
"Found a swap file by the name \""
|
||||
msgstr ""
|
||||
"\n"
|
||||
"Trovis permutodosieron .swp kun la nomo \""
|
||||
msgid "Found a swap file by the name \""
|
||||
msgstr "Trovis permutodosieron .swp kun la nomo \""
|
||||
|
||||
msgid "While opening file \""
|
||||
msgstr "Dum malfermo de dosiero \""
|
||||
|
@ -4035,12 +4035,8 @@ msgid "E325: ATTENTION"
|
||||
msgstr "E325: ATENCIÓN"
|
||||
|
||||
#: ../memline.c:3222
|
||||
msgid ""
|
||||
"\n"
|
||||
"Found a swap file by the name \""
|
||||
msgstr ""
|
||||
"\n"
|
||||
"Se ha encontrado un archivo de intercambio con el nombre \""
|
||||
msgid "Found a swap file by the name \""
|
||||
msgstr "Se ha encontrado un archivo de intercambio con el nombre \""
|
||||
|
||||
#: ../memline.c:3226
|
||||
msgid "While opening file \""
|
||||
|
@ -3633,12 +3633,8 @@ msgstr "E773: Symlinkkisilmukka kohteelle %s"
|
||||
msgid "E325: ATTENTION"
|
||||
msgstr "E325: HUOMAA"
|
||||
|
||||
msgid ""
|
||||
"\n"
|
||||
"Found a swap file by the name \""
|
||||
msgstr ""
|
||||
"\n"
|
||||
"Swap-tiedosto löytyi: \""
|
||||
msgid "Found a swap file by the name \""
|
||||
msgstr "Swap-tiedosto löytyi: \""
|
||||
|
||||
msgid "While opening file \""
|
||||
msgstr "Avattaessa tiedostoa "
|
||||
|
@ -3213,12 +3213,8 @@ msgstr "E773: cycle de liens symboliques avec \"%s\""
|
||||
msgid "E325: ATTENTION"
|
||||
msgstr "E325: ATTENTION"
|
||||
|
||||
msgid ""
|
||||
"\n"
|
||||
"Found a swap file by the name \""
|
||||
msgstr ""
|
||||
"\n"
|
||||
"Trouv<75> un fichier d'<27>change nomm<6D> \""
|
||||
msgid "Found a swap file by the name \""
|
||||
msgstr "Trouv<75> un fichier d'<27>change nomm<6D> \""
|
||||
|
||||
msgid "While opening file \""
|
||||
msgstr "Lors de l'ouverture du fichier \""
|
||||
|
@ -3667,12 +3667,8 @@ msgstr "E773: Ciogal i naisc shiombalacha le haghaidh \"%s\""
|
||||
msgid "E325: ATTENTION"
|
||||
msgstr "E325: AIRE"
|
||||
|
||||
msgid ""
|
||||
"\n"
|
||||
"Found a swap file by the name \""
|
||||
msgstr ""
|
||||
"\n"
|
||||
"Fuarthas comhad babht<68>la darbh ainm \""
|
||||
msgid "Found a swap file by the name \""
|
||||
msgstr "Fuarthas comhad babht<68>la darbh ainm \""
|
||||
|
||||
msgid "While opening file \""
|
||||
msgstr "Agus an comhad seo <20> oscailt: \""
|
||||
|
@ -4001,12 +4001,8 @@ msgid "E325: ATTENTION"
|
||||
msgstr "E325: ATTENZIONE"
|
||||
|
||||
#: ../memline.c:3222
|
||||
msgid ""
|
||||
"\n"
|
||||
"Found a swap file by the name \""
|
||||
msgstr ""
|
||||
"\n"
|
||||
"Trovato uno swap file di nome \""
|
||||
msgid "Found a swap file by the name \""
|
||||
msgstr "Trovato uno swap file di nome \""
|
||||
|
||||
#: ../memline.c:3226
|
||||
msgid "While opening file \""
|
||||
|
@ -3438,12 +3438,8 @@ msgstr "E773: \"%s\"
|
||||
msgid "E325: ATTENTION"
|
||||
msgstr "E325: <20><><EFBFBD><EFBFBD>"
|
||||
|
||||
msgid ""
|
||||
"\n"
|
||||
"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 "Found a swap file by the name \""
|
||||
msgstr "<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 \""
|
||||
msgstr "<22><><EFBFBD>Υե<CEA5><D5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><F2B3ABA4>Ƥ<EFBFBD><C6A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> \""
|
||||
|
@ -5061,12 +5061,8 @@ msgstr "E773: \"%s\" のシンボリックリンクがループになってい
|
||||
msgid "E325: ATTENTION"
|
||||
msgstr "E325: 注意"
|
||||
|
||||
msgid ""
|
||||
"\n"
|
||||
"Found a swap file by the name \""
|
||||
msgstr ""
|
||||
"\n"
|
||||
"次の名前でスワップファイルを見つけました \""
|
||||
msgid "Found a swap file by the name \""
|
||||
msgstr "次の名前でスワップファイルを見つけました \""
|
||||
|
||||
msgid "While opening file \""
|
||||
msgstr "次のファイルを開いている最中 \""
|
||||
|
@ -3916,12 +3916,8 @@ msgid "E325: ATTENTION"
|
||||
msgstr "E325: 주목"
|
||||
|
||||
#: ../memline.c:3222
|
||||
msgid ""
|
||||
"\n"
|
||||
"Found a swap file by the name \""
|
||||
msgstr ""
|
||||
"\n"
|
||||
"Found a swap file by the name \""
|
||||
msgid "Found a swap file by the name \""
|
||||
msgstr "Found a swap file by the name \""
|
||||
|
||||
#: ../memline.c:3226
|
||||
msgid "While opening file \""
|
||||
|
@ -3937,12 +3937,8 @@ msgid "E325: ATTENTION"
|
||||
msgstr "E325: VIKTIG"
|
||||
|
||||
#: ../memline.c:3222
|
||||
msgid ""
|
||||
"\n"
|
||||
"Found a swap file by the name \""
|
||||
msgstr ""
|
||||
"\n"
|
||||
"Fant en swapfil ved navn \""
|
||||
msgid "Found a swap file by the name \""
|
||||
msgstr "Fant en swapfil ved navn \""
|
||||
|
||||
#: ../memline.c:3226
|
||||
msgid "While opening file \""
|
||||
|
@ -3943,12 +3943,8 @@ msgid "E325: ATTENTION"
|
||||
msgstr "E325: OPGELET"
|
||||
|
||||
#: ../memline.c:3222
|
||||
msgid ""
|
||||
"\n"
|
||||
"Found a swap file by the name \""
|
||||
msgstr ""
|
||||
"\n"
|
||||
"Er is een wisselbestand aangetroffen met de naam \""
|
||||
msgid "Found a swap file by the name \""
|
||||
msgstr "Er is een wisselbestand aangetroffen met de naam \""
|
||||
|
||||
#: ../memline.c:3226
|
||||
msgid "While opening file \""
|
||||
|
@ -3937,12 +3937,8 @@ msgid "E325: ATTENTION"
|
||||
msgstr "E325: VIKTIG"
|
||||
|
||||
#: ../memline.c:3222
|
||||
msgid ""
|
||||
"\n"
|
||||
"Found a swap file by the name \""
|
||||
msgstr ""
|
||||
"\n"
|
||||
"Fant en swapfil ved navn \""
|
||||
msgid "Found a swap file by the name \""
|
||||
msgstr "Fant en swapfil ved navn \""
|
||||
|
||||
#: ../memline.c:3226
|
||||
msgid "While opening file \""
|
||||
|
@ -3909,12 +3909,8 @@ msgid "E325: ATTENTION"
|
||||
msgstr "E325: UWAGA"
|
||||
|
||||
#: ../memline.c:3222
|
||||
msgid ""
|
||||
"\n"
|
||||
"Found a swap file by the name \""
|
||||
msgstr ""
|
||||
"\n"
|
||||
"Znalazłem plik wymiany o nazwie \""
|
||||
msgid "Found a swap file by the name \""
|
||||
msgstr "Znalazłem plik wymiany o nazwie \""
|
||||
|
||||
#: ../memline.c:3226
|
||||
msgid "While opening file \""
|
||||
|
@ -584,12 +584,8 @@ msgid "E325: ATTENTION"
|
||||
msgstr "E325: ATEN<45><4E>O"
|
||||
|
||||
#: ../memline.c:3181
|
||||
msgid ""
|
||||
"\n"
|
||||
"Found a swap file by the name \""
|
||||
msgstr ""
|
||||
"\n"
|
||||
"Foi encontrado um arquivo de troca de nome \""
|
||||
msgid "Found a swap file by the name \""
|
||||
msgstr "Foi encontrado um arquivo de troca de nome \""
|
||||
|
||||
#: ../memline.c:3185
|
||||
msgid "While opening file \""
|
||||
|
@ -3946,12 +3946,8 @@ msgid "E325: ATTENTION"
|
||||
msgstr "E325: ВНИМАНИЕ"
|
||||
|
||||
#: ../memline.c:3222
|
||||
msgid ""
|
||||
"\n"
|
||||
"Found a swap file by the name \""
|
||||
msgstr ""
|
||||
"\n"
|
||||
"Обнаружен своп-файл с именем \""
|
||||
msgid "Found a swap file by the name \""
|
||||
msgstr "Обнаружен своп-файл с именем \""
|
||||
|
||||
# С маленькой буквы, чтобы соответствовало по стилю соседним сообщениям.
|
||||
#: ../memline.c:3226
|
||||
|
@ -3934,12 +3934,8 @@ msgid "E325: ATTENTION"
|
||||
msgstr "E325: POZOR"
|
||||
|
||||
#: ../memline.c:3222
|
||||
msgid ""
|
||||
"\n"
|
||||
"Found a swap file by the name \""
|
||||
msgstr ""
|
||||
"\n"
|
||||
"N<>jden<65> odkladac<61> s<>bor s menom \""
|
||||
msgid "Found a swap file by the name \""
|
||||
msgstr "N<>jden<65> odkladac<61> s<>bor s menom \""
|
||||
|
||||
#: ../memline.c:3226
|
||||
msgid "While opening file \""
|
||||
|
@ -4021,12 +4021,8 @@ msgstr "E773: Symlink петља за \"%s\""
|
||||
msgid "E325: ATTENTION"
|
||||
msgstr "E325: ПАЖЊА"
|
||||
|
||||
msgid ""
|
||||
"\n"
|
||||
"Found a swap file by the name \""
|
||||
msgstr ""
|
||||
"\n"
|
||||
"Пронађена је swap датотека под именом \""
|
||||
msgid "Found a swap file by the name \""
|
||||
msgstr "Пронађена је swap датотека под именом \""
|
||||
|
||||
msgid "While opening file \""
|
||||
msgstr "Док се отварала датотекa \""
|
||||
|
@ -6135,12 +6135,8 @@ msgid "E325: ATTENTION"
|
||||
msgstr "E325: LYSTRING"
|
||||
|
||||
#: ../memline.c:3175
|
||||
msgid ""
|
||||
"\n"
|
||||
"Found a swap file by the name \""
|
||||
msgstr ""
|
||||
"\n"
|
||||
"Hittade en v<>xlingsfil med namnet \""
|
||||
msgid "Found a swap file by the name \""
|
||||
msgstr "Hittade en v<>xlingsfil med namnet \""
|
||||
|
||||
#: ../memline.c:3179
|
||||
msgid "While opening file \""
|
||||
|
@ -3917,12 +3917,8 @@ msgstr "E773: \"%s\" için sembol bağı döngüsü"
|
||||
msgid "E325: ATTENTION"
|
||||
msgstr "E325: DİKKAT"
|
||||
|
||||
msgid ""
|
||||
"\n"
|
||||
"Found a swap file by the name \""
|
||||
msgstr ""
|
||||
"\n"
|
||||
"Şu adla bir takas dosyası bulundu: \""
|
||||
msgid "Found a swap file by the name \""
|
||||
msgstr "Şu adla bir takas dosyası bulundu: \""
|
||||
|
||||
msgid "While opening file \""
|
||||
msgstr "şu dosya açılırken: \""
|
||||
|
@ -5078,12 +5078,8 @@ msgstr "E773: Циклічні символьні посилання «%s»"
|
||||
msgid "E325: ATTENTION"
|
||||
msgstr "E325: УВАГА"
|
||||
|
||||
msgid ""
|
||||
"\n"
|
||||
"Found a swap file by the name \""
|
||||
msgstr ""
|
||||
"\n"
|
||||
"Знайдено файл обміну з назвою \""
|
||||
msgid "Found a swap file by the name \""
|
||||
msgstr "Знайдено файл обміну з назвою \""
|
||||
|
||||
msgid "While opening file \""
|
||||
msgstr "При відкритті файлу \""
|
||||
|
@ -3004,12 +3004,8 @@ msgstr "E317: Giá trị của cái chỉ (pointer) khối số 2 không đúng"
|
||||
msgid "E325: ATTENTION"
|
||||
msgstr "E325: CHÚ Ý"
|
||||
|
||||
msgid ""
|
||||
"\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 "Found a swap file by the name \""
|
||||
msgstr "Tìm thấy một tập tin trao đổi (swap) với tên \""
|
||||
|
||||
msgid "While opening file \""
|
||||
msgstr "Khi mở tập tin: \""
|
||||
|
@ -4741,12 +4741,8 @@ msgid "E325: ATTENTION"
|
||||
msgstr "E325: 注意"
|
||||
|
||||
#: ../memline.c:3073
|
||||
msgid ""
|
||||
"\n"
|
||||
"Found a swap file by the name \""
|
||||
msgstr ""
|
||||
"\n"
|
||||
"发现交换文件 \""
|
||||
msgid "Found a swap file by the name \""
|
||||
msgstr "发现交换文件 \""
|
||||
|
||||
#: ../memline.c:3077
|
||||
msgid "While opening file \""
|
||||
|
@ -3977,12 +3977,8 @@ msgid "E325: ATTENTION"
|
||||
msgstr "E325: 注意"
|
||||
|
||||
#: ../memline.c:3222
|
||||
msgid ""
|
||||
"\n"
|
||||
"Found a swap file by the name \""
|
||||
msgstr ""
|
||||
"\n"
|
||||
"找到暫存檔 \""
|
||||
msgid "Found a swap file by the name \""
|
||||
msgstr "找到暫存檔 \""
|
||||
|
||||
#: ../memline.c:3226
|
||||
msgid "While opening file \""
|
||||
|
@ -186,6 +186,8 @@ pcall(vim.cmd.edit, 'Xtest_swapredraw.lua')
|
||||
foreground = Screen.colors.NvimDarkGrey3,
|
||||
background = Screen.colors.NvimLightGrey3,
|
||||
},
|
||||
[107] = { foreground = Screen.colors.NvimLightGrey2, bold = true },
|
||||
[108] = { foreground = Screen.colors.NvimLightBlue },
|
||||
})
|
||||
exec(init)
|
||||
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.
|
||||
|
||||
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)
|
||||
set_session(nvim1)
|
||||
screen:attach()
|
||||
@ -335,13 +332,18 @@ pcall(vim.cmd.edit, 'Xtest_swapredraw.lua')
|
||||
feed(':split Xfile1\n')
|
||||
-- The default SwapExists handler does _not_ skip this prompt.
|
||||
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')
|
||||
screen:expect([[
|
||||
^ |
|
||||
{1:~ }|*16
|
||||
|
|
||||
]])
|
||||
feed(':<CR>')
|
||||
screen:expect([[
|
||||
^ |
|
||||
{0:~ }|*16
|
||||
{1:~ }|*16
|
||||
: |
|
||||
]])
|
||||
nvim1:close()
|
||||
@ -354,16 +356,16 @@ pcall(vim.cmd.edit, 'Xtest_swapredraw.lua')
|
||||
command('set more')
|
||||
command('au bufadd * let foo_w = wincol()')
|
||||
feed(':e Xfile1<CR>')
|
||||
screen:expect({ any = pesc('{1:-- More --}^') })
|
||||
screen:expect({ any = pesc('{6:-- More --}^') })
|
||||
feed('<Space>')
|
||||
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')
|
||||
command([[echo 'hello']])
|
||||
screen:expect([[
|
||||
^ |
|
||||
{0:~ }|*16
|
||||
{1:~ }|*16
|
||||
hello |
|
||||
]])
|
||||
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.
|
||||
local function test_swapfile_after_reboot(swapexists, on_swapfile_running)
|
||||
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)
|
||||
if not swapexists then
|
||||
@ -437,8 +434,8 @@ pcall(vim.cmd.edit, 'Xtest_swapredraw.lua')
|
||||
feed(':edit Xswaptest<CR>')
|
||||
screen:expect({
|
||||
any = table.concat({
|
||||
pesc('{2:E325: ATTENTION}'),
|
||||
pesc('{1:[O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit, (A)bort: }^'),
|
||||
'{9:E325: ATTENTION}',
|
||||
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)
|
||||
screen:expect({
|
||||
any = table.concat({
|
||||
pesc('{2:E325: ATTENTION}'),
|
||||
'\n process ID: %d* %(STILL RUNNING%)',
|
||||
'\nWhile opening file "Xswaptest"',
|
||||
pesc('{1:[O]pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort: }^'),
|
||||
'{9:E325: ATTENTION}',
|
||||
'{6: process ID: %d* %(STILL RUNNING%)}',
|
||||
'{6:While opening file "Xswaptest"}',
|
||||
pesc('{6:[O]pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort: }^'),
|
||||
}, '.*'),
|
||||
})
|
||||
end)
|
||||
|
Reference in New Issue
Block a user