Merge pull request #389 from cognitivegears/bugfix/general_bugfixes
General bug fixes
This commit is contained in:
commit
42a5539c81
|
@ -21,7 +21,7 @@ function ButtonView(options) {
|
|||
util.inherits(ButtonView, TextView);
|
||||
|
||||
ButtonView.prototype.onKeyPress = function(ch, key) {
|
||||
if(this.isKeyMapped('accept', key.name) || ' ' === ch) {
|
||||
if(this.isKeyMapped('accept', (key ? key.name : ch)) || ' ' === ch) {
|
||||
this.submitData = 'accept';
|
||||
this.emit('action', 'accept');
|
||||
delete this.submitData;
|
||||
|
@ -29,16 +29,6 @@ ButtonView.prototype.onKeyPress = function(ch, key) {
|
|||
ButtonView.super_.prototype.onKeyPress.call(this, ch, key);
|
||||
}
|
||||
};
|
||||
/*
|
||||
ButtonView.prototype.onKeyPress = function(ch, key) {
|
||||
// allow space = submit
|
||||
if(' ' === ch) {
|
||||
this.emit('action', 'accept');
|
||||
}
|
||||
|
||||
ButtonView.super_.prototype.onKeyPress.call(this, ch, key);
|
||||
};
|
||||
*/
|
||||
|
||||
ButtonView.prototype.getData = function() {
|
||||
return this.submitData || null;
|
||||
|
|
12
core/fse.js
12
core/fse.js
|
@ -791,10 +791,10 @@ exports.FullScreenEditorModule = exports.getModule = class FullScreenEditorModul
|
|||
});
|
||||
},
|
||||
function prepareViewStates(callback) {
|
||||
var header = self.viewControllers.header;
|
||||
var from = header.getView(MciViewIds.header.from);
|
||||
let from = self.viewControllers.header.getView(MciViewIds.header.from);
|
||||
if (from) {
|
||||
from.acceptsFocus = false;
|
||||
//from.setText(self.client.user.username);
|
||||
}
|
||||
|
||||
// :TODO: make this a method
|
||||
var body = self.viewControllers.body.getView(MciViewIds.body.message);
|
||||
|
@ -825,11 +825,14 @@ exports.FullScreenEditorModule = exports.getModule = class FullScreenEditorModul
|
|||
{
|
||||
const fromView = self.viewControllers.header.getView(MciViewIds.header.from);
|
||||
const area = getMessageAreaByTag(self.messageAreaTag);
|
||||
|
||||
if(fromView !== undefined) {
|
||||
if(area && area.realNames) {
|
||||
fromView.setText(self.client.user.properties[UserProps.RealName] || self.client.user.username);
|
||||
} else {
|
||||
fromView.setText(self.client.user.username);
|
||||
}
|
||||
}
|
||||
|
||||
if(self.replyToMessage) {
|
||||
self.initHeaderReplyEditMode();
|
||||
|
@ -914,7 +917,10 @@ exports.FullScreenEditorModule = exports.getModule = class FullScreenEditorModul
|
|||
}
|
||||
|
||||
initHeaderViewMode() {
|
||||
// Only set header text for from view if it is on the form
|
||||
if (this.viewControllers.header.getView(MciViewIds.header.from) !== undefined) {
|
||||
this.setHeaderText(MciViewIds.header.from, this.message.fromUserName);
|
||||
}
|
||||
this.setHeaderText(MciViewIds.header.to, this.message.toUserName);
|
||||
this.setHeaderText(MciViewIds.header.subject, this.message.subject);
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ MaskEditTextView.prototype.onKeyPress = function(ch, key) {
|
|||
this.text = this.text.substr(0, this.text.length - 1);
|
||||
this.clientBackspace();
|
||||
} else {
|
||||
while(this.patternArrayPos > 0) {
|
||||
while(this.patternArrayPos >= 0) {
|
||||
if(_.isRegExp(this.patternArray[this.patternArrayPos])) {
|
||||
this.text = this.text.substr(0, this.text.length - 1);
|
||||
this.client.term.write(ansi.goto(this.position.row, this.getEndOfTextColumn() + 1));
|
||||
|
|
|
@ -44,49 +44,6 @@ function TextView(options) {
|
|||
this.textMaskChar = options.textMaskChar;
|
||||
}
|
||||
|
||||
/*
|
||||
this.drawText = function(s) {
|
||||
|
||||
//
|
||||
// |<- this.maxLength
|
||||
// ABCDEFGHIJK
|
||||
// |ABCDEFG| ^_ this.text.length
|
||||
// ^-- this.dimens.width
|
||||
//
|
||||
let textToDraw = _.isString(this.textMaskChar) ?
|
||||
new Array(s.length + 1).join(this.textMaskChar) :
|
||||
stylizeString(s, this.hasFocus ? this.focusTextStyle : this.textStyle);
|
||||
|
||||
if(textToDraw.length > this.dimens.width) {
|
||||
if(this.hasFocus) {
|
||||
if(this.horizScroll) {
|
||||
textToDraw = textToDraw.substr(textToDraw.length - this.dimens.width, textToDraw.length);
|
||||
}
|
||||
} else {
|
||||
if(textToDraw.length > this.dimens.width) {
|
||||
if(this.textOverflow &&
|
||||
this.dimens.width > this.textOverflow.length &&
|
||||
textToDraw.length - this.textOverflow.length >= this.textOverflow.length)
|
||||
{
|
||||
textToDraw = textToDraw.substr(0, this.dimens.width - this.textOverflow.length) + this.textOverflow;
|
||||
} else {
|
||||
textToDraw = textToDraw.substr(0, this.dimens.width);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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.drawText = function(s) {
|
||||
|
||||
//
|
||||
|
@ -125,7 +82,7 @@ function TextView(options) {
|
|||
this.client.term.write(
|
||||
padStr(
|
||||
textToDraw,
|
||||
this.dimens.width + 1,
|
||||
this.dimens.width,
|
||||
renderedFillChar, //this.fillChar,
|
||||
this.justify,
|
||||
this.hasFocus ? this.getFocusSGR() : this.getSGR(),
|
||||
|
|
|
@ -154,7 +154,7 @@ View.prototype.setHeight = function(height) {
|
|||
|
||||
View.prototype.setWidth = function(width) {
|
||||
width = parseInt(width) || 1;
|
||||
width = Math.min(width, this.client.term.termWidth);
|
||||
width = Math.min(width, this.client.term.termWidth - this.position.col);
|
||||
|
||||
this.dimens.width = width;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue