diff --git a/lib/irb.rb b/lib/irb.rb index 26432a0fa..9ba73eb93 100644 --- a/lib/irb.rb +++ b/lib/irb.rb @@ -850,6 +850,17 @@ def output_value(omit = false) # :nodoc: end end end + + screen_height, screen_width = Reline::IOGate.get_screen_size + # exclude the input line from calculation + output_exceeds_screen = (screen_height - 1) * screen_width < Reline::Unicode.calculate_width(str, true) + + if output_exceeds_screen + RDoc::RI::Driver.new.page do |io| + io.write(str) + end + end + if multiline_p && @context.newline_before_multiline_output? printf @context.return_format, "\n#{str}" else