commit 3d6dcb956804d3e9e5ed12597596478180c35afb
parent 1ca2911b846eb56888114600edcdd00a9510bf05
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Sat, 9 Oct 2021 12:12:05 +0200
prompt: begin at bottom of history list when at secondary prompt
Whenever invoking a search prompt, calling up historical search items
should start with the newest item.
This fixes https://savannah.gnu.org/bugs/?61316.
Bug existed since version 2.8.2, since help texts became searchable.
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/prompt.c b/src/prompt.c
@@ -456,6 +456,9 @@ functionptrtype acquire_an_answer(int *actual, bool *listed,
size_t fragment_length = 0;
/* The length of the fragment that the user tries to tab complete. */
#endif
+
+ if (history_list != NULL)
+ history_reset(*history_list);
#endif /* ENABLE_HISTORIES */
if (typing_x > strlen(answer))
@@ -563,7 +566,7 @@ functionptrtype acquire_an_answer(int *actual, bool *listed,
}
#ifdef ENABLE_HISTORIES
- /* Set the current position in the history list to the bottom. */
+ /* Put the history pointer back at the bottom of the list. */
if (history_list != NULL) {
history_reset(*history_list);
free(magichistory);