From 392c23c9c586d1f99c08df87f1cd3306e1ca5cd3 Mon Sep 17 00:00:00 2001
From: Chris Allegretta <chrisa@asty.org>
Date: Fri, 18 Feb 2011 07:49:28 +0000
Subject: [PATCH]         * files.c (load_history): Set last_search to the last
 search value we loaded from history,           so do_research will succeed
 without needing to manually load the last seach in.  Fixes           bug
 reported by Matt "ML" at gmail.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4531 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 ChangeLog   | 3 +++
 src/files.c | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index f9a292c9..9653a93f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,9 @@
 	  location.  Several new functions to files.c: load_poshistory(), save_poshistory(), 
 	  check_poshistory(), update_poshistory(), and reworking of histfilename().  New FAQ entry
 	  4.15 discussing the change and offering an interoperability workaround.
+	* files.c (load_history): Set last_search to the last search value we loaded from history,
+	  so do_research will succeed without needing to manually load the last seach in.  Fixes
+	  bug reported by Matt "ML" at gmail.
 
 2011-02-12 Chris Allegretta <chrisa@asty.org>
 	* Initial libmagic implementation, adapted from Eitan Adler <eitanadlerlist@gmail.com>.
diff --git a/src/files.c b/src/files.c
index f1df487c..b1095987 100644
--- a/src/files.c
+++ b/src/files.c
@@ -2816,6 +2816,8 @@ void load_history(void)
 
 	    fclose(hist);
 	    free(line);
+	    if (search_history->prev != NULL)
+		last_search = mallocstrcpy(NULL, search_history->prev->data);
 	}
 	free(nanohist);
 	free(legacyhist);
-- 
GitLab