[ruby/irb] Fix display_document params in noautocomplete mode
(https://github.com/ruby/irb/pull/826) * Fix display_document params in noautocomplete mode * Fix wrong preposing and target order in display_document The fixed wrong-ordered value is not used in RegexpCompletor, so this change does not affect the test. https://github.com/ruby/irb/commit/08208adb5e
This commit is contained in:
parent
c149cd3db4
commit
c0e3c3b6fe
@ -291,11 +291,13 @@ module IRB
|
||||
@auto_indent_proc = block
|
||||
end
|
||||
|
||||
def retrieve_doc_namespace(matched)
|
||||
preposing, _target, postposing, bind = @completion_params
|
||||
@completor.doc_namespace(preposing, matched, postposing, bind: bind)
|
||||
end
|
||||
|
||||
def show_doc_dialog_proc
|
||||
doc_namespace = ->(matched) {
|
||||
preposing, _target, postposing, bind = @completion_params
|
||||
@completor.doc_namespace(preposing, matched, postposing, bind: bind)
|
||||
}
|
||||
input_method = self # self is changed in the lambda below.
|
||||
->() {
|
||||
dialog.trap_key = nil
|
||||
alt_d = [
|
||||
@ -311,7 +313,7 @@ module IRB
|
||||
cursor_pos_to_render, result, pointer, autocomplete_dialog = context.pop(4)
|
||||
return nil if result.nil? or pointer.nil? or pointer < 0
|
||||
|
||||
name = doc_namespace.call(result[pointer])
|
||||
name = input_method.retrieve_doc_namespace(result[pointer])
|
||||
# Use first one because document dialog does not support multiple namespaces.
|
||||
name = name.first if name.is_a?(Array)
|
||||
|
||||
@ -419,8 +421,7 @@ module IRB
|
||||
return
|
||||
end
|
||||
|
||||
_target, preposing, postposing, bind = @completion_params
|
||||
namespace = @completor.doc_namespace(preposing, matched, postposing, bind: bind)
|
||||
namespace = retrieve_doc_namespace(matched)
|
||||
return unless namespace
|
||||
|
||||
driver ||= RDoc::RI::Driver.new
|
||||
|
@ -90,7 +90,7 @@ module TestIRB
|
||||
|
||||
def display_document(target, bind)
|
||||
input_method = IRB::RelineInputMethod.new(IRB::RegexpCompletor.new)
|
||||
input_method.instance_variable_set(:@completion_params, [target, '', '', bind])
|
||||
input_method.instance_variable_set(:@completion_params, ['', target, '', bind])
|
||||
input_method.display_document(target, driver: @driver)
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user