* Fix crash with JuiceSSH

* Lots of WIP on FSE
* Various notes & fixes
This commit is contained in:
Bryan Ashby
2015-07-11 16:39:42 -06:00
parent 2391ce6bc9
commit aab07bb330
10 changed files with 136 additions and 39 deletions

View File

@@ -67,6 +67,7 @@ function ClientTerminal(output) {
// XTERM
// * PuTTY
// LINUX
// * JuiceSSH - also via TERM=
// QNX
// SCREEN
// * ConnectBot
@@ -134,6 +135,9 @@ ClientTerminal.prototype.write = function(s, convertLineFeeds) {
this.output.write(this.iconv.encode(s, this.outputEncoding));
};
*/
// :TODO: probably need to update these to convert IAC (0xff) -> IACIAC (escape it)
ClientTerminal.prototype.write = function(s, convertLineFeeds) {
this.output.write(this.encode(s, convertLineFeeds));
};

View File

@@ -10,7 +10,6 @@ var SpinnerMenuView = require('./spinner_menu_view.js').SpinnerMenuView;
var ToggleMenuView = require('./toggle_menu_view.js').ToggleMenuView;
var MaskEditTextView = require('./mask_edit_text_view.js').MaskEditTextView;
var StatusBarView = require('./status_bar_view.js').StatusBarView;
var MultiLineEditTextView = require('./multi_line_edit_text_view.js').MultiLineEditTextView;
var Config = require('./config.js').config;
@@ -210,7 +209,7 @@ MCIViewFactory.prototype.createFromMCI = function(mci) {
default :
options.text = this.getPredefinedViewLabel(mci.code);
if(options.text) {
if(_.isString(options.text)) {
view = new TextView(options);
}
break;

6
core/message.js Normal file
View File

@@ -0,0 +1,6 @@
/* jslint node: true */
'use strict';
function Message(options) {
}

View File

@@ -100,12 +100,13 @@ function MultiLineEditTextView(options) {
// * http://www.bbsdocumentary.com/library/PROGRAMS/GRAPHICS/ANSI/bansi.txt
//
// This seems overkill though, so let's default to 4 :)
// :TODO: what shoudl this really be? Maybe 8 is OK
//
this.tabWidth = _.isNumber(options.tabWidth) ? options.tabWidth : 4;
this.tabWidth = _.isNumber(options.tabWidth) ? options.tabWidth : 4;
this.textLines = [];
this.topVisibleIndex = 0;
this.mode = options.mode || 'edit'; // edit | preview
this.mode = options.mode || 'edit'; // edit | preview | read-only
//
// cursorPos represents zero-based row, col positions
@@ -1052,7 +1053,7 @@ MultiLineEditTextView.prototype.setText = function(text) {
//this.textLines = [ { text : '' } ];
//this.insertRawText('');
//text = "Tab:\r\n\tA\tB\tC\tD\tE\tF\tG\r\n reeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeally long word!!!";
text = require('fs').readFileSync('/home/bashby/Downloads/test_text.txt', { encoding : 'utf-8'});
text = require('fs').readFileSync('/home/nuskooler/Downloads/test_text.txt', { encoding : 'utf-8'});
this.insertRawText(text);//, 0, 0);
this.cursorEndOfDocument();

View File

@@ -598,7 +598,9 @@ TelnetClient.prototype.handleSbCommand = function(evt) {
Log.debug({ termHeight : self.term.termHeight, source : 'NEW-ENVIRON'}, 'Window height updated');
} else {
if(name in self.term.env) {
assert(evt.type === SB_COMMANDS.INFO);
assert(
SB_COMMANDS.INFO === evt.type || SB_COMMANDS.IS === evt.type,
'Unexpected type: ' + evt.type);
Log.warn(
{ varName : name, value : evt.envVars[name], existingValue : self.term.env[name] },

View File

@@ -70,6 +70,7 @@ function View(options) {
this.dimens = { width : 0, height : 0 };
}
// :TODO: Just use styleSGRx for these, e.g. styleSGR0, styleSGR1 = norm/focus
this.ansiSGR = options.ansiSGR || ansi.getSGRFromGraphicRendition( { fg : 39, bg : 49 }, true);
this.ansiFocusSGR = options.ansiFocusSGR || this.ansiSGR;

View File

@@ -32,8 +32,7 @@ function ViewController(options) {
this.client = options.client;
this.views = {}; // map of ID -> view
this.formId = options.formId || 0;
this.mciViewFactory = new MCIViewFactory(this.client);
//this.submitKeyMap = {};
this.mciViewFactory = new MCIViewFactory(this.client); // :TODO: can this not be a singleton?
this.actionKeyMap = {};
@@ -60,15 +59,6 @@ function ViewController(options) {
return;
}
/*
var submitViewId = self.submitKeyMap[key.name];
if(submitViewId) {
self.switchFocus(submitViewId);
self.submitForm();
return;
}
*/
}
if(self.focusedView && self.focusedView.acceptsInput) {
@@ -83,7 +73,7 @@ function ViewController(options) {
self.nextFocus();
break;
case 'accept' : // :TODO: consider naming this 'done'
case 'accept' :
if(self.focusedView && self.focusedView.submit) {
self.submitForm();
} else {
@@ -146,7 +136,7 @@ function ViewController(options) {
if(propAsset) {
switch(propAsset.type) {
case 'config' :
propValue = asset.resolveConfigAsset(config[propName]);
propValue = asset.resolveConfigAsset(conf[propName]);
break;
// :TODO: handle @art (e.g. text : @art ...)
@@ -196,18 +186,6 @@ function ViewController(options) {
initialFocusId = viewId;
}
/*
if(view.submit) {
submitId = viewId;
if(_.isArray(mciConf.submit)) {
for(var i = 0; i < mciConf.submit.length; i++) {
self.submitKeyMap[mciConf.submit[i]] = viewId;
}
}
}
*/
nextItem(null);
},
function complete(err) {