summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2019-12-02 03:05:10 +0900
committeraycabta <aycabta@gmail.com>2019-12-02 03:09:41 +0900
commite15b0313a78a6f381720cf362a1a94bda49f62ff (patch)
tree82160d2b24c0873d747cc8cde97fec15da2ac8dc /lib
parent4d7a6d04b2c71aabb9d6e619f4405887806a5be8 (diff)
downloadruby-e15b0313a78a6f381720cf362a1a94bda49f62ff.tar.gz
Search history to back in the middle of histories
Diffstat (limited to 'lib')
-rw-r--r--lib/reline/line_editor.rb12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb
index 8c0b858747..1286adb7a3 100644
--- a/lib/reline/line_editor.rb
+++ b/lib/reline/line_editor.rb
@@ -1145,10 +1145,12 @@ class Reline::LineEditor
alias_method :end_of_line, :ed_move_to_end
private def ed_search_prev_history(key)
- if @is_multiline
- @line_backup_in_history = whole_buffer
- else
- @line_backup_in_history = @line
+ unless @history_pointer
+ if @is_multiline
+ @line_backup_in_history = whole_buffer
+ else
+ @line_backup_in_history = @line
+ end
end
searcher = Fiber.new do
search_word = String.new(encoding: @encoding)
@@ -1171,7 +1173,7 @@ class Reline::LineEditor
end
end
hit = nil
- if @line_backup_in_history.include?(search_word)
+ if @line_backup_in_history&.include?(search_word)
@history_pointer = nil
hit = @line_backup_in_history
else