diff --git a/CHANGELOG.md b/CHANGELOG.md index 65ec4029b..9644ec382 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/lib/pry/pager.rb b/lib/pry/pager.rb index e6e408984..fba881bc0 100644 --- a/lib/pry/pager.rb +++ b/lib/pry/pager.rb @@ -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) @@ -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