prompt: show whitespace only in the filename, not in the whole line
That is, call display_string() just on the filename, not on the rest of the prompt text. This fixes https://savannah.gnu.org/bugs/?52967. Reported-by: Andreas Schamanek <schamane@fam.tuwien.ac.at>master
parent
7b9bd65362
commit
97cbbb0cc8
14
src/files.c
14
src/files.c
|
@ -345,6 +345,9 @@ int do_lockfile(const char *filename)
|
||||||
pidstring = charalloc(11);
|
pidstring = charalloc(11);
|
||||||
sprintf (pidstring, "%u", (unsigned int)lockpid);
|
sprintf (pidstring, "%u", (unsigned int)lockpid);
|
||||||
|
|
||||||
|
/* Display newlines in filenames as ^J. */
|
||||||
|
as_an_at = FALSE;
|
||||||
|
|
||||||
/* TRANSLATORS: The second %s is the name of the user, the third that of the editor. */
|
/* TRANSLATORS: The second %s is the name of the user, the third that of the editor. */
|
||||||
question = _("File %s is being edited (by %s with %s, PID %s); continue?");
|
question = _("File %s is being edited (by %s with %s, PID %s); continue?");
|
||||||
room = COLS - strlenpt(question) + 7 - strlenpt(lockuser) -
|
room = COLS - strlenpt(question) + 7 - strlenpt(lockuser) -
|
||||||
|
@ -359,7 +362,7 @@ int do_lockfile(const char *filename)
|
||||||
strcat(postedname, fragment);
|
strcat(postedname, fragment);
|
||||||
free(fragment);
|
free(fragment);
|
||||||
} else
|
} else
|
||||||
postedname = mallocstrcpy(NULL, filename);
|
postedname = display_string(filename, 0, room, FALSE);
|
||||||
|
|
||||||
/* Allow extra space for username (14), program name (8), PID (8),
|
/* Allow extra space for username (14), program name (8), PID (8),
|
||||||
* and terminating \0 (1), minus the %s (2) for the file name. */
|
* and terminating \0 (1), minus the %s (2) for the file name. */
|
||||||
|
@ -2193,12 +2196,17 @@ int do_writeout(bool exiting, bool withprompt)
|
||||||
|
|
||||||
if (name_exists) {
|
if (name_exists) {
|
||||||
char *question = _("File \"%s\" exists; OVERWRITE? ");
|
char *question = _("File \"%s\" exists; OVERWRITE? ");
|
||||||
|
char *name = display_string(answer, 0,
|
||||||
|
COLS - strlenpt(question) + 1, FALSE);
|
||||||
char *message = charalloc(strlen(question) +
|
char *message = charalloc(strlen(question) +
|
||||||
strlen(answer) + 1);
|
strlen(name) + 1);
|
||||||
sprintf(message, question, answer);
|
|
||||||
|
sprintf(message, question, name);
|
||||||
|
|
||||||
i = do_yesno_prompt(FALSE, message);
|
i = do_yesno_prompt(FALSE, message);
|
||||||
|
|
||||||
free(message);
|
free(message);
|
||||||
|
free(name);
|
||||||
|
|
||||||
if (i < 1)
|
if (i < 1)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -669,7 +669,6 @@ int do_prompt(bool allow_tabs, bool allow_files,
|
||||||
int do_yesno_prompt(bool all, const char *msg)
|
int do_yesno_prompt(bool all, const char *msg)
|
||||||
{
|
{
|
||||||
int response = -2, width = 16;
|
int response = -2, width = 16;
|
||||||
char *message = display_string(msg, 0, COLS, FALSE);
|
|
||||||
|
|
||||||
/* TRANSLATORS: For the next three strings, if possible, specify
|
/* TRANSLATORS: For the next three strings, if possible, specify
|
||||||
* the single-byte letters for both your language and English.
|
* the single-byte letters for both your language and English.
|
||||||
|
@ -717,7 +716,7 @@ int do_yesno_prompt(bool all, const char *msg)
|
||||||
/* Color the statusbar over its full width and display the question. */
|
/* Color the statusbar over its full width and display the question. */
|
||||||
wattron(bottomwin, interface_color_pair[TITLE_BAR]);
|
wattron(bottomwin, interface_color_pair[TITLE_BAR]);
|
||||||
blank_statusbar();
|
blank_statusbar();
|
||||||
mvwaddnstr(bottomwin, 0, 0, message, actual_x(message, COLS - 1));
|
mvwaddnstr(bottomwin, 0, 0, msg, actual_x(msg, COLS - 1));
|
||||||
wattroff(bottomwin, interface_color_pair[TITLE_BAR]);
|
wattroff(bottomwin, interface_color_pair[TITLE_BAR]);
|
||||||
wnoutrefresh(bottomwin);
|
wnoutrefresh(bottomwin);
|
||||||
|
|
||||||
|
@ -755,7 +754,5 @@ int do_yesno_prompt(bool all, const char *msg)
|
||||||
#endif /* ENABLE_MOUSE */
|
#endif /* ENABLE_MOUSE */
|
||||||
}
|
}
|
||||||
|
|
||||||
free(message);
|
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue