Skip to content

Commit

Permalink
Pager should be disabled when TERM=dumb (#800)
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
st0012 authored Dec 5, 2023
1 parent 4acc9b8 commit 8a3002a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/irb/pager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def page_content(content, **options)
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
Expand All @@ -40,6 +40,10 @@ def page(retain_content: false)

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
Expand Down

0 comments on commit 8a3002a

Please sign in to comment.