* A few MCI codes

* Fix timer/flicker bug @ connect ANSI term size detection
This commit is contained in:
Bryan Ashby 2015-07-22 22:09:52 -06:00
parent 4288c5b2e9
commit ff5d568259
4 changed files with 20 additions and 6 deletions

View File

@ -21,12 +21,18 @@ function ansiQueryTermSizeIfNeeded(client, cb) {
return;
}
var done = function(res) {
client.removeListener('cursor position report', cprListener);
clearTimeout(giveUpTimer);
cb(res);
};
var cprListener = function(pos) {
//
// If we've already found out, disregard
//
if(client.term.termHeight > 0 || client.term.termWidth > 0) {
cb(true);
done(true);
return;
}
@ -42,7 +48,7 @@ function ansiQueryTermSizeIfNeeded(client, cb) {
client.log.warn(
{ height : h, width : w },
'Ignoring ANSI CPR screen size query response due to very small values');
cb(false);
done(false);
return;
}
@ -58,17 +64,17 @@ function ansiQueryTermSizeIfNeeded(client, cb) {
'Window size updated'
);
cb(true);
done(true);
};
client.once('cursor position report', cprListener);
// give up after 2s
setTimeout(function onTimeout() {
client.removeListener('cursor position report', cprListener);
cb(false);
var giveUpTimer = setTimeout(function onTimeout() {
done(false);
}, 2000);
// This causes
client.term.write(ansi.queryScreenSize());
}

View File

@ -46,9 +46,16 @@ MCIViewFactory.prototype.getPredefinedViewLabel = function(code) {
UW : this.client.user.properties.web_address,
UF : this.client.user.properties.affiliation,
UT : this.client.user.properties.theme_id,
MS : moment(this.client.user.properties.timestamp).format(this.client.currentTheme.helpers.getDateFormat()),
SH : this.client.term.termHeight.toString(),
SW : this.client.term.termWidth.toString(),
ND : this.client.runtime.id.toString(),
DT : moment().format(this.client.currentTheme.helpers.getDateFormat()),
OS : {
linux : 'Linux',
darwin : 'Mac OS X',

View File

@ -92,6 +92,7 @@ function submitApplication(callingMenu, formData, extraArgs) {
affiliation : formData.value.affils,
email_address : formData.value.email,
web_address : formData.value.web,
timestamp : new Date().toISOString(),
// :TODO: This is set in User.create() -- proabbly don't need it here:
//account_status : Config.users.requireActivation ? user.User.AccountStatus.inactive : user.User.AccountStatus.active,

Binary file not shown.