From 25fe353187c8cf2bb9b6eecda6433ec619e25019 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sun, 9 Feb 2020 18:39:14 +0100 Subject: [PATCH] Readline command beginning-of-history visits the oldest search match Previously it would do the same as end-of-history --- src/reader.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/reader.cpp b/src/reader.cpp index b0fedc654..43a1e6246 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -395,8 +395,8 @@ class reader_history_search_t { /// Go to the beginning (earliest) of the search. void go_to_beginning() { - while (move_forwards()) - ; + if (matches_.empty()) return; + match_index_ = matches_.size() - 1; } /// Go to the end (most recent) of the search. @@ -1241,6 +1241,8 @@ static bool command_ends_history_search(readline_cmd_t c) { case readline_cmd_t::history_search_forward: case readline_cmd_t::history_token_search_backward: case readline_cmd_t::history_token_search_forward: + case readline_cmd_t::beginning_of_history: + case readline_cmd_t::end_of_history: case readline_cmd_t::repaint: case readline_cmd_t::force_repaint: return false;