Fix trimming on a buffer with 0 scrollback

Unfortunately this removed the padding idea from CircularList as it
would only work when the list is not full.
This commit is contained in:
Daniel Imms
2017-08-06 18:56:37 -07:00
parent a57f55dcbf
commit e7ee3ec63c
4 changed files with 24 additions and 56 deletions
+15
View File
@@ -88,6 +88,21 @@ describe('Buffer', () => {
assert.equal(buffer.ydisp, 5);
assert.equal(buffer.ybase, 5);
});
describe('no scrollback', () => {
it('should trim from the top of the buffer when the cursor reaches the bottom', () => {
terminal.options.scrollback = 0;
buffer = new Buffer(terminal, false);
assert.equal(buffer.lines.maxLength, INIT_ROWS);
buffer.y = INIT_ROWS - 1;
buffer.fillViewportRows();
buffer.lines.get(5)[0][1] = 'a';
buffer.lines.get(INIT_ROWS - 1)[0][1] = 'b';
buffer.resize(INIT_COLS, INIT_ROWS - 5);
assert.equal(buffer.lines.get(0)[0][1], 'a');
assert.equal(buffer.lines.get(INIT_ROWS - 1 - 5)[0][1], 'b');
});
});
});
describe('row size increased', () => {