Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add option to display less on alternate screen #2171

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/pry/config.rb
Expand Up @@ -67,6 +67,9 @@ class Config
# @return [Boolean]
attribute :pager

# @return [Boolean]
attribute :less_alt_screen

# @return [Boolean] whether the global ~/.pryrc should be loaded
attribute :should_load_rc

Expand Down
7 changes: 5 additions & 2 deletions lib/pry/pager.rb
Expand Up @@ -131,8 +131,11 @@ def self.default_pager
pager = Pry::Env['PAGER'] || ''

# Default to less, and make sure less is being passed the correct
# options
pager = "less -R -F -X" if pager.strip.empty? || pager =~ /^less\b/
# options. By default, -X is passed. Do not pass -X if
# `Pry.config.less_alt_screen` is set to true.
if pager.strip.empty? || pager =~ /^less\b/
pager = Pry.config.less_alt_screen ? "less -R -F" : "less -R -F -X"
end

pager
end
Expand Down