From 2661d6d397f35b2e83f62fb3e404735c3770f31c Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Thu, 28 May 2015 13:51:03 +0000
Subject: [PATCH] Using 'width' instead of hardcoded 16.  And doing things in
 the same order for all three cases: setting the string and then positioning
 the cursor.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5230 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 ChangeLog    | 2 ++
 src/prompt.c | 8 ++++----
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 77bc452f..4882f9b7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,8 @@
 2015-05-28  Benno Schulenberg  <bensberg@justemail.net>
 	* src/help.c (do_help), src/prompt.c (do_yesno_prompt): Normalize
 	the whitespace after the recent changes in logic.
+	* src/prompt.c (do_yesno_prompt): Use 'width' instead of hardcoded
+	16.  Also always first set the string and then position the cursor.
 
 2015-05-28  Mahyar Abbaspour  <mahyar.abaspour@gmail.com>
 	* src/nano.c (handle_sigwinch, regenerate_screen), src/global.c,
diff --git a/src/prompt.c b/src/prompt.c
index 4766eb76..671d53ac 100644
--- a/src/prompt.c
+++ b/src/prompt.c
@@ -1077,7 +1077,7 @@ int do_yesno_prompt(bool all, const char *msg)
 
 	if (!ISSET(NO_HELP)) {
 	    char shortstr[3];
-		/* Temp string for Yes, No, All. */
+		/* Temporary string for (translated) " Y", " N" and " A". */
 
 	    if (COLS < 32)
 		width = COLS / 2;
@@ -1091,16 +1091,16 @@ int do_yesno_prompt(bool all, const char *msg)
 	    onekey(shortstr, _("Yes"), width);
 
 	    if (all) {
-		wmove(bottomwin, 1, width);
 		shortstr[1] = allstr[0];
+		wmove(bottomwin, 1, width);
 		onekey(shortstr, _("All"), width);
 	    }
 
-	    wmove(bottomwin, 2, 0);
 	    shortstr[1] = nostr[0];
+	    wmove(bottomwin, 2, 0);
 	    onekey(shortstr, _("No"), width);
 
-	    wmove(bottomwin, 2, 16);
+	    wmove(bottomwin, 2, width);
 	    onekey("^C", _("Cancel"), width);
 	}
 
-- 
GitLab