HomePhabricator

Properly cache terminal width and dirty on SIGWINCH

Description

Properly cache terminal width and dirty on SIGWINCH

Summary:
See PHI110. Currently, the cache here is bad: if tput fails, we'll keep running tput over and over again, since null is not cached.

Instead:

  • Cache null.
  • Dirty the cache when we receivew SIGWINCH, which indicates the window/terminal metadata has changed.

Test Plan:

  • Ran scripts/test/progress_bar.php in wide and narrow windows, saw it fit to the window.
  • Resized the window while it was running, saw it (mostly) figure it out (it can leave some artifacts behind, but we can't do much about that).
  • Added some debugging "print" statements to make sure the cache was working, saw it only recalculate once and then after a resize.

Reviewers: amckinley, chad

Reviewed By: amckinley

Differential Revision: https://secure.phabricator.com/D18669

Details

Provenance
epriestleyAuthored on Oct 2 2017, 6:49 PM
epriestleyPushed on Oct 2 2017, 7:59 PM
Reviewer
amckinley
Differential Revision
D18669: Properly cache terminal width and dirty on SIGWINCH
Parents
rPHU20db87e17679: Fix an exception in the hyperlink remarkup rule for unparseable URIs
Branches
Unknown
Tags
Unknown
Build Status
Buildable 18608
Build 25065: Run Core Tests