diff --git a/lib/irb/input-method.rb b/lib/irb/input-method.rb index b0110dd09b..5f13971a43 100644 --- a/lib/irb/input-method.rb +++ b/lib/irb/input-method.rb @@ -296,8 +296,13 @@ module IRB end Reline.dig_perfect_match_proc = IRB::InputCompletor::PerfectMatchedProc Reline.autocompletion = IRB.conf[:USE_AUTOCOMPLETE] + if IRB.conf[:USE_AUTOCOMPLETE] - Reline.add_dialog_proc(:show_doc, SHOW_DOC_DIALOG, Reline::DEFAULT_DIALOG_CONTEXT) + begin + require 'rdoc' + Reline.add_dialog_proc(:show_doc, SHOW_DOC_DIALOG, Reline::DEFAULT_DIALOG_CONTEXT) + rescue LoadError + end end end @@ -321,11 +326,6 @@ module IRB [195, 164], # The "ä" that appears when Alt+d is pressed on xterm. [226, 136, 130] # The "∂" that appears when Alt+d in pressed on iTerm2. ] - begin - require 'rdoc' - rescue LoadError - return nil - end if just_cursor_moving and completion_journey_data.nil? return nil