commit 206b4e2a7eb6edf9f80b92f983f8d37a3d0d70ca
parent 8fefee2d41b4cce49a791895327aaa8cea7c2c5d
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Sun, 11 Feb 2024 12:05:56 +0100
search: avoid a crash after a nested search, reported by `correctmost`
When going back to a previous prompt, restore the typing position
also for 'to_first_line' (^Y) and 'to_last_line (^V).
This fixes https://savannah.gnu.org/bugs/?65278.
Bug existed since version 5.9, commit 6d5b1656, which allowed exiting
from a Search-in-help prompt with ^Y or ^V.
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/prompt.c b/src/prompt.c
@@ -603,7 +603,8 @@ int do_prompt(int menu, const char *provided, linestruct **history_list,
/* Restore a possible previous prompt and maybe the typing position. */
prompt = saved_prompt;
- if (function == do_cancel || function == do_enter)
+ if (function == do_cancel || function == do_enter ||
+ function == to_first_line || function == to_last_line)
typing_x = was_typing_x;
/* Set the proper return value for Cancel and Enter. */