Last active
August 29, 2018 18:21
-
-
Save jerch/27c2cf91ad313a25415873e4047b2900 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type CharDataNew = [ | |
number, // flags 1 - current flags | |
number, // flags 2 - store missing RGB values | |
number // content - UTF32 char or pointer to combined string (at the end of the memory) | |
] | |
type SomeType = null; // to be implmented | |
/** | |
* memory layout: | |
* | CharDataNew | CharDataNew | ..cols | pointer target segment (combined chars) | | |
* on resize: | |
* | CharDataNew | CharDataNew | ..cols + new | moved: pointer target segment (combined chars) | | |
* => copy mem, if to small | |
* => fix local pointers of combined chars (rare case) | |
*/ | |
class BufferLine { | |
private _memory: Uint32Array; | |
constructor(public cols: number, ch?: CharDataNew, public isWrapped: boolean = false) { | |
this._memory = new Uint32Array(this.cols * 3); | |
} | |
getData(index: number): SomeType { return null; } | |
setData(index: number, value: SomeType): void {} | |
public insertCells(pos: number, n: number, ch: CharDataNew): void {} | |
public deleteCells(pos: number, n: number, fill: CharDataNew): void {} | |
public replaceCells(start: number, end: number, fill: CharDataNew): void {} | |
public resize(cols: number, fill: CharDataNew): void {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Some possible memory models for a buffer line. The summaries marked with
==>
only contain stuff that will be quite different from the others (penalty for combining chars not listed as will occur in all models).