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)
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
# inspect.
eig = class << obj; self; end

View File

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