aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2019-12-17 13:47:06 +0900
committeraycabta <aycabta@gmail.com>2019-12-17 13:59:19 +0900
commit4f9a4c1a8f6a31def5fdf58582f064cf644a5828 (patch)
tree66d8f3eac0ef7e23b77ffbbdbbf85042cc9b326f
parente36319249b1a9967a83e66df2661769c136594ad (diff)
downloadruby-4f9a4c1a8f6a31def5fdf58582f064cf644a5828.tar.gz
Remove unnecessary branches
-rw-r--r--lib/reline/line_editor.rb30
1 files changed, 6 insertions, 24 deletions
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb
index 7b67687400..57d463580e 100644
--- a/lib/reline/line_editor.rb
+++ b/lib/reline/line_editor.rb
@@ -1236,19 +1236,10 @@ class Reline::LineEditor
case prev_search_key
when "\C-r".ord
history_pointer_base = 0
- if change_direction
- history = Reline::HISTORY[0..@history_pointer]
- else
- history = Reline::HISTORY[0..(@history_pointer - 1)]
- end
+ history = Reline::HISTORY[0..(@history_pointer - 1)]
when "\C-s".ord
- if change_direction
- history_pointer_base = @history_pointer
- history = Reline::HISTORY[(@history_pointer)..-1]
- else
- history_pointer_base = @history_pointer + 1
- history = Reline::HISTORY[(@history_pointer + 1)..-1]
- end
+ history_pointer_base = @history_pointer + 1
+ history = Reline::HISTORY[(@history_pointer + 1)..-1]
end
else
history_pointer_base = 0
@@ -1258,19 +1249,10 @@ class Reline::LineEditor
case prev_search_key
when "\C-r".ord
history_pointer_base = 0
- if change_direction
- history = Reline::HISTORY[0..@history_pointer]
- else
- history = Reline::HISTORY[0..@history_pointer]
- end
+ history = Reline::HISTORY[0..@history_pointer]
when "\C-s".ord
- if change_direction
- history_pointer_base = @history_pointer
- history = Reline::HISTORY[(@history_pointer - 1)..-1]
- else
- history_pointer_base = @history_pointer
- history = Reline::HISTORY[@history_pointer..-1]
- end
+ history_pointer_base = @history_pointer
+ history = Reline::HISTORY[@history_pointer..-1]
end
else
history_pointer_base = 0