Implement 'maxScrollbackLines' config for MRC module

This commit is contained in:
Bryan Ashby 2019-06-08 12:12:29 -06:00
parent 3396944820
commit ad305b4ccc
No known key found for this signature in database
GPG Key ID: B49EB437951D2542
2 changed files with 9 additions and 0 deletions

View File

@ -72,6 +72,8 @@ exports.getModule = class mrcModule extends MenuModule {
this.log = Log.child( { module : 'MRC' } ); this.log = Log.child( { module : 'MRC' } );
this.config = Object.assign({}, _.get(options, 'menuConfig.config'), { extraArgs : options.extraArgs }); this.config = Object.assign({}, _.get(options, 'menuConfig.config'), { extraArgs : options.extraArgs });
this.config.maxScrollbackLines = this.config.maxScrollbackLines || 500;
this.state = { this.state = {
socket: '', socket: '',
alias: this.client.user.username, alias: this.client.user.username,
@ -208,6 +210,10 @@ exports.getModule = class mrcModule extends MenuModule {
const padding = ' |00' + ' '.repeat(padAmount); const padding = ' |00' + ' '.repeat(padAmount);
chatLogView.addText(pipeToAnsi(msg + padding)); chatLogView.addText(pipeToAnsi(msg + padding));
if(chatLogView.getLineCount() > this.config.maxScrollbackLines) {
chatLogView.deleteLine(0);
}
}); });
} }

View File

@ -1104,6 +1104,9 @@
art: MRC art: MRC
config: { config: {
cls: true cls: true
// max lines kept in scrollback buffer
maxScrollbackLines: 500
} }
form: { form: {
0: { 0: {