Commit Graph

3 Commits

Author SHA1 Message Date
Kyrylo Silin 6e55df5a0f Use Pry::Env where it makes sense 2019-06-09 17:47:23 +03:00
Kyrylo Silin 67b0b53f0b Merge Pry::Terminal with Pry::Output
Fixes #1991 (Pry in a non-stdin/stdout PTY uses incorrect window size on
non-JRuby platforms)

`Pry::Terminal` was built without custom outputs in mind. We would always assume
that `$stdout` is what the user wants. This contradicted the `output` config
option.

Thanks to `Pry::Output`, which we use internally, we can decorate the output
that the user passes us with "size" methods. If we do that, we get improved
output support for free, so that PTY's `slave` can be passed to Pry and would be
able to determine its size correctly (example from #1991).

I do suspect that there are still some gotchas. Some commands or portions of
code may still be assuming that `$stdout` is the only possible option. This has
to be addressed separately, in the scope of
https://github.com/pry/pry/issues/1988. The more tests we add, the easier it
will be to uncover those spots.
2019-05-26 17:11:42 +03:00
Kyrylo Silin ef72f221b1 Add unit tests for Pry::Output 2019-05-26 14:18:53 +03:00