diff options
author | Stan Lo <[email protected]> | 2023-11-30 15:22:17 +0000 |
---|---|---|
committer | git <[email protected]> | 2023-11-30 15:22:22 +0000 |
commit | f193f96d31ffcd02d91f135ba765d92c23b52c55 (patch) | |
tree | 758eb77f0fc698b691dfa9275bdd3d48c12af3bf /lib/irb.rb | |
parent | cc393b4f80be7eccdc84785f684dc7899b0510e4 (diff) |
[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
Diffstat (limited to 'lib/irb.rb')
-rw-r--r-- | lib/irb.rb | 8 |
1 files changed, 5 insertions, 3 deletions
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 |