Code cleanup (minor)

This commit is contained in:
Bryan Ashby 2016-07-16 13:06:03 -06:00
parent 485711b5da
commit 2bd548d284
1 changed files with 14 additions and 9 deletions

View File

@ -7,7 +7,6 @@ var strUtil = require('./string_util.js');
var ansi = require('./ansi_term.js');
var util = require('util');
var assert = require('assert');
var _ = require('lodash');
exports.TextView = TextView;
@ -52,6 +51,8 @@ function TextView(options) {
new Array(s.length + 1).join(this.textMaskChar) :
strUtil.stylizeString(s, this.hasFocus ? this.focusTextStyle : this.textStyle);
// :TODO: Add pipe code support
if(textToDraw.length > this.dimens.width) {
// XXXXXXXXXXXXXXXXX
// this is the text but too long
@ -117,6 +118,10 @@ TextView.prototype.getData = function() {
};
TextView.prototype.setText = function(text) {
if(!_.isString(text)) {
text = text.toString();
}
var widthDelta = 0;
if(this.text && this.text !== text) {
widthDelta = Math.abs(this.text.length - text.length);