From 206b4e2a7eb6edf9f80b92f983f8d37a3d0d70ca Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sun, 11 Feb 2024 12:05:56 +0100 Subject: [PATCH] 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. --- src/prompt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/prompt.c b/src/prompt.c index 74b0a8f4..1db21701 100644 --- 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. */