diff --git a/src/files.c b/src/files.c
index e295a02c859c045b023a0506dfe0a7d500ab41d6..e6fe1fb62c68f7bb58ea5bf24209f688c24affe3 100644
--- a/src/files.c
+++ b/src/files.c
@@ -345,6 +345,9 @@ int do_lockfile(const char *filename)
 		pidstring = charalloc(11);
 		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. */
 		question = _("File %s is being edited (by %s with %s, PID %s); continue?");
 		room = COLS - strlenpt(question) + 7 - strlenpt(lockuser) -
@@ -359,7 +362,7 @@ int do_lockfile(const char *filename)
 			strcat(postedname, fragment);
 			free(fragment);
 		} else
-			postedname = mallocstrcpy(NULL, filename);
+			postedname = display_string(filename, 0, room, FALSE);
 
 		/* Allow extra space for username (14), program name (8), PID (8),
 		 * 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) {
 					char *question = _("File \"%s\" exists; OVERWRITE? ");
+					char *name = display_string(answer, 0,
+										COLS - strlenpt(question) + 1, FALSE);
 					char *message = charalloc(strlen(question) +
-												strlen(answer) + 1);
-					sprintf(message, question, answer);
+												strlen(name) + 1);
+
+					sprintf(message, question, name);
 
 					i = do_yesno_prompt(FALSE, message);
+
 					free(message);
+					free(name);
 
 					if (i < 1)
 						continue;
diff --git a/src/prompt.c b/src/prompt.c
index 3001dfac4089e1ea9ce77939bdbf513f448b0d20..c6b97b423763c31770baf31b0b97a821e130f7a9 100644
--- a/src/prompt.c
+++ b/src/prompt.c
@@ -669,7 +669,6 @@ int do_prompt(bool allow_tabs, bool allow_files,
 int do_yesno_prompt(bool all, const char *msg)
 {
 	int response = -2, width = 16;
-	char *message = display_string(msg, 0, COLS, FALSE);
 
 	/* TRANSLATORS: For the next three strings, if possible, specify
 	 * 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. */
 		wattron(bottomwin, interface_color_pair[TITLE_BAR]);
 		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]);
 		wnoutrefresh(bottomwin);
 
@@ -755,7 +754,5 @@ int do_yesno_prompt(bool all, const char *msg)
 #endif /* ENABLE_MOUSE */
 	}
 
-	free(message);
-
 	return response;
 }