From f5deac3d0fb4666cabccd0950b739a66cb19d787 Mon Sep 17 00:00:00 2001
From: Chris Allegretta <chrisa@asty.org>
Date: Thu, 2 Nov 2000 05:10:26 +0000
Subject: [PATCH] Oops, fix answer getting borked when using shortcuts at
 statusbar and nothing's typed

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@258 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 po/nano.pot | 48 ++++++++++++++++++++++++------------------------
 search.c    | 10 +---------
 winio.c     |  3 +--
 3 files changed, 26 insertions(+), 35 deletions(-)

diff --git a/po/nano.pot b/po/nano.pot
index 16358e6b..97389053 100644
--- a/po/nano.pot
+++ b/po/nano.pot
@@ -6,7 +6,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2000-11-01 23:34-0500\n"
+"POT-Creation-Date: 2000-11-02 00:10-0500\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -380,7 +380,7 @@ msgid "Case Sens"
 msgstr ""
 
 #: global.c:344 global.c:364 global.c:375 global.c:385 global.c:401
-#: global.c:405 global.c:411 winio.c:982
+#: global.c:405 global.c:411 winio.c:981
 msgid "Cancel"
 msgstr ""
 
@@ -775,36 +775,36 @@ msgstr ""
 msgid "Replaced 1 occurence"
 msgstr ""
 
-#: search.c:426 search.c:442 search.c:464
+#: search.c:426 search.c:442 search.c:456
 msgid "Replace Cancelled"
 msgstr ""
 
-#: search.c:458
+#: search.c:450
 msgid "Replace with"
 msgstr ""
 
-#: search.c:495
+#: search.c:487
 msgid "Replace this instance?"
 msgstr ""
 
-#: search.c:503
+#: search.c:495
 msgid "Replace failed: unknown subexpression!"
 msgstr ""
 
 #. Ask for it
-#: search.c:556
+#: search.c:548
 msgid "Enter line number"
 msgstr ""
 
-#: search.c:558
+#: search.c:550
 msgid "Aborted"
 msgstr ""
 
-#: search.c:578
+#: search.c:570
 msgid "Come on, be reasonable"
 msgstr ""
 
-#: search.c:583
+#: search.c:575
 #, c-format
 msgid "Only %d lines available, skipping to last line"
 msgstr ""
@@ -819,62 +819,62 @@ msgstr ""
 msgid "input '%c' (%d)\n"
 msgstr ""
 
-#: winio.c:435
+#: winio.c:434
 msgid "New Buffer"
 msgstr ""
 
-#: winio.c:438
+#: winio.c:437
 msgid "  File: ..."
 msgstr ""
 
-#: winio.c:446
+#: winio.c:445
 msgid "Modified"
 msgstr ""
 
-#: winio.c:898
+#: winio.c:897
 #, c-format
 msgid "Moved to (%d, %d) in edit buffer\n"
 msgstr ""
 
-#: winio.c:909
+#: winio.c:908
 #, c-format
 msgid "current->data = \"%s\"\n"
 msgstr ""
 
-#: winio.c:952
+#: winio.c:951
 #, c-format
 msgid "I got \"%s\"\n"
 msgstr ""
 
-#: winio.c:977
+#: winio.c:976
 msgid "Yes"
 msgstr ""
 
-#: winio.c:979
+#: winio.c:978
 msgid "All"
 msgstr ""
 
-#: winio.c:981
+#: winio.c:980
 msgid "No"
 msgstr ""
 
-#: winio.c:1118
+#: winio.c:1117
 #, c-format
 msgid "do_cursorpos: linepct = %f, bytepct = %f\n"
 msgstr ""
 
-#: winio.c:1122
+#: winio.c:1121
 msgid "line %d of %d (%.0f%%), character %d of %d (%.0f%%)"
 msgstr ""
 
-#: winio.c:1250
+#: winio.c:1249
 msgid "Dumping file buffer to stderr...\n"
 msgstr ""
 
-#: winio.c:1252
+#: winio.c:1251
 msgid "Dumping cutbuffer to stderr...\n"
 msgstr ""
 
-#: winio.c:1254
+#: winio.c:1253
 msgid "Dumping a buffer to stderr...\n"
 msgstr ""
diff --git a/search.c b/search.c
index 4c2fdce3..0d7faa4a 100644
--- a/search.c
+++ b/search.c
@@ -446,15 +446,7 @@ int do_replace(void)
 
     prevanswer = mallocstrcpy(prevanswer, answer);
 
-/*
-    if (strcmp(last_replace, "")) 	* There's a previous replace str *
-	i = statusq(replace_list_2, REPLACE_LIST_2_LEN, "",
-		    _("Replace with [%s]"), last_replace);
-    else
-	i = statusq(replace_list_2, REPLACE_LIST_2_LEN, "", _("Replace with"));
-*/
-
-	i = statusq(replace_list_2, REPLACE_LIST_2_LEN, last_replace, 
+    i = statusq(replace_list_2, REPLACE_LIST_2_LEN, last_replace, 
 			_("Replace with"));
 
     switch (i) {
diff --git a/winio.c b/winio.c
index 3a92bad0..69478c6c 100644
--- a/winio.c
+++ b/winio.c
@@ -258,7 +258,7 @@ int nanogetstr(char *buf, char *def, shortcut s[], int slen, int start_x)
     while ((kbinput = wgetch(bottomwin)) != 13) {
 	for (j = 0; j <= slen - 1; j++) {
 	    if (kbinput == s[j].val) {
-		strcpy(answer, "");
+		answer = mallocstrcpy(answer, "");
 		return s[j].val;
 	    }
 	}
@@ -405,7 +405,6 @@ int nanogetstr(char *buf, char *def, shortcut s[], int slen, int start_x)
 
     /* Now that the text is editable instead of bracketed, we have to 
        check for answer == def, instead of answer == "" */
-/*    if (!strcmp(answer, "")) */
     if (!strcmp(answer, def))
 	return -2;
     else
-- 
GitLab