From f193f96d31ffcd02d91f135ba765d92c23b52c55 Mon Sep 17 00:00:00 2001 From: Stan Lo Date: Thu, 30 Nov 2023 15:22:17 +0000 Subject: [ruby/irb] Page evaluation result's output (https://github.com/ruby/irb/pull/784) * Page evaluation result's output This will make it easier to work with long output that exceeds the terminal's height. * Use consistent TERM in rendering tests This makes sure we get consistent result on all platforms. https://github.com/ruby/irb/commit/4fedce93d3 --- lib/irb.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lib/irb.rb') diff --git a/lib/irb.rb b/lib/irb.rb index 66149eb455..1ba335c087 100644 --- a/lib/irb.rb +++ b/lib/irb.rb @@ -20,6 +20,7 @@ require_relative "irb/color" require_relative "irb/version" require_relative "irb/easter-egg" require_relative "irb/debug" +require_relative "irb/pager" # IRB stands for "interactive Ruby" and is a tool to interactively execute Ruby # expressions read from the standard input. @@ -859,11 +860,12 @@ module IRB end end end + if multiline_p && @context.newline_before_multiline_output? - printf @context.return_format, "\n#{str}" - else - printf @context.return_format, str + str = "\n" + str end + + Pager.page_content(format(@context.return_format, str), retain_content: true) end # Outputs the local variables to this current session, including -- cgit v1.2.3