From 383b3b449ddfb746aa5812abfdd90b859ac2762a Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Wed, 10 Aug 2016 23:35:17 -0600 Subject: [PATCH] * Fix key press event for EditTextView * Fix MCI draw issue for TextView * Missing bbs.js MCI init --- core/bbs.js | 5 ++++- core/edit_text_view.js | 4 ++-- core/text_view.js | 23 +++++++++++++---------- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/core/bbs.js b/core/bbs.js index 48260db3..0214a9e4 100644 --- a/core/bbs.js +++ b/core/bbs.js @@ -159,7 +159,7 @@ function initialize(cb) { callback(err); }); }, - function loadSysOpInformation2(callback) { + function loadSysOpInformation(callback) { // // Copy over some +op information from the user DB -> system propertys. // * Makes this accessible for MCI codes, easy non-blocking access, etc. @@ -202,6 +202,9 @@ function initialize(cb) { } ); }, + function initMCI(callback) { + require('./predefined_mci.js').init(callback); + }, function readyMessageNetworkSupport(callback) { require('./msg_network.js').startup(callback); }, diff --git a/core/edit_text_view.js b/core/edit_text_view.js index e2a1517f..8e55ae53 100644 --- a/core/edit_text_view.js +++ b/core/edit_text_view.js @@ -45,13 +45,13 @@ EditTextView.prototype.onKeyPress = function(ch, key) { } } - return; + return EditTextView.super_.prototype.onKeyPress.call(this, ch, key); } else if(this.isKeyMapped('clearLine', key.name)) { this.text = ''; this.cursorPos.col = 0; this.setFocus(true); // resetting focus will redraw & adjust cursor - return; + return EditTextView.super_.prototype.onKeyPress.call(this, ch, key); } } diff --git a/core/text_view.js b/core/text_view.js index ee00af9a..50bd3f85 100644 --- a/core/text_view.js +++ b/core/text_view.js @@ -119,14 +119,17 @@ function TextView(options) { } } - this.client.term.write(padStr( - textToDraw, - this.dimens.width + 1, - this.fillChar, - this.justify, - this.hasFocus ? this.getFocusSGR() : this.getSGR(), - this.getStyleSGR(1) || this.getSGR() - ), false); + this.client.term.write( + padStr( + textToDraw, + this.dimens.width + 1, + this.fillChar, + this.justify, + this.hasFocus ? this.getFocusSGR() : this.getSGR(), + this.getStyleSGR(1) || this.getSGR() + ), + false // no converting CRLF needed + ); }; @@ -184,7 +187,7 @@ TextView.prototype.setText = function(text, redraw) { var widthDelta = 0; if(this.text && this.text !== text) { - widthDelta = Math.abs(this.text.length - text.length); + widthDelta = Math.abs(renderStringLength(this.text) - renderStringLength(text)); } this.text = text; @@ -198,7 +201,7 @@ TextView.prototype.setText = function(text, redraw) { this.text = stylizeString(this.text, this.hasFocus ? this.focusTextStyle : this.textStyle); if(this.autoScale.width) { - this.dimens.width = this.text.length + widthDelta; + this.dimens.width = renderStringLength(this.text) + widthDelta; } if(redraw) {