diff options
author | aycabta <aycabta@gmail.com> | 2019-06-01 15:07:22 +0900 |
---|---|---|
committer | aycabta <aycabta@gmail.com> | 2019-06-01 15:07:52 +0900 |
commit | 34727475d0a255f4c9f3c66201ac7bcbb516256d (patch) | |
tree | 79b3eb83f1f37f15b35c55f032e5b85b863968ce /lib | |
parent | 3034d666e8015caa05c55a46debd5ed1ff502d47 (diff) | |
download | ruby-34727475d0a255f4c9f3c66201ac7bcbb516256d.tar.gz |
Remove an unnecessary argument
Diffstat (limited to 'lib')
-rw-r--r-- | lib/reline/line_editor.rb | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb index acdc9a2f9c..6abef1a8d8 100644 --- a/lib/reline/line_editor.rb +++ b/lib/reline/line_editor.rb @@ -641,7 +641,12 @@ class Reline::LineEditor end end - private def process_key(key, method_symbol, method_obj) + private def process_key(key, method_symbol) + if method_symbol and respond_to?(method_symbol, true) + method_obj = method(method_symbol) + else + method_obj = nil + end if @vi_arg if key.chr =~ /[0-9]/ ed_argument_digit(key) @@ -682,7 +687,7 @@ class Reline::LineEditor @multibyte_buffer << key.combined_char if @multibyte_buffer.size > 1 if @multibyte_buffer.dup.force_encoding(@encoding).valid_encoding? - process_key(@multibyte_buffer.dup.force_encoding(@encoding), nil, nil) + process_key(@multibyte_buffer.dup.force_encoding(@encoding), nil) @multibyte_buffer.clear else # invalid @@ -694,20 +699,11 @@ class Reline::LineEditor if key.with_meta and method_symbol == :ed_unassigned # split ESC + key method_symbol = @config.editing_mode.get_method("\e".ord) - if method_symbol and respond_to?(method_symbol, true) - method_obj = method(method_symbol) - end - process_key("\e".ord, method_symbol, method_obj) + process_key("\e".ord, method_symbol) method_symbol = @config.editing_mode.get_method(key.char) - if method_symbol and respond_to?(method_symbol, true) - method_obj = method(method_symbol) - end - process_key(key.char, method_symbol, method_obj) + process_key(key.char, method_symbol) else - if method_symbol and respond_to?(method_symbol, true) - method_obj = method(method_symbol) - end - process_key(key.combined_char, method_symbol, method_obj) + process_key(key.combined_char, method_symbol) end @multibyte_buffer.clear end @@ -747,7 +743,7 @@ class Reline::LineEditor move_completed_list(result, "\C-p".ord == key.char ? :up : :down) end elsif Symbol === key.char and respond_to?(key.char, true) - process_key(key.char, key.char, method(key.char)) + process_key(key.char, key.char) else normal_char(key) end |