I know I can clear the buffer. by .clear()
method.
But can I restrain the size of the buffer in terms of memory or number of lines?
Can somebody help me on this or point to the docs? Because in docs I am not able to find a clear solution.
Bit Late, hope this could still help.
The Terminal
object contains a reference to buffer
, you can access a property x
& y
, which you can limit against.
x
= number of characters on a line
y
= number of lines
You could try something like this
const maxBufferLines = 10;
terminal.on('key', (key, ev) => {
if (ev.keyCode === 13) {
if (terminal._core.buffer.y >= maxBufferLines) {
terminal.writeln('Max Buffer Size');
} else {
terminal.write('\r\n$ ');
}
}
});