From 17c4cb1e2af554029fa66eb55e2605202fad8dd6 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Sat, 3 Aug 2013 22:58:09 -0500 Subject: [PATCH] minor changes and cleanup. --- lib/widget.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/widget.js b/lib/widget.js index ac1c742..c5de25b 100644 --- a/lib/widget.js +++ b/lib/widget.js @@ -292,6 +292,8 @@ function Screen(options) { right: this.right = this.rright = 0, top: this.top = this.rtop = 0, bottom: this.bottom = this.rbottom = 0 + //get height() { return self.height; }, + //get width() { return self.width; } }; this.ileft = 0; @@ -684,8 +686,7 @@ Screen.prototype.deleteLine = function(n, y, top, bottom) { Screen.prototype.insertLineNC = function(n, y, top, bottom) { if (!this.tput || !this.tput.strings.change_scroll_region - || !this.tput.strings.delete_line - || !this.tput.strings.insert_line) return; + || !this.tput.strings.delete_line) return; this._buf += this.tput.csr(top, bottom); this._buf += this.tput.cup(top, 0); @@ -708,8 +709,7 @@ Screen.prototype.insertLineNC = function(n, y, top, bottom) { Screen.prototype.deleteLineNC = function(n, y, top, bottom) { if (!this.tput || !this.tput.strings.change_scroll_region - || !this.tput.strings.delete_line - || !this.tput.strings.insert_line) return; + || !this.tput.strings.delete_line) return; this._buf += this.tput.csr(top, bottom); this._buf += this.tput.cup(bottom, 0); @@ -1070,7 +1070,7 @@ Screen.prototype.draw = function(start, end) { ch = this.tput.acscr[ch]; } else { ch = this.tput.smacs() - + this.tput.acscr[ch] + + this.tput.acscr[ch]; acs = true; } } else if (acs) { @@ -1605,7 +1605,8 @@ Screen.prototype.readEditor = function(options, callback) { return fs.writeFile(file, options.value, callback); } - return writeFile(function() { + return writeFile(function(err) { + if (err) return callback(err); return self.exec(editor, args, opt, function(err, success) { if (err) return callback(err); return fs.readFile(file, 'utf8', function(err, data) { @@ -2358,12 +2359,11 @@ Element.prototype._getWidth = function(get) { width = parent.width - (this.position.right || 0) - left; if (this.screen.autoPadding) { if ((this.position.left != null || this.position.right == null) - && this.position.left !== 'center') { - width -= (this.position.left != null || this.position.right == null) - && this.position.left !== 'center' ? this.parent.ileft : 0; + && this.position.left !== 'center') { + width -= this.parent.ileft; } if (this.position.right != null) { - width -= this.position.right != null ? this.parent.iright : 0; + width -= this.parent.iright; } } }