aboutsummaryrefslogtreecommitdiffstats
path: root/lib/irb/input-method.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-04-23 21:55:29 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-04-23 21:55:29 +0900
commitf4f66bd11c65882b86e0acf4d58f15fb596f25cf (patch)
tree34e6e50d15802ad6d8aab4f0d9d747efcd7c149d /lib/irb/input-method.rb
parent89271d4a3733bc5e70e9c56b4bd12f277e699c42 (diff)
downloadruby-f4f66bd11c65882b86e0acf4d58f15fb596f25cf.tar.gz
Revert "IRB is improved with Reline and RDoc, take 2"
Accidentally merged when 89271d4a3733bc5e70e9c56b4bd12f277e699c42 "Adjusted indents".
Diffstat (limited to 'lib/irb/input-method.rb')
-rw-r--r--lib/irb/input-method.rb85
1 files changed, 0 insertions, 85 deletions
diff --git a/lib/irb/input-method.rb b/lib/irb/input-method.rb
index e29d282d2c..f491d5a760 100644
--- a/lib/irb/input-method.rb
+++ b/lib/irb/input-method.rb
@@ -11,8 +11,6 @@
#
require_relative 'src_encoding'
require_relative 'magic-file'
-require_relative "completion"
-require 'reline'
module IRB
STDIN_FILE_NAME = "(line)" # :nodoc:
@@ -142,12 +140,6 @@ module IRB
@stdin = IO.open(STDIN.to_i, :external_encoding => IRB.conf[:LC_MESSAGES].encoding, :internal_encoding => "-")
@stdout = IO.open(STDOUT.to_i, 'w', :external_encoding => IRB.conf[:LC_MESSAGES].encoding, :internal_encoding => "-")
-
- if Readline.respond_to?("basic_word_break_characters=")
- Readline.basic_word_break_characters = IRB::InputCompletor::BASIC_WORD_BREAK_CHARACTERS
- end
- Readline.completion_append_character = nil
- Readline.completion_proc = IRB::InputCompletor::CompletionProc
end
# Reads the next line from this input method.
@@ -194,84 +186,7 @@ module IRB
def encoding
@stdin.external_encoding
end
-
- if Readline.respond_to?("basic_word_break_characters=")
- Readline.basic_word_break_characters = IRB::InputCompletor::BASIC_WORD_BREAK_CHARACTERS
- end
- Readline.completion_append_character = nil
- Readline.completion_proc = IRB::InputCompletor::CompletionProc
end
rescue LoadError
end
-
- class ReidlineInputMethod < InputMethod
- include Reline
- # Creates a new input method object using Readline
- def initialize
- super
-
- @line_no = 0
- @line = []
- @eof = false
-
- @stdin = IO.open(STDIN.to_i, :external_encoding => IRB.conf[:LC_MESSAGES].encoding, :internal_encoding => "-")
- @stdout = IO.open(STDOUT.to_i, 'w', :external_encoding => IRB.conf[:LC_MESSAGES].encoding, :internal_encoding => "-")
-
- if Reline.respond_to?("basic_word_break_characters=")
- Reline.basic_word_break_characters = IRB::InputCompletor::BASIC_WORD_BREAK_CHARACTERS
- end
- Reline.completion_append_character = nil
- Reline.completion_proc = IRB::InputCompletor::CompletionProc
- Reline.dig_perfect_match_proc = IRB::InputCompletor::PerfectMatchedProc
- end
-
- def check_termination(&block)
- @check_termination_proc = block
- end
-
- # Reads the next line from this input method.
- #
- # See IO#gets for more information.
- def gets
- Reline.input = @stdin
- Reline.output = @stdout
- if l = readmultiline(@prompt, false, &@check_termination_proc)
- HISTORY.push(l) if !l.empty?
- @line[@line_no += 1] = l + "\n"
- else
- @eof = true
- l
- end
- end
-
- # Whether the end of this input method has been reached, returns +true+
- # if there is no more data to read.
- #
- # See IO#eof? for more information.
- def eof?
- @eof
- end
-
- # Whether this input method is still readable when there is no more data to
- # read.
- #
- # See IO#eof for more information.
- def readable_after_eof?
- true
- end
-
- # Returns the current line number for #io.
- #
- # #line counts the number of times #gets is called.
- #
- # See IO#lineno for more information.
- def line(line_no)
- @line[line_no]
- end
-
- # The external encoding for standard input.
- def encoding
- @stdin.external_encoding
- end
- end
end