* Fix word wrap bug introduced prior -- use 'expand' not 'expandTabs'

* Notes on better access of views by ID
* Work on apply process a bit
* Replies can now be saved
This commit is contained in:
Bryan Ashby 2015-09-20 01:29:07 -06:00
parent a6d00b05a7
commit b15d9a0bf8
7 changed files with 71 additions and 7 deletions

View File

@ -123,6 +123,10 @@ function FullScreenEditorModule(options) {
return 'email' === self.editorType && Message.WellKnownAreaNames.Private === self.messageAreaName;
};
this.isReply = function() {
return !_.isUndefined(self.replyToMessage);
};
this.getFooterName = function() {
return 'footer' + _.capitalize(self.footerMode); // e.g. 'footerEditor', 'footerEditorMenu', ...
};
@ -140,6 +144,38 @@ function FullScreenEditorModule(options) {
}[name];
};
/*ViewModeHeader : {
From : 1,
To : 2,
Subject : 3,
DateTime : 5,
MsgNum : 6,
MsgTotal : 7,
ViewCount : 8,
HashTags : 9,
MessageID : 10,
ReplyToMsgID : 11
},*/
// :TODO: convert to something like this for all view acces:
this.getHeaderViews = function() {
var vc = self.viewControllers.header;
if(self.isViewMode()) {
return {
from : vc.getView(1),
to : vc.getView(2),
subject : vc.getView(3),
dateTime : vc.getView(5),
msgNum : vc.getView(7),
// ...
};
}
};
this.setInitialFooterMode = function() {
switch(self.editorMode) {
case 'edit' : self.footerMode = 'editor'; break;
@ -158,6 +194,11 @@ function FullScreenEditorModule(options) {
message : self.viewControllers.body.getFormData().value.message,
};
if(self.isReply()) {
msgOpts.replyToMsgId = self.replyToMessageId;
}
self.message = new Message(msgOpts);
};

View File

@ -172,6 +172,8 @@ function callModuleMenuMethod(client, asset, path, formData, extraArgs) {
}
try {
client.log.trace( { methodName : asset.asset, formData : formData, extraArgs : extraArgs } );
var methodMod = require(path);
methodMod[asset.asset](client.currentMenuModule, formData || { }, extraArgs);
} catch(e) {
@ -190,7 +192,7 @@ function handleAction(client, formData, conf) {
case 'method' :
case 'systemMethod' :
if(_.isString(actionAsset.location)) {
callModuleMenuMethod(client, actionAsset, paths.join(Config.paths.mods, actionAsset.location, formData, conf.extraArgs));
callModuleMenuMethod(client, actionAsset, paths.join(Config.paths.mods, actionAsset.location), formData, conf.extraArgs);
} else {
if('systemMethod' === actionAsset.type) {
// :TODO: Need to pass optional args here -- conf.extraArgs and args between e.g. ()

View File

@ -502,6 +502,7 @@ function MultiLineEditTextView(options) {
width : width,
tabHandling : tabHandling || 'expand',
tabWidth : self.tabWidth,
tabChar : '\t',
});
};
@ -545,7 +546,10 @@ function MultiLineEditTextView(options) {
var wrapped;
for(var i = 0; i < text.length; ++i) {
wrapped = self.wordWrapSingleLine(text[i], 'expandTabs', self.dimens.width).wrapped;
wrapped = self.wordWrapSingleLine(
text[i], // input
'expand', // tabHandling
self.dimens.width).wrapped;
for(var j = 0; j < wrapped.length - 1; ++j) {
self.textLines.splice(index++, 0, { text : wrapped[j] } );

View File

@ -12,6 +12,7 @@ function wordWrapText(text, options) {
// width : word wrap width
// tabHandling : expand (default=expand)
// tabWidth : tab width if tabHandling is 'expand' (default=4)
// tabChar : character to use for tab expansion
//
assert(_.isObject(options), 'Missing options!');
assert(_.isNumber(options.width), 'Missing options.width!');
@ -22,6 +23,8 @@ function wordWrapText(text, options) {
options.tabWidth = 4;
}
options.tabChar = options.tabChar || ' ';
//
// Notes
// * Sublime Text 3 for example considers spaces after a word
@ -47,7 +50,7 @@ function wordWrapText(text, options) {
function expandTab(col) {
var remainWidth = options.tabWidth - (col % options.tabWidth);
return new Array(remainWidth).join('\t');
return new Array(remainWidth).join(options.tabChar);
}
// :TODO: support wrapping pipe code text (e.g. ignore color codes, expand MCI codes)
@ -84,7 +87,7 @@ function wordWrapText(text, options) {
// Nice info here: http://c-for-dummies.com/blog/?p=424
//
if('expand' === options.tabHandling) {
word += expandTab(results.wrapped[i].length + word.length) + '\t';
word += expandTab(results.wrapped[i].length + word.length) + options.tabChar;
} else {
word += m[0];
}

View File

@ -32,7 +32,7 @@ function validateApplicationData(formData, cb) {
}
if(isNaN(Date.parse(formData.value.birthdate))) {
cb('Invalid birthdate!');
cb('Invalid birthdate!', [ 3 ] );
return;
}
@ -109,6 +109,8 @@ function submitApplication(callingMenu, formData, extraArgs) {
newUser.create( { password : formData.value.password }, function created(err) {
if(err) {
Log.info( { error : err, username : formData.value.username }, 'New user creation failed');
client.gotoMenuModule( { name : extraArgs.error } );
} else {
Log.info( { username : formData.value.username, userId : newUser.userId }, 'New user created');

View File

@ -230,6 +230,13 @@
}
]
}
actionKeys: [
{
keys: [ "escape" ]
viewId: 13
}
]
}
}
}
@ -664,6 +671,10 @@
submit: {
*: [
{
value: { 1: 0 }
action: @method:editModeMenuSave
}
{
value: { 1: 1 }
action: @method:replyDiscard
@ -686,7 +697,7 @@
}
{
keys: [ "s", "shift + s" ]
action: @method:replySave
action: @method:editModeMenuSave
}
{
keys: [ "d", "shift + d" ]

View File

@ -50,7 +50,8 @@ function AreaPostFSEModule(options) {
console.log(msg);
}
self.client.gotoMenuModule( { name : self.menuConfig.fallback } );
self.client.fallbackMenuModule();
//self.client.gotoMenuModule( { name : self.menuConfig.fallback } );
}
);
};