* Fixed some logging of client IP addresses/etc.
* Some updates to FSE work for position and edit mode display * Use cursor save/restore for some things vs internal tracking
This commit is contained in:
parent
3d5d21bcb5
commit
7c0446bf79
20
core/bbs.js
20
core/bbs.js
|
@ -159,8 +159,6 @@ function startListening() {
|
|||
|
||||
addNewClient(client);
|
||||
|
||||
//logger.log.info({ clientId : client.runtime.id, from : client.address(), server : module.moduleInfo.name }, 'Client connected');
|
||||
|
||||
client.on('ready', function onClientReady() {
|
||||
// Go to module -- use default error handler
|
||||
prepareClient(client, function onPrepared() {
|
||||
|
@ -198,20 +196,14 @@ function addNewClient(client) {
|
|||
// Create a client specific logger
|
||||
client.log = logger.log.child( { clientId : id } );
|
||||
|
||||
// :TODO: if client.log concept is kept, clean this up to use it:
|
||||
var connInfo = { ip : client.input.remoteAddress };
|
||||
|
||||
var connInfo = {
|
||||
connectionCount : clientConnections.length,
|
||||
clientId : client.runtime.id,
|
||||
};
|
||||
|
||||
if(logger.log.debug()) {
|
||||
connInfo.address = client.address();
|
||||
} else {
|
||||
connInfo.ip = client.address().address;
|
||||
if(client.log.debug()) {
|
||||
connInfo.port = client.input.localPort;
|
||||
connInfo.family = client.input.localFamily;
|
||||
}
|
||||
|
||||
logger.log.info(connInfo, 'Client connected');
|
||||
|
||||
client.log.info(connInfo, 'Client connected');
|
||||
|
||||
return id;
|
||||
}
|
||||
|
|
|
@ -780,8 +780,7 @@ function MultiLineEditTextView(options) {
|
|||
};
|
||||
|
||||
this.keyPressInsert = function() {
|
||||
// :TODO: emit event
|
||||
self.overtypeMode = !self.overtypeMode;
|
||||
self.toggleTextEditMode();
|
||||
};
|
||||
|
||||
this.keyPressTab = function() {
|
||||
|
@ -1006,11 +1005,13 @@ function MultiLineEditTextView(options) {
|
|||
};
|
||||
|
||||
this.emitPosition = function() {
|
||||
self.emit(
|
||||
'cursor position',
|
||||
{ row : self.getTextLinesIndex(self.cursorPos.row), col : self.cursorPos.col });
|
||||
self.emit('cursor position', self.getEditPosition());
|
||||
};
|
||||
|
||||
this.toggleTextEditMode = function() {
|
||||
self.overtypeMode = !self.overtypeMode;
|
||||
self.emit('text edit mode', self.getTextEditMode());
|
||||
};
|
||||
}
|
||||
|
||||
require('util').inherits(MultiLineEditTextView, View);
|
||||
|
@ -1091,3 +1092,12 @@ MultiLineEditTextView.prototype.onKeyPress = function(ch, key) {
|
|||
MultiLineEditTextView.super_.prototype.onKeyPress.call(this, ch, key);
|
||||
}
|
||||
};
|
||||
|
||||
MultiLineEditTextView.prototype.getTextEditMode = function() {
|
||||
return this.overtypeMode ? 'overtype' : 'insert';
|
||||
};
|
||||
|
||||
MultiLineEditTextView.prototype.getEditPosition = function() {
|
||||
return { row : this.getTextLinesIndex(this.cursorPos.row), col : this.cursorPos.col }
|
||||
};
|
||||
|
||||
|
|
|
@ -432,8 +432,15 @@ function TelnetClient(input, output) {
|
|||
|
||||
var i;
|
||||
while((i = bufs.indexOf(IAC_BUF)) >= 0) {
|
||||
/*
|
||||
if(bufs.length < (i + 1)) {
|
||||
i = MORE_DATA_REQUIRED;
|
||||
break;
|
||||
}
|
||||
*/
|
||||
// :TODO: Android client Irssi ConnectBot asserts here:
|
||||
assert(bufs.length > (i + 1), 'bufs.length=' + bufs.length + ' i=' + i + ' bufs=' + bufs);
|
||||
assert(bufs.length > (i + 1),
|
||||
'bufs.length=' + bufs.length + ' i=' + i + ' bufs=' + require('../string_util.js').debugEscapedString(bufs.toBuffer()))
|
||||
|
||||
if(i > 0) {
|
||||
self.emit('data', bufs.splice(0, i).toBuffer());
|
||||
|
|
Binary file not shown.
24
mods/fse.js
24
mods/fse.js
|
@ -133,6 +133,10 @@ function FullScreenEditorModule(options) {
|
|||
}
|
||||
],
|
||||
function complete(err) {
|
||||
var bodyView = self.getBodyView();
|
||||
self.updateTextEditMode(bodyView.getTextEditMode());
|
||||
self.updateEditModePosition(bodyView.getEditPosition());
|
||||
|
||||
self.viewControllers.body.removeFocus(); // :TODO: Change vc to allow *not* setting focus @ create
|
||||
self.viewControllers.header.switchFocus(1);
|
||||
}
|
||||
|
@ -147,8 +151,20 @@ function FullScreenEditorModule(options) {
|
|||
if('edit' === this.editorMode) {
|
||||
var posView = self.viewControllers[self.getFooterName(false)].getView(1);
|
||||
if(posView) {
|
||||
posView.setText(pos.row + ',' + pos.col);
|
||||
self.getBodyView().setFocus(true);
|
||||
self.client.term.rawWrite(ansi.savePos());
|
||||
posView.setText(_.padLeft(String(pos.row + 1), 2, '0') + ',' + _.padLeft(String(pos.col + 1), 2, '0'));
|
||||
self.client.term.rawWrite(ansi.restorePos());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.updateTextEditMode = function(mode) {
|
||||
if('edit' === this.editorMode) {
|
||||
var modeView = self.viewControllers[self.getFooterName(false)].getView(2);
|
||||
if(modeView) {
|
||||
self.client.term.rawWrite(ansi.savePos());
|
||||
modeView.setText('insert' === mode ? 'INS' : 'OVR');
|
||||
self.client.term.rawWrite(ansi.restorePos());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -163,6 +179,10 @@ function FullScreenEditorModule(options) {
|
|||
self.getBodyView().on('cursor position', function cursorPosUpdate(pos) {
|
||||
self.updateEditModePosition(pos);
|
||||
});
|
||||
|
||||
self.getBodyView().on('text edit mode', function textEditMode(mode) {
|
||||
self.updateTextEditMode(mode);
|
||||
});
|
||||
},
|
||||
editorEscPressed : function(formData, extraArgs) {
|
||||
|
||||
|
|
Loading…
Reference in New Issue