aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/reline/line_editor.rb7
1 files changed, 6 insertions, 1 deletions
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