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.
master
Benno Schulenberg 2021-10-09 12:12:05 +02:00
parent 1ca2911b84
commit 3d6dcb9568
1 changed files with 4 additions and 1 deletions

View File

@ -456,6 +456,9 @@ functionptrtype acquire_an_answer(int *actual, bool *listed,
size_t fragment_length = 0; size_t fragment_length = 0;
/* The length of the fragment that the user tries to tab complete. */ /* The length of the fragment that the user tries to tab complete. */
#endif #endif
if (history_list != NULL)
history_reset(*history_list);
#endif /* ENABLE_HISTORIES */ #endif /* ENABLE_HISTORIES */
if (typing_x > strlen(answer)) if (typing_x > strlen(answer))
@ -563,7 +566,7 @@ functionptrtype acquire_an_answer(int *actual, bool *listed,
} }
#ifdef ENABLE_HISTORIES #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) { if (history_list != NULL) {
history_reset(*history_list); history_reset(*history_list);
free(magichistory); free(magichistory);