diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index be3efc936..8c02d3afb 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -13,7 +13,7 @@ irb(main):001:0> irb_info => Ruby version: 3.0.0 IRB version: irb 1.2.7 (2020-09-19) -InputMethod: ReidlineInputMethod with Reline 0.1.9 and /home/aycabta/.inputrc +InputMethod: RelineInputMethod with Reline 0.1.9 and /home/aycabta/.inputrc .irbrc path: /home/aycabta/.irbrc ``` diff --git a/lib/irb/context.rb b/lib/irb/context.rb index a3b7dda8c..b4c687ca4 100644 --- a/lib/irb/context.rb +++ b/lib/irb/context.rb @@ -22,7 +22,7 @@ class Context # # The optional +input_method+ argument: # - # +nil+:: uses stdin or Reidline or Readline + # +nil+:: uses stdin or Reline or Readline # +String+:: uses a File # +other+:: uses this as InputMethod def initialize(irb, workspace = nil, input_method = nil) @@ -48,8 +48,13 @@ def initialize(irb, workspace = nil, input_method = nil) end if IRB.conf.has_key?(:USE_MULTILINE) @use_multiline = IRB.conf[:USE_MULTILINE] - elsif IRB.conf.has_key?(:USE_REIDLINE) # backward compatibility - @use_multiline = IRB.conf[:USE_REIDLINE] + elsif IRB.conf.has_key?(:USE_RELINE) # backward compatibility + @use_multiline = IRB.conf[:USE_RELINE] + elsif IRB.conf.has_key?(:USE_REIDLINE) + warn <<~MSG.strip + USE_REIDLINE is deprecated, please use USE_RELINE instead. + MSG + @use_multiline = IRB.conf[:USE_RELINE] else @use_multiline = nil end @@ -83,14 +88,14 @@ def initialize(irb, workspace = nil, input_method = nil) when nil if STDIN.tty? && IRB.conf[:PROMPT_MODE] != :INF_RUBY && !use_singleline? # Both of multiline mode and singleline mode aren't specified. - @io = ReidlineInputMethod.new + @io = RelineInputMethod.new else @io = nil end when false @io = nil when true - @io = ReidlineInputMethod.new + @io = RelineInputMethod.new end unless @io case use_singleline? @@ -160,7 +165,7 @@ def main # The current input method. # # Can be either StdioInputMethod, ReadlineInputMethod, - # ReidlineInputMethod, FileInputMethod or other specified when the + # RelineInputMethod, FileInputMethod or other specified when the # context is created. See ::new for more # information on +input_method+. attr_accessor :io @@ -326,9 +331,9 @@ def main # Alias for #use_singleline alias use_singleline? use_singleline # backward compatibility - alias use_reidline use_multiline + alias use_reline use_multiline # backward compatibility - alias use_reidline? use_multiline + alias use_reline? use_multiline # backward compatibility alias use_readline use_singleline # backward compatibility @@ -346,7 +351,7 @@ def main # Returns whether messages are displayed or not. def verbose? if @verbose.nil? - if @io.kind_of?(ReidlineInputMethod) + if @io.kind_of?(RelineInputMethod) false elsif defined?(ReadlineInputMethod) && @io.kind_of?(ReadlineInputMethod) false @@ -361,11 +366,11 @@ def verbose? end # Whether #verbose? is +true+, and +input_method+ is either - # StdioInputMethod or ReidlineInputMethod or ReadlineInputMethod, see #io + # StdioInputMethod or RelineInputMethod or ReadlineInputMethod, see #io # for more information. def prompting? verbose? || (STDIN.tty? && @io.kind_of?(StdioInputMethod) || - @io.kind_of?(ReidlineInputMethod) || + @io.kind_of?(RelineInputMethod) || (defined?(ReadlineInputMethod) && @io.kind_of?(ReadlineInputMethod))) end diff --git a/lib/irb/input-method.rb b/lib/irb/input-method.rb index eec2daa54..aa5cb5adb 100644 --- a/lib/irb/input-method.rb +++ b/lib/irb/input-method.rb @@ -261,7 +261,7 @@ def inspect end end - class ReidlineInputMethod < InputMethod + class RelineInputMethod < InputMethod include Reline # Creates a new input method object using Reline @@ -470,4 +470,13 @@ def inspect str end end + + class ReidlineInputMethod < RelineInputMethod + def initialize + warn <<~MSG.strip + IRB::ReidlineInputMethod is deprecated, please use IRB::RelineInputMethod instead. + MSG + super + end + end end