JuliaLang/julia — pull request #7297 by simonster (2014-06-17 23:36:19+00:00)
Title: RFC: Fix #7295, #4513

Replaces `tty_rows()`/`tty_cols()` with `tty_size()`, which (through Terminals) calls `uv_tty_get_winsize()` to get the terminal size.

The reason for the change is that `uv_tty_get_winsize()` gives both the rows and columns, so if we wanted to keep `tty_rows()`/`tty_cols()`, we'd have to call `uv_tty_get_winsize()` once for each, even though they are nearly always used together. AFAIK none of the methods whose signatures I've changed were ever exported, but this could still break some packages.

I am assuming that calling `uv_tty_get_winsize()` is not expensive enough that it's worth registering a SIGWINCH handler and only updating the numbers on window resize, as readline used to do. My Linux system can do >10^6 calls to `tty_size()` per second, which seems plenty fast to me. Given how cheap the call is, it may not even be worth replacing `tty_rows()`/`tty_cols()`. Of course other platforms may be different.