in nanogetstr(), make sure that magichistory is properly updated when we
change it and then move up
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2897 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
diff --git a/src/winio.c b/src/winio.c
index d9f9c57..a9c6583 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -2576,12 +2576,12 @@
#ifndef NANO_SMALL
if (history_list != NULL) {
/* If we're scrolling up at the bottom of the
- * history list, answer isn't blank, and
- * magichistory isn't set, save answer in
- * magichistory. */
+ * history list and answer isn't blank, save answer
+ * in magichistory. */
if ((*history_list)->next == NULL &&
- answer[0] != '\0' && magichistory == NULL)
- magichistory = mallocstrcpy(NULL, answer);
+ answer[0] != '\0')
+ magichistory = mallocstrcpy(magichistory,
+ answer);
/* Get the older search from the history list and
* save it in answer. If there is no older search,