From ad305b4cccd6086befa758b793db5b9315d85b7e Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Sat, 8 Jun 2019 12:12:29 -0600 Subject: [PATCH] Implement 'maxScrollbackLines' config for MRC module --- core/mrc.js | 6 ++++++ misc/menu_template.in.hjson | 3 +++ 2 files changed, 9 insertions(+) diff --git a/core/mrc.js b/core/mrc.js index f2bfeec6..3ab1e91b 100644 --- a/core/mrc.js +++ b/core/mrc.js @@ -72,6 +72,8 @@ exports.getModule = class mrcModule extends MenuModule { this.log = Log.child( { module : 'MRC' } ); this.config = Object.assign({}, _.get(options, 'menuConfig.config'), { extraArgs : options.extraArgs }); + this.config.maxScrollbackLines = this.config.maxScrollbackLines || 500; + this.state = { socket: '', alias: this.client.user.username, @@ -208,6 +210,10 @@ exports.getModule = class mrcModule extends MenuModule { const padding = ' |00' + ' '.repeat(padAmount); chatLogView.addText(pipeToAnsi(msg + padding)); + + if(chatLogView.getLineCount() > this.config.maxScrollbackLines) { + chatLogView.deleteLine(0); + } }); } diff --git a/misc/menu_template.in.hjson b/misc/menu_template.in.hjson index 9ae54d17..5c7eba83 100644 --- a/misc/menu_template.in.hjson +++ b/misc/menu_template.in.hjson @@ -1104,6 +1104,9 @@ art: MRC config: { cls: true + + // max lines kept in scrollback buffer + maxScrollbackLines: 500 } form: { 0: {