new approach

This commit is contained in:
Jörg Breitbart
2018-10-09 23:48:58 +02:00
parent febc3ba2b8
commit 33a358033c
3 changed files with 35 additions and 11 deletions
+5 -6
View File
@@ -94,13 +94,11 @@ export class BufferLine implements IBufferLine {
}
}
public copyFrom(line: IBufferLine): void {
this._data = [];
for (let i = 0; i < line.length; ++i) {
this._push(line.get(i));
}
public copyFrom(line: BufferLine): IBufferLine {
this._data = line._data.slice(0);
this.length = line.length;
this.isWrapped = line.isWrapped;
return this;
}
public clone(): IBufferLine {
@@ -249,7 +247,7 @@ export class BufferLineTypedArray implements IBufferLine {
}
/** alter to a full copy of line */
public copyFrom(line: BufferLineTypedArray): void {
public copyFrom(line: BufferLineTypedArray): IBufferLine {
if (this.length !== line.length) {
this._data = new Uint32Array(line._data);
} else {
@@ -262,6 +260,7 @@ export class BufferLineTypedArray implements IBufferLine {
this._combined[el] = line._combined[el];
}
this.isWrapped = line.isWrapped;
return this;
}
/** create a new clone */