pry/pry — pull request #997 by rf- (2013-11-02 21:38:54+00:00)
Title: WIP: Improvements to pagers and inspect

The original motivation here was to come up with a more robust fix for our output-highlighting issues, but I realized it would be pretty easy to also get streaming inspect output as a bonus.

User-facing changes:
* Inspect output has much more accurate syntax highlighting
* Inspect output starts rendering immediately instead of having to wait for the whole thing to finish
* `SimplePager` has a somewhat more accurate concept of how long a page is
* `SystemPager` has a somewhat more accurate concept of how much output is needed before it's worth invoking an external pager

Dev-facing changes:
* `SimplePager` and `SystemPager` now act like `IO`s, with `Pager.page` as a compatibility layer for cases when we just want to print a string. Commands can use `Pager.best_available` to get a pager instance and then write streaming output into that object.

TODO:
* [ ] `(1..100000).to_a` starts printing immediately, but it doesn't stop blocking Pry when the user quits the pager
* [ ] `SimplePager` should probably be using the Pry instance's input and output instead of reaching for `$stdin` and `$stdout`
* [ ] Restore some edge-case handling that got removed
* [ ] Figure out why `SimplePager` still isn't calculating page sizes very accurately when there's a lot of ANSI