diff options
-rw-r--r-- | xP/public/xP.js | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/xP/public/xP.js b/xP/public/xP.js index e4f5647..ea70bbd 100644 --- a/xP/public/xP.js +++ b/xP/public/xP.js @@ -197,6 +197,14 @@ function bufferResetStats(b) { b.highlighted = false } +function bufferPopExcessLines(b) { + // Let "new" messages be, if only because pulling the log file + // is much more problematic in the web browser than in xC. + // TODO: Make the limit configurable, or extract general.backlog_limit. + const old = b.lines.length - b.newMessages - b.newUnimportantMessages + b.lines.splice(0, old - 1000) +} + function bufferActivate(name) { rpc.send({command: 'BufferActivate', bufferName: name}) } @@ -278,6 +286,7 @@ rpcEventHandlers.set(Relay.Event.BufferLine, e => { // Initial sync: skip all other processing, let highlights be. if (bufferCurrent === undefined) { b.lines.push(line) + bufferPopExcessLines(b) return } @@ -293,6 +302,7 @@ rpcEventHandlers.set(Relay.Event.BufferLine, e => { else b.newMessages++ } + bufferPopExcessLines(b) if (e.leakToActive) { let bc = buffers.get(bufferCurrent) @@ -303,6 +313,7 @@ rpcEventHandlers.set(Relay.Event.BufferLine, e => { else bc.newMessages++ } + bufferPopExcessLines(bc) } if (line.isHighlight || (!visible && !line.isUnimportant && @@ -336,7 +347,7 @@ rpcEventHandlers.set(Relay.Event.BufferStats, e => { if (b === undefined) return - b.newMessages = e.newMessages, + b.newMessages = e.newMessages b.newUnimportantMessages = e.newUnimportantMessages b.highlighted = e.highlighted }) |