Remove some of Buffer's dependency on Terminal
This commit is contained in:
+2
-7
@@ -108,12 +108,12 @@ describe('Buffer', () => {
|
|||||||
|
|
||||||
describe('resize', () => {
|
describe('resize', () => {
|
||||||
describe('column size is reduced', () => {
|
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.fillViewportRows();
|
||||||
buffer.resize(INIT_COLS / 2, INIT_ROWS);
|
buffer.resize(INIT_COLS / 2, INIT_ROWS);
|
||||||
assert.equal(buffer.lines.length, INIT_ROWS);
|
assert.equal(buffer.lines.length, INIT_ROWS);
|
||||||
for (let i = 0; i < INIT_ROWS; i++) {
|
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', () => {
|
describe('reflow', () => {
|
||||||
beforeEach(() => {
|
|
||||||
terminal.eraseAttr = () => DEFAULT_ATTR;
|
|
||||||
// Needed until the setting is removed
|
|
||||||
terminal.options.experimentalBufferLineImpl = 'TypedArray';
|
|
||||||
});
|
|
||||||
it('should not wrap empty lines', () => {
|
it('should not wrap empty lines', () => {
|
||||||
buffer.fillViewportRows();
|
buffer.fillViewportRows();
|
||||||
assert.equal(buffer.lines.length, INIT_ROWS);
|
assert.equal(buffer.lines.length, INIT_ROWS);
|
||||||
|
|||||||
+2
-2
@@ -234,7 +234,7 @@ export class Buffer implements IBuffer {
|
|||||||
|
|
||||||
this.scrollBottom = newRows - 1;
|
this.scrollBottom = newRows - 1;
|
||||||
|
|
||||||
if (this.hasScrollback && this._terminal.options.experimentalBufferLineImpl === 'TypedArray') {
|
if (this.hasScrollback && this._bufferLineConstructor === BufferLine) {
|
||||||
this._reflow(newCols);
|
this._reflow(newCols);
|
||||||
|
|
||||||
// Trim the end of the line off if cols shrunk
|
// Trim the end of the line off if cols shrunk
|
||||||
@@ -374,7 +374,7 @@ export class Buffer implements IBuffer {
|
|||||||
// Add the new lines
|
// Add the new lines
|
||||||
const newLines: BufferLine[] = [];
|
const newLines: BufferLine[] = [];
|
||||||
for (let i = 0; i < linesToAdd; i++) {
|
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);
|
newLines.push(newLine);
|
||||||
}
|
}
|
||||||
this.lines.splice(y + wrappedLines.length, 0, ...newLines);
|
this.lines.splice(y + wrappedLines.length, 0, ...newLines);
|
||||||
|
|||||||
@@ -230,7 +230,6 @@ export interface ITerminal extends PublicTerminal, IElementAccessor, IBufferAcce
|
|||||||
cancel(ev: Event, force?: boolean): boolean | void;
|
cancel(ev: Event, force?: boolean): boolean | void;
|
||||||
log(text: string): void;
|
log(text: string): void;
|
||||||
showCursor(): void;
|
showCursor(): void;
|
||||||
eraseAttr(): number;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IBufferAccessor {
|
export interface IBufferAccessor {
|
||||||
|
|||||||
Reference in New Issue
Block a user