summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2019-10-30 09:32:16 +0900
committeraycabta <aycabta@gmail.com>2019-11-21 02:44:35 +0900
commit91bf3b7a77e187794cc84549f330e5675fb5d367 (patch)
treea86f50f0d30cb321e35381750bf0466df691c34c /lib
parent9b52bacc62c3db13ea18fa5ea4d9b9a92b5fcb86 (diff)
Use singleline/multiline instead of readline/reidline
Diffstat (limited to 'lib')
-rw-r--r--lib/irb.rb18
-rw-r--r--lib/irb/context.rb65
-rw-r--r--lib/irb/init.rb18
-rw-r--r--lib/irb/lc/help-message12
-rw-r--r--lib/irb/lc/ja/help-message9
5 files changed, 66 insertions, 56 deletions
diff --git a/lib/irb.rb b/lib/irb.rb
index 2bf46aa227..ed91d29b91 100644
--- a/lib/irb.rb
+++ b/lib/irb.rb
@@ -45,8 +45,8 @@ require "irb/version"
# irb(main):006:1> end
# #=> nil
#
-# The Readline extension module can be used with irb. Use of Readline is
-# default if it's installed.
+# The singleline editor module or multiline editor module can be used with irb.
+# Use of multiline editor is default if it's installed.
#
# == Command line options
#
@@ -61,10 +61,10 @@ require "irb/version"
# -W[level=2] Same as `ruby -W`
# --inspect Use `inspect' for output (default except for bc mode)
# --noinspect Don't use inspect for output
-# --reidline Use Reidline extension module
-# --noreidline Don't use Reidline extension module
-# --readline Use Readline extension module
-# --noreadline Don't use Readline extension module
+# --multiline Use multiline editor module
+# --nomultiline Don't use multiline editor module
+# --singleline Use singleline editor module
+# --nosingleline Don't use singleline editor module
# --colorize Use colorization
# --nocolorize Don't use colorization
# --prompt prompt-mode
@@ -72,7 +72,7 @@ require "irb/version"
# Switch prompt mode. Pre-defined prompt modes are
# `default', `simple', `xmp' and `inf-ruby'
# --inf-ruby-mode Use prompt appropriate for inf-ruby-mode on emacs.
-# Suppresses --reidline and --readline.
+# Suppresses --multiline and --singleline.
# --simple-prompt Simple prompt mode
# --noprompt No prompt mode
# --tracer Display trace for each execution of commands.
@@ -100,8 +100,8 @@ require "irb/version"
# IRB.conf[:IRB_RC] = nil
# IRB.conf[:BACK_TRACE_LIMIT]=16
# IRB.conf[:USE_LOADER] = false
-# IRB.conf[:USE_REIDLINE] = nil
-# IRB.conf[:USE_READLINE] = nil
+# IRB.conf[:USE_MULTILINE] = nil
+# IRB.conf[:USE_SINGLELINE] = nil
# IRB.conf[:USE_COLORIZE] = true
# IRB.conf[:USE_TRACER] = false
# IRB.conf[:IGNORE_SIGINT] = true
diff --git a/lib/irb/context.rb b/lib/irb/context.rb
index a8344f08fb..f529787bae 100644
--- a/lib/irb/context.rb
+++ b/lib/irb/context.rb
@@ -39,8 +39,20 @@ module IRB
@rc = IRB.conf[:RC]
@load_modules = IRB.conf[:LOAD_MODULES]
- @use_readline = IRB.conf[:USE_READLINE]
- @use_reidline = IRB.conf[:USE_REIDLINE]
+ if IRB.conf.has_key?(:USE_SINGLELINE)
+ @use_singleline = IRB.conf[:USE_SINGLELINE]
+ elsif IRB.conf.has_key?(:USE_READLINE) # backward compatibility
+ @use_singleline = IRB.conf[:USE_READLINE]
+ else
+ @use_singleline = 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]
+ else
+ @use_multiline = nil
+ end
@use_colorize = IRB.conf[:USE_COLORIZE]
@verbose = IRB.conf[:VERBOSE]
@io = nil
@@ -67,9 +79,9 @@ module IRB
case input_method
when nil
@io = nil
- case use_reidline?
+ case use_multiline?
when nil
- if STDIN.tty? && IRB.conf[:PROMPT_MODE] != :INF_RUBY && !use_readline?
+ if STDIN.tty? && IRB.conf[:PROMPT_MODE] != :INF_RUBY && !use_singleline?
@io = ReidlineInputMethod.new
else
@io = nil
@@ -80,7 +92,7 @@ module IRB
@io = ReidlineInputMethod.new
end
unless @io
- case use_readline?
+ case use_singleline?
when nil
if (defined?(ReadlineInputMethod) && STDIN.tty? &&
IRB.conf[:PROMPT_MODE] != :INF_RUBY)
@@ -155,18 +167,14 @@ module IRB
# +input_method+ passed to Context.new
attr_accessor :irb_path
- # Whether +Reidline+ is enabled or not.
- #
- # A copy of the default <code>IRB.conf[:USE_REIDLINE]</code>
- #
- # See #use_reidline= for more information.
- attr_reader :use_reidline
- # Whether +Readline+ is enabled or not.
+ # Whether multiline editor mode is enabled or not.
#
- # A copy of the default <code>IRB.conf[:USE_READLINE]</code>
+ # A copy of the default <code>IRB.conf[:USE_MULTILINE]</code>
+ attr_reader :use_multiline
+ # Whether singleline editor mode is enabled or not.
#
- # See #use_readline= for more information.
- attr_reader :use_readline
+ # A copy of the default <code>IRB.conf[:USE_SINGLELINE]</code>
+ attr_reader :use_singleline
# Whether colorization is enabled or not.
#
# A copy of the default <code>IRB.conf[:USE_COLORIZE]</code>
@@ -258,10 +266,18 @@ module IRB
# See IRB@Command+line+options for more command line options.
attr_accessor :back_trace_limit
- # Alias for #use_reidline
- alias use_reidline? use_reidline
- # Alias for #use_readline
- alias use_readline? use_readline
+ # Alias for #use_multiline
+ alias use_multiline? use_multiline
+ # Alias for #use_singleline
+ alias use_singleline? use_singleline
+ # backward compatibility
+ alias use_reidline use_multiline
+ # backward compatibility
+ alias use_reidline? use_multiline
+ # backward compatibility
+ alias use_readline use_singleline
+ # backward compatibility
+ alias use_readline? use_singleline
# Alias for #use_colorize
alias use_colorize? use_colorize
# Alias for #rc
@@ -392,17 +408,6 @@ module IRB
@inspect_mode
end
- # Obsolete method.
- #
- # Can be set using the +--noreadline+ and +--readline+ command line
- # options.
- #
- # See IRB@Command+line+options for more command line options.
- def use_readline=(opt)
- print "This method is obsolete."
- print "Do nothing."
- end
-
def evaluate(line, line_no, exception: nil) # :nodoc:
@line_no = line_no
if exception
diff --git a/lib/irb/init.rb b/lib/irb/init.rb
index 00357468c9..11f3932be2 100644
--- a/lib/irb/init.rb
+++ b/lib/irb/init.rb
@@ -43,7 +43,7 @@ module IRB # :nodoc:
@CONF[:LOAD_MODULES] = []
@CONF[:IRB_RC] = nil
- @CONF[:USE_READLINE] = false unless defined?(ReadlineInputMethod)
+ @CONF[:USE_SINGLELINE] = false unless defined?(ReadlineInputMethod)
@CONF[:USE_COLORIZE] = true
@CONF[:INSPECT_MODE] = true
@CONF[:USE_TRACER] = false
@@ -161,14 +161,14 @@ module IRB # :nodoc:
end
when "--noinspect"
@CONF[:INSPECT_MODE] = false
- when "--readline"
- @CONF[:USE_READLINE] = true
- when "--noreadline"
- @CONF[:USE_READLINE] = false
- when "--reidline"
- @CONF[:USE_REIDLINE] = true
- when "--noreidline"
- @CONF[:USE_REIDLINE] = false
+ when "--singleline", "--readline"
+ @CONF[:USE_SINGLELINE] = true
+ when "--nosingleline", "--noreadline"
+ @CONF[:USE_SINGLELINE] = false
+ when "--multiline", "--reidline"
+ @CONF[:USE_MULTILINE] = true
+ when "--nomultiline", "--noreidline"
+ @CONF[:USE_MULTILINE] = false
when "--echo"
@CONF[:ECHO] = true
when "--noecho"
diff --git a/lib/irb/lc/help-message b/lib/irb/lc/help-message
index 57f099e005..a80facc9c5 100644
--- a/lib/irb/lc/help-message
+++ b/lib/irb/lc/help-message
@@ -22,17 +22,19 @@ Usage: irb.rb [options] [programfile] [arguments]
when new workspace was created
--echo Show result(default)
--noecho Don't show result
- --inspect Use `inspect' for output
- --noinspect Don't use inspect for output
- --readline Use Readline extension module
- --noreadline Don't use Readline extension module
+ --inspect Use `inspect' for output
+ --noinspect Don't use inspect for output
+ --multiline Use multiline editor module
+ --nomultiline Don't use multiline editor module
+ --singleline Use singleline editor module
+ --nosingleline Don't use singleline editor module
--colorize Use colorization
--nocolorize Don't use colorization
--prompt prompt-mode/--prompt-mode prompt-mode
Switch prompt mode. Pre-defined prompt modes are
`default', `simple', `xmp' and `inf-ruby'
--inf-ruby-mode Use prompt appropriate for inf-ruby-mode on emacs.
- Suppresses --readline.
+ Suppresses --multiline and --singleline.
--sample-book-mode/--simple-prompt
Simple prompt mode
--noprompt No prompt mode
diff --git a/lib/irb/lc/ja/help-message b/lib/irb/lc/ja/help-message
index 2bb7c2adee..9794a8e24e 100644
--- a/lib/irb/lc/ja/help-message
+++ b/lib/irb/lc/ja/help-message
@@ -23,8 +23,10 @@ Usage: irb.rb [options] [programfile] [arguments]
--noecho 実行結果を表示しない.
--inspect 結果出力にinspectを用いる.
--noinspect 結果出力にinspectを用いない.
- --readline readlineライブラリを利用する.
- --noreadline readlineライブラリを利用しない.
+ --multiline マルチラインエディタを利用する.
+ --nomultiline マルチラインエディタを利用しない.
+ --singleline シングルラインエディタを利用する.
+ --nosingleline シングルラインエディタを利用しない.
--colorize 色付けを利用する.
--nocolorize 色付けを利用しない.
--prompt prompt-mode/--prompt-mode prompt-mode
@@ -32,7 +34,8 @@ Usage: irb.rb [options] [programfile] [arguments]
ロンプトモードは, default, simple, xmp, inf-rubyが
用意されています.
--inf-ruby-mode emacsのinf-ruby-mode用のプロンプト表示を行なう. 特
- に指定がない限り, readlineライブラリは使わなくなる.
+ に指定がない限り, シングルラインエディタとマルチラ
+ インエディタは使わなくなる.
--sample-book-mode/--simple-prompt
非常にシンプルなプロンプトを用いるモードです.
--noprompt プロンプト表示を行なわない.