ruby-changes:74272
From: Shugo <ko1@a...>
Date: Thu, 27 Oct 2022 17:16:29 +0900 (JST)
Subject: [ruby-changes:74272] 5129ca3e05 (master): [ruby/rdoc] Delay `require "readline"` in case the terminal is in raw mode
https://git.ruby-lang.org/ruby.git/commit/?id=5129ca3e05 From 5129ca3e056e1ce3189ba39fa311d4d687b97b45 Mon Sep 17 00:00:00 2001 From: Shugo Maeda <shugo@r...> Date: Thu, 27 Oct 2022 10:29:02 +0900 Subject: [ruby/rdoc] Delay `require "readline"` in case the terminal is in raw mode --- lib/rdoc/ri/driver.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/rdoc/ri/driver.rb b/lib/rdoc/ri/driver.rb index d24f8d5eff..819cff8aa3 100644 --- a/lib/rdoc/ri/driver.rb +++ b/lib/rdoc/ri/driver.rb @@ -1,11 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/lib/rdoc/ri/driver.rb#L1 # frozen_string_literal: true require 'optparse' -begin - require 'readline' -rescue LoadError -end - require_relative '../../rdoc' require_relative 'formatter' # For RubyGems backwards compatibility @@ -1079,6 +1074,10 @@ or the PAGER environment variable. https://github.com/ruby/ruby/blob/trunk/lib/rdoc/ri/driver.rb#L1074 def interactive puts "\nEnter the method name you want to look up." + begin + require 'readline' + rescue LoadError + end if defined? Readline then Readline.completion_proc = method :complete puts "You can use tab to autocomplete." -- cgit v1.2.3 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/