aboutsummaryrefslogtreecommitdiffstats
path: root/lib/irb/input-method.rb
diff options
context:
space:
mode:
authoraycabta <aycabta@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-04-20 08:51:20 +0000
committeraycabta <aycabta@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-04-20 08:51:20 +0000
commit7f273ac6d0f05208b5b228da95205e20c0e8286c (patch)
treebfec81d78d487c6d8015f26fd6a5740cfef63d31 /lib/irb/input-method.rb
parent91faab7f1477c65f71aee8324cdeca7b6f19434a (diff)
downloadruby-7f273ac6d0f05208b5b228da95205e20c0e8286c.tar.gz
IRB is improved with Reline and RDoc
Reline is a readline stdlib compatible library. It also supports multiline input. IRB is improved with Reline and supports multiline. Besides, supports showing documents when completed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/irb/input-method.rb')
-rw-r--r--lib/irb/input-method.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/irb/input-method.rb b/lib/irb/input-method.rb
index f491d5a760..1f4f1d4746 100644
--- a/lib/irb/input-method.rb
+++ b/lib/irb/input-method.rb
@@ -142,13 +142,17 @@ module IRB
@stdout = IO.open(STDOUT.to_i, 'w', :external_encoding => IRB.conf[:LC_MESSAGES].encoding, :internal_encoding => "-")
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
Readline.input = @stdin
Readline.output = @stdout
- if l = readline(@prompt, false)
+ if l = readmultiline(@prompt, false, &@check_termination_proc)
HISTORY.push(l) if !l.empty?
@line[@line_no += 1] = l + "\n"
else