Remove some of Buffer's dependency on Terminal

This commit is contained in:
Daniel Imms
2018-12-28 19:22:05 -08:00
parent 7435971c32
commit 4a9f10d062
3 changed files with 4 additions and 10 deletions
+2 -7
View File
@@ -108,12 +108,12 @@ describe('Buffer', () => {
describe('resize', () => {
describe('column size is reduced', () => {
it('should not trim the data in the buffer', () => {
it('should trim the data in the buffer', () => {
buffer.fillViewportRows();
buffer.resize(INIT_COLS / 2, INIT_ROWS);
assert.equal(buffer.lines.length, INIT_ROWS);
for (let i = 0; i < INIT_ROWS; i++) {
assert.equal(buffer.lines.get(i).length, INIT_COLS);
assert.equal(buffer.lines.get(i).length, INIT_COLS / 2);
}
});
});
@@ -235,11 +235,6 @@ describe('Buffer', () => {
});
describe('reflow', () => {
beforeEach(() => {
terminal.eraseAttr = () => DEFAULT_ATTR;
// Needed until the setting is removed
terminal.options.experimentalBufferLineImpl = 'TypedArray';
});
it('should not wrap empty lines', () => {
buffer.fillViewportRows();
assert.equal(buffer.lines.length, INIT_ROWS);
+2 -2
View File
@@ -234,7 +234,7 @@ export class Buffer implements IBuffer {
this.scrollBottom = newRows - 1;
if (this.hasScrollback && this._terminal.options.experimentalBufferLineImpl === 'TypedArray') {
if (this.hasScrollback && this._bufferLineConstructor === BufferLine) {
this._reflow(newCols);
// Trim the end of the line off if cols shrunk
@@ -374,7 +374,7 @@ export class Buffer implements IBuffer {
// Add the new lines
const newLines: BufferLine[] = [];
for (let i = 0; i < linesToAdd; i++) {
const newLine = this.getBlankLine(this._terminal.eraseAttr(), true) as BufferLine;
const newLine = this.getBlankLine(DEFAULT_ATTR, true) as BufferLine;
newLines.push(newLine);
}
this.lines.splice(y + wrappedLines.length, 0, ...newLines);
-1
View File
@@ -230,7 +230,6 @@ export interface ITerminal extends PublicTerminal, IElementAccessor, IBufferAcce
cancel(ev: Event, force?: boolean): boolean | void;
log(text: string): void;
showCursor(): void;
eraseAttr(): number;
}
export interface IBufferAccessor {