contains invalid multibyte characters interpreted as normal
characters. Changes to mbstrncasecmp(), mbstrcasestr(),
mbrevstrcasestr(), findnextstr(), and do_replace_loop(). (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)
- files.c:
open_file()
- Assert that filename isn't NULL, and don't do anything special
bool history_has_changed(void);
#endif
void history_init(void);
+void history_reset(const filestruct *h);
filestruct *find_history(filestruct *h_start, filestruct *h_end, const
char *s, size_t len);
void update_history(filestruct **h, const char *s);
replacebot = replace_history;
}
+/* Set the current position in the history list h to the bottom. */
+void history_reset(const filestruct *h)
+{
+ if (h == search_history)
+ search_history = searchbot;
+ else if (h == replace_history)
+ replace_history = replacebot;
+}
+
/* Return the first node containing the first len characters of the
* string s in the history list, starting at h_start and ending at
* h_end, or NULL if there isn't one. */
}
#ifndef NANO_SMALL
- /* Free magichistory if we need to. */
- if (magichistory != NULL)
- free(magichistory);
+ /* Set the current position in the history list to the bottom and
+ * free magichistory, if we need to. */
+ if (history_list != NULL) {
+ history_reset(*history_list);
+
+ if (magichistory != NULL)
+ free(magichistory);
+ }
#endif
/* We finished putting in an answer or ran a normal shortcut's