From 131533274d9d8af42496c69160782970be074c63 Mon Sep 17 00:00:00 2001
From: Stan Lo <stan001212@gmail.com>
Date: Tue, 10 Dec 2024 21:11:18 +0000
Subject: [PATCH] Page the output in irb:rdbg sessions too

IRB started to page its evaluation output and it became a useful feature
for users. However, in `irb:rdbg` sessions, the output is not paged so
the sudden change in behavior is surprising and inconvenient.

This commit makes `irb:rdbg` sessions page the output of the debugger
too.
---
 lib/irb/debug/ui.rb | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/lib/irb/debug/ui.rb b/lib/irb/debug/ui.rb
index 7a1cd6dd1..a21ec6b11 100644
--- a/lib/irb/debug/ui.rb
+++ b/lib/irb/debug/ui.rb
@@ -45,9 +45,7 @@ def puts str = nil
             $stdout.puts line.chomp
           }
         when String
-          str.each_line{|line|
-            $stdout.puts line.chomp
-          }
+          Pager.page_content(str, retain_content: true)
         when nil
           $stdout.puts
         end