* Work on themes. Ability to use ANSI to detect screen size if NAWS/etc. fail
This commit is contained in:
@@ -4,7 +4,9 @@
|
||||
var ansi = require('../core/ansi_term.js');
|
||||
var artwork = require('../core/art.js');
|
||||
var modules = require('../core/modules.js');
|
||||
var Log = require('../core/logger.js').log;
|
||||
var packageJson = require('../package.json');
|
||||
|
||||
var util = require('util');
|
||||
|
||||
exports.moduleInfo = {
|
||||
@@ -15,17 +17,55 @@ exports.moduleInfo = {
|
||||
|
||||
exports.entryPoint = entryPoint;
|
||||
|
||||
function entryPoint(client) {
|
||||
/*var self = this;
|
||||
this.client = client;
|
||||
var term = this.client.term;*/
|
||||
function ansiQueryTermSizeIfNeeded(client) {
|
||||
if(client.term.termHeight > 0 || client.term.termWidth > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
var onCPR = function(pos) {
|
||||
//
|
||||
// If we've already found out, disregard
|
||||
//
|
||||
if(client.term.termHeight > 0 || client.term.termWidth > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
client.term.termHeight = pos[0];
|
||||
client.term.termWidth = pos[1];
|
||||
|
||||
Log.debug({ termWidth : client.term.termWidth, termHeight : client.term.termHeight, updateSource : 'ANSI CPR' }, 'Window size updated');
|
||||
};
|
||||
|
||||
client.once('cursor position report', onCPR);
|
||||
|
||||
// give up after 2s
|
||||
setTimeout(function onTimeout() {
|
||||
client.removeListener('cursor position report', onCPR);
|
||||
}, 2000);
|
||||
|
||||
client.term.write(ansi.queryScreenSize());
|
||||
}
|
||||
|
||||
function entryPoint(client) {
|
||||
var term = client.term;
|
||||
|
||||
//
|
||||
// If we don't yet know the client term width/height,
|
||||
// try with a nonstandard ANSI DSR type request.
|
||||
//
|
||||
ansiQueryTermSizeIfNeeded(client);
|
||||
|
||||
term.write(ansi.normal());
|
||||
|
||||
term.write(ansi.disableVT100LineWrapping());
|
||||
|
||||
|
||||
|
||||
//
|
||||
// If we don't yet know the client term width/height, try
|
||||
// a nonstandard ANSI query
|
||||
//
|
||||
|
||||
// :TODO: set xterm stuff -- see x84/others
|
||||
|
||||
// :TODO: add URL to banner
|
||||
|
||||
@@ -29,7 +29,8 @@ function entryPoint(client) {
|
||||
// :TODO: types, random, and others? could come from conf.mods.matrix or such
|
||||
|
||||
//art.getArt('SO-CC1.ANS'/* 'MATRIX'*/, { types: ['.ans'], random: true}, function onArt(err, theArt) {
|
||||
theme.getThemeArt('MATRIX_1', client.user.properties.art_theme_name, function onArt(err, theArt) {
|
||||
//client.user.properties.art_theme_id = '';
|
||||
theme.getThemeArt('MATRIX_1', client.user.properties.art_theme_id, function onArt(err, theArt) {
|
||||
|
||||
//art.getArt('MATRIX_1.ANS', {}, function onArt(err, theArt) {
|
||||
if(!err) {
|
||||
|
||||
Reference in New Issue
Block a user