simplify JoinedCellData

This commit is contained in:
Jörg Breitbart
2019-05-05 21:48:35 +02:00
parent 4fd9b3f249
commit ffcdba8d5b
2 changed files with 14 additions and 9 deletions
+4 -1
View File
@@ -261,7 +261,10 @@ export abstract class BaseRenderLayer implements IRenderLayer {
*/
protected drawChars(terminal: ITerminal, cell: ICellData, x: number, y: number): void {
// skip cache right away if we draw in RGB or have joined cells
// skip cache right away if we draw in RGB
// Note: to avoid bad runtime JoinedCellData will be skipped
// in the cache handler (atlasDidDraw == false) itself and
// fall through to uncached later down below
if (cell.isFgRGB() || cell.isBgRGB() || cell instanceof JoinedCellData) {
this._drawUncachedChars(terminal, cell, x, y);
return;
+10 -8
View File
@@ -1,15 +1,15 @@
import { ITerminal, IBufferLine, ICellData, CharData } from '../Types';
import { ICharacterJoinerRegistry, ICharacterJoiner } from './Types';
import { CellData, Content } from '../BufferLine';
import { CellData, Content, AttributeData } from '../BufferLine';
import { WHITESPACE_CELL_CHAR } from '../Buffer';
export class JoinedCellData extends CellData implements ICellData {
private _width: number = 0;
private _code: number = 0x1FFFFF; // highest allowed codepoint, meant as -1
export class JoinedCellData extends AttributeData implements ICellData {
private _width: number;
// .content carries no meaning for joined CellData, simply nullify it
// thus we have to overload all other .content accessors
public content: number = 0;
public fg: number = 0;
public bg: number = 0;
public fg: number;
public bg: number;
public combinedData: string = '';
constructor(firstCell: ICellData, chars: string, width: number) {
@@ -34,7 +34,9 @@ export class JoinedCellData extends CellData implements ICellData {
}
public getCode(): number {
return this._code;
// code always gets the highest possible fake codepoint (read as -1)
// this is needed as code is used by caches as identifier
return 0x1FFFFF;
}
public setFromCharData(value: CharData): void {