From 239c3d47ddae9f48325a20a0ae02aab19606d66a Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Tue, 19 Jul 2005 05:58:00 +0000 Subject: [PATCH] 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 --- ChangeLog | 8 +++++--- src/winio.c | 10 +++++----- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1fbba091..ccac3105 100644 --- a/ChangeLog +++ b/ChangeLog @@ -70,9 +70,11 @@ CVS code - do_cursorpos(). (DLR) - Change the NANO_WIDE #define to ENABLE_UTF8, as the latter is clearer. (DLR) - - Make sure that the current position in the history list is - properly set to the bottom if we cancel out of the prompt. - New function history_reset(); changes to nanogetstr(). (DLR) + - Minor history code fixes: Make sure that the current position + in the history list is properly set to the bottom if we cancel + out of the prompt, and that magichistory is properly updated + when we change it and then move up. New function + history_reset(); changes to nanogetstr(). (DLR) - chars.c: mbstrchr() - Don't count matches between valid and invalid multibyte diff --git a/src/winio.c b/src/winio.c index d9f9c574..a9c65835 100644 --- a/src/winio.c +++ b/src/winio.c @@ -2576,12 +2576,12 @@ int nanogetstr(bool allow_tabs, const char *buf, const char *curranswer, #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,