Method: IRB::RelineInputMethod#initialize
- Defined in:
- lib/irb/input-method.rb
#initialize(completor) ⇒ RelineInputMethod
Creates a new input method object using Reline
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 |
# File 'lib/irb/input-method.rb', line 254 def initialize(completor) IRB.__send__(:set_encoding, Reline.encoding_system_needs.name, override: false) super() @eof = false @completor = completor Reline.basic_word_break_characters = BASIC_WORD_BREAK_CHARACTERS Reline.completion_append_character = nil Reline.completer_quote_characters = '' Reline.completion_proc = ->(target, preposing, postposing) { bind = IRB.conf[:MAIN_CONTEXT].workspace.binding @completion_params = [preposing, target, postposing, bind] @completor.completion_candidates(preposing, target, postposing, bind: bind) } Reline.output_modifier_proc = proc do |input, complete:| IRB.CurrentContext.colorize_input(input, complete: complete) end Reline.dig_perfect_match_proc = ->(matched) { display_document(matched) } Reline.autocompletion = IRB.conf[:USE_AUTOCOMPLETE] if IRB.conf[:USE_AUTOCOMPLETE] begin require 'rdoc' Reline.add_dialog_proc(:show_doc, show_doc_dialog_proc, Reline::DEFAULT_DIALOG_CONTEXT) rescue LoadError end end end |