From 8cb3f29abf9290838bdc3b9904868c78752427e8 Mon Sep 17 00:00:00 2001 From: aycabta Date: Sun, 1 Dec 2019 23:53:59 +0900 Subject: The ed_search_prev_history should always search to backward --- lib/reline/line_editor.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb index 71d765109d..8c0b858747 100644 --- a/lib/reline/line_editor.rb +++ b/lib/reline/line_editor.rb @@ -1175,7 +1175,12 @@ class Reline::LineEditor @history_pointer = nil hit = @line_backup_in_history else - hit_index = Reline::HISTORY.rindex { |item| + if @history_pointer + history = Reline::HISTORY[0..@history_pointer] + else + history = Reline::HISTORY + end + hit_index = history.rindex { |item| item.include?(search_word) } if hit_index -- cgit v1.2.3