forked from xtermjs/xterm.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial working version of new memory optimizations
Very fragile right now, only works for basic IO Part of xtermjs#791
- Loading branch information
Showing
4 changed files
with
109 additions
and
11 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** | ||
* @license MIT | ||
*/ | ||
|
||
const DEFAULT_COLOR = 1 << 24; | ||
|
||
export class CharAttributes { | ||
constructor( | ||
public x1: number, | ||
public y1: number, | ||
public x2: number, | ||
public y2: number, | ||
// TODO: Int32Array (Maybe Int8?) | ||
// TODO: This should be private | ||
public _data: [number, number, number] | ||
) { | ||
} | ||
|
||
public get flags(): number { | ||
return this._data[0]; | ||
} | ||
|
||
public get isDefaultFg(): boolean { | ||
return this._data[1] === DEFAULT_COLOR; | ||
} | ||
|
||
public get truecolorFg(): string { | ||
return '#' + this._padLeft(this._data[1].toString(16), '0'); | ||
} | ||
|
||
public get isDefaultBg(): boolean { | ||
return this._data[2] === DEFAULT_COLOR; | ||
} | ||
|
||
public get truecolorBg(): string { | ||
return '#' + this._padLeft(this._data[2].toString(16), '0'); | ||
} | ||
|
||
private _padLeft(text: string, padChar: string): string { | ||
while (text.length < 6) { | ||
text = padChar + text; | ||
} | ||
return text; | ||
} | ||
} |
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
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
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