1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

Fix a couple of SimplePager bugs

* Exiting with q was broken by d703320e38.

* We were only removing color codes in the case where the input string
  ends with a newline, which means we were overestimating the length of
  strings that don't end with newlines. After fixing that, SimplePager
  can accurately page through the inspect output for _pry_.
This commit is contained in:
Ryan Fitzgerald 2013-11-02 15:46:38 -07:00
parent d703320e38
commit d0f198bd64
2 changed files with 4 additions and 2 deletions

View file

@ -32,7 +32,9 @@ class Pry
def pp(obj) def pp(obj)
super super
rescue rescue => e
raise if e.is_a? Pry::Pager::StopPaging
# Read the class name off of the singleton class to provide a default # Read the class name off of the singleton class to provide a default
# inspect. # inspect.
eig = class << obj; self; end eig = class << obj; self; end

View file

@ -181,7 +181,7 @@ class Pry::Pager
@row += ((@col + line_length(line) - 1) / @cols) + 1 @row += ((@col + line_length(line) - 1) / @cols) + 1
@col = 0 @col = 0
else else
@col += line.length @col += line_length(line)
end end
end end
end end