diff options
author | Rebecca Turner <me@re-becca.org> | 2015-07-17 12:35:59 +0300 |
---|---|---|
committer | Rebecca Turner <me@re-becca.org> | 2015-07-17 12:43:36 +0300 |
commit | 5656baaf14dd88624d7608a2b804bd1410890815 (patch) | |
tree | 55ecb8c548a6c25805d40535d84b06588010e361 /node_modules | |
parent | fa2c408f0d392a807ea97d399770d925c250bee2 (diff) |
gauge@1.2.2
This improves the progress bar display by doing our best to clean up if
someone changes the terminal size on us while we're updating things.
It's not perfect (it can't be perfect) but it's as good as we'll get
right now.
Improves: https://github.com/npm/npm/issues/8812
Diffstat (limited to 'node_modules')
-rw-r--r-- | node_modules/gauge/README.md | 5 | ||||
-rw-r--r-- | node_modules/gauge/package.json | 13 | ||||
-rw-r--r-- | node_modules/gauge/progress-bar.js | 15 |
3 files changed, 26 insertions, 7 deletions
diff --git a/node_modules/gauge/README.md b/node_modules/gauge/README.md index f996299da..ca0a8cd77 100644 --- a/node_modules/gauge/README.md +++ b/node_modules/gauge/README.md @@ -30,6 +30,11 @@ gauge.hide() Constructs a new gauge. Gauges are drawn on a single line, and are not drawn if the current terminal isn't a tty. +If you resize your terminal in a way that can be detected then the gauge +will be drawn at the new size. As a general rule, growing your terminal will +be clean, but shrinking your terminal will result in cruft as we don't have +enough information to know where what we wrote previously is now located. + The **options** object can have the following properties, all of which are optional: diff --git a/node_modules/gauge/package.json b/node_modules/gauge/package.json index 58a46abdb..a7777aa17 100644 --- a/node_modules/gauge/package.json +++ b/node_modules/gauge/package.json @@ -6,7 +6,7 @@ ] ], "_from": "gauge@*", - "_id": "gauge@1.2.1", + "_id": "gauge@1.2.2", "_inCache": true, "_location": "/gauge", "_nodeVersion": "0.10.38", @@ -25,10 +25,9 @@ "type": "range" }, "_requiredBy": [ - "#USER", "/npmlog" ], - "_shasum": "923d55c9c6669ff9ce37528b50b40acadb15f63c", + "_shasum": "05b6730a19a8fcad3c340a142f0945222a3f815b", "_shrinkwrap": null, "_spec": "gauge", "_where": "/Users/rebecca/code/npm", @@ -52,10 +51,10 @@ }, "directories": {}, "dist": { - "shasum": "923d55c9c6669ff9ce37528b50b40acadb15f63c", - "tarball": "http://registry.npmjs.org/gauge/-/gauge-1.2.1.tgz" + "shasum": "05b6730a19a8fcad3c340a142f0945222a3f815b", + "tarball": "http://registry.npmjs.org/gauge/-/gauge-1.2.2.tgz" }, - "gitHead": "3034dd52a902e54c8132830c0482c3c53e9ad94c", + "gitHead": "9f7eeeeed3b74a70f30b721d570435f6ffbc0168", "homepage": "https://github.com/iarna/gauge", "keywords": [ "gauge", @@ -79,5 +78,5 @@ "scripts": { "test": "tap test/*.js" }, - "version": "1.2.1" + "version": "1.2.2" } diff --git a/node_modules/gauge/progress-bar.js b/node_modules/gauge/progress-bar.js index 67f4100a8..16bdadc51 100644 --- a/node_modules/gauge/progress-bar.js +++ b/node_modules/gauge/progress-bar.js @@ -41,6 +41,13 @@ var ProgressBar = module.exports = function (options, cursor) { this.lastCompleted = 0 this.spun = 0 this.last = new Date(0) + + var self = this + this._handleSizeChange = function () { + if (!self.showing) return + self.hide() + self.show() + } } ProgressBar.prototype = {} @@ -70,6 +77,14 @@ ProgressBar.prototype.setTemplate = function(template) { this.template = template } +ProgressBar.prototype._enableResizeEvents = function() { + process.stdout.on('resize', this._handleSizeChange) +} + +ProgressBar.prototype._disableResizeEvents = function() { + process.stdout.removeListener('resize', this._handleSizeChange) +} + ProgressBar.prototype.disable = function() { this.hide() this.disabled = true |