diff options
author | Stan Lo <[email protected]> | 2023-12-05 16:03:01 +0000 |
---|---|---|
committer | git <[email protected]> | 2023-12-05 16:03:06 +0000 |
commit | ef387e67307504f41baf45a5b06a10eb82933788 (patch) | |
tree | 9f7fd2d3c07638846e017ac4c8fa786b64125ada /lib | |
parent | 94bf9f80377d32e9dd5123bdf487b55b5e06a851 (diff) |
[ruby/irb] Pager should be disabled when TERM=dumb
(https://github.com/ruby/irb/pull/800)
For apps/libs that test against IRB, it's recommended to set `TERM=dumb`
so they get minimum disruption from Reline's interactive-focus features.
Therefore, we should follow the convention to disable pager when `TERM=dumb`.
https://github.com/ruby/irb/commit/8a3002a39e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/irb/pager.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/irb/pager.rb b/lib/irb/pager.rb index a0db5e93b4..d503487865 100644 --- a/lib/irb/pager.rb +++ b/lib/irb/pager.rb @@ -18,7 +18,7 @@ module IRB end def page(retain_content: false) - if IRB.conf[:USE_PAGER] && STDIN.tty? && pager = setup_pager(retain_content: retain_content) + if should_page? && pager = setup_pager(retain_content: retain_content) begin pid = pager.pid yield pager @@ -40,6 +40,10 @@ module IRB private + def should_page? + IRB.conf[:USE_PAGER] && STDIN.tty? && ENV["TERM"] != "dumb" + end + def content_exceeds_screen_height?(content) screen_height, screen_width = begin Reline.get_screen_size |