summaryrefslogtreecommitdiff
path: root/lib/irb.rb
diff options
context:
space:
mode:
authorKenta Murata <mrkn@mrkn.jp>2020-01-16 13:13:35 +0900
committeraycabta <aycabta@gmail.com>2020-01-21 09:51:16 +0900
commit51a8055d7db8a6ae35a9f624700c0910ec20aeb8 (patch)
tree0d718d09fa2668497e8735666b5c67f188472c28 /lib/irb.rb
parentf451bb5406878e1ac9ce9d37952f171837d0cb09 (diff)
[ruby/irb] Add newline_before_multiline_output
https://github.com/ruby/irb/commit/9eb1801a66
Diffstat (limited to 'lib/irb.rb')
-rw-r--r--lib/irb.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/irb.rb b/lib/irb.rb
index bcd6599af..3e08877 100644
--- a/lib/irb.rb
+++ b/lib/irb.rb
@@ -736,7 +736,13 @@ module IRB
end
def output_value # :nodoc:
- printf @context.return_format, @context.inspect_last_value
+ str = @context.inspect_last_value
+ multiline_p = str.each_line.take(2).length > 1
+ if multiline_p && @context.newline_before_multiline_output?
+ printf @context.return_format, "\n#{str}"
+ else
+ printf @context.return_format, str
+ end
end
# Outputs the local variables to this current session, including