Mostly working for reflowing to smaller

This commit is contained in:
Daniel Imms
2018-12-27 23:35:52 -08:00
parent 8a50729a98
commit 314f98f2a6
2 changed files with 179 additions and 69 deletions
+12 -5
View File
@@ -304,12 +304,19 @@ export class BufferLine implements IBufferLine {
return 0;
}
public copyCellsFrom(src: BufferLine, srcCol: number, destCol: number, length: number): void {
console.log(' copyCellsFrom', srcCol, destCol, length);
public copyCellsFrom(src: BufferLine, srcCol: number, destCol: number, length: number, applyInReverse: boolean): void {
const srcData = src._data;
for (let cell = 0; cell < length; cell++) {
for (let i = 0; i < CELL_SIZE; i++) {
this._data[(destCol + cell) * CELL_SIZE + i] = srcData[(srcCol + cell) * CELL_SIZE + i];
if (applyInReverse) {
for (let cell = length - 1; cell >= 0; cell--) {
for (let i = 0; i < CELL_SIZE; i++) {
this._data[(destCol + cell) * CELL_SIZE + i] = srcData[(srcCol + cell) * CELL_SIZE + i];
}
}
} else {
for (let cell = 0; cell < length; cell++) {
for (let i = 0; i < CELL_SIZE; i++) {
this._data[(destCol + cell) * CELL_SIZE + i] = srcData[(srcCol + cell) * CELL_SIZE + i];
}
}
}
}