[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
This commit is contained in:
parent
94bf9f8037
commit
ef387e6730
@ -18,7 +18,7 @@ module IRB
|
|||||||
end
|
end
|
||||||
|
|
||||||
def page(retain_content: false)
|
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
|
begin
|
||||||
pid = pager.pid
|
pid = pager.pid
|
||||||
yield pager
|
yield pager
|
||||||
@ -40,6 +40,10 @@ module IRB
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def should_page?
|
||||||
|
IRB.conf[:USE_PAGER] && STDIN.tty? && ENV["TERM"] != "dumb"
|
||||||
|
end
|
||||||
|
|
||||||
def content_exceeds_screen_height?(content)
|
def content_exceeds_screen_height?(content)
|
||||||
screen_height, screen_width = begin
|
screen_height, screen_width = begin
|
||||||
Reline.get_screen_size
|
Reline.get_screen_size
|
||||||
|
Loading…
x
Reference in New Issue
Block a user