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

pager: fix printing non-visible characters \001 & \002 #2207

Open
wants to merge 1 commit 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 CHANGELOG.md
Expand Up @@ -4,6 +4,9 @@

* Fixed bug where reading from the `_out_` sticky local variable could return
wrong results ([#2201](https://github.com/pry/pry/pull/2201))
* Fixed bug where paged output can erroneously display non-visible control
characters (`\001` aka `^A` & `\002` aka `^B`)
([#2207](https://github.com/pry/pry/pull/2207))

### [v0.14.1][v0.14.1] (April 12, 2021)

Expand Down
8 changes: 5 additions & 3 deletions lib/pry/pager.rb
Expand Up @@ -8,6 +8,9 @@ class Pager
class StopPaging < StandardError
end

# @return [String] the 'less' executable and its options
LESS_PAGER = 'less --RAW-CONTROL-CHARS --raw-control-chars -F -X'

attr_reader :pry_instance

def initialize(pry_instance)
Expand Down Expand Up @@ -130,9 +133,8 @@ class SystemPager < NullPager
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/
# Default to less.
pager = LESS_PAGER if pager.strip.empty? || pager =~ /^less\b/

pager
end
Expand Down