Merge branch 'utf32_buffer' into true_color
This commit is contained in:
@@ -239,7 +239,7 @@ export abstract class BaseRenderLayer implements IRenderLayer {
|
||||
this._ctx.textBaseline = 'middle';
|
||||
this._clipRow(terminal, y);
|
||||
this._ctx.fillText(
|
||||
cell.chars,
|
||||
cell.getChars(),
|
||||
x * this._scaledCellWidth + this._scaledCharLeft,
|
||||
(y + 0.5) * this._scaledCellHeight + this._scaledCharTop);
|
||||
}
|
||||
@@ -279,8 +279,8 @@ export abstract class BaseRenderLayer implements IRenderLayer {
|
||||
const drawInBrightColor = terminal.options.drawBoldTextInBrightColors && cell.isBold() && fg < 8 && fg !== INVERTED_DEFAULT_COLOR;
|
||||
|
||||
fg += drawInBrightColor ? 8 : 0;
|
||||
this._currentGlyphIdentifier.chars = cell.chars || WHITESPACE_CELL_CHAR;
|
||||
this._currentGlyphIdentifier.code = cell.code || WHITESPACE_CELL_CODE;
|
||||
this._currentGlyphIdentifier.chars = cell.getChars() || WHITESPACE_CELL_CHAR;
|
||||
this._currentGlyphIdentifier.code = cell.getCode() || WHITESPACE_CELL_CODE;
|
||||
this._currentGlyphIdentifier.bg = bg;
|
||||
this._currentGlyphIdentifier.fg = fg;
|
||||
this._currentGlyphIdentifier.bold = cell.isBold() && terminal.options.enableBold;
|
||||
@@ -336,7 +336,7 @@ export abstract class BaseRenderLayer implements IRenderLayer {
|
||||
}
|
||||
// Draw the character
|
||||
this._ctx.fillText(
|
||||
cell.chars,
|
||||
cell.getChars(),
|
||||
x * this._scaledCellWidth + this._scaledCharLeft,
|
||||
(y + 0.5) * this._scaledCellHeight + this._scaledCharTop);
|
||||
this._ctx.restore();
|
||||
|
||||
@@ -59,7 +59,7 @@ export class CharacterJoinerRegistry implements ICharacterJoinerRegistry {
|
||||
for (let x = 0; x < line.getTrimmedLength(); x++) {
|
||||
line.loadCell(x, this._cell);
|
||||
|
||||
if (this._cell.width === 0) {
|
||||
if (this._cell.getWidth() === 0) {
|
||||
// If this character is of width 0, skip it.
|
||||
continue;
|
||||
}
|
||||
@@ -88,7 +88,7 @@ export class CharacterJoinerRegistry implements ICharacterJoinerRegistry {
|
||||
rangeAttrBG = this._cell.bg;
|
||||
}
|
||||
|
||||
currentStringIndex += this._cell.chars.length || WHITESPACE_CELL_CHAR.length;
|
||||
currentStringIndex += this._cell.getChars().length || WHITESPACE_CELL_CHAR.length;
|
||||
}
|
||||
|
||||
// Process any trailing ranges.
|
||||
|
||||
@@ -143,7 +143,7 @@ export class CursorRenderLayer extends BaseRenderLayer {
|
||||
this._state.y = viewportRelativeCursorY;
|
||||
this._state.isFocused = false;
|
||||
this._state.style = terminal.options.cursorStyle;
|
||||
this._state.width = this._cell.width;
|
||||
this._state.width = this._cell.getWidth();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ export class CursorRenderLayer extends BaseRenderLayer {
|
||||
this._state.y === viewportRelativeCursorY &&
|
||||
this._state.isFocused === terminal.isFocused &&
|
||||
this._state.style === terminal.options.cursorStyle &&
|
||||
this._state.width === this._cell.width) {
|
||||
this._state.width === this._cell.getWidth()) {
|
||||
return;
|
||||
}
|
||||
this._clearCursor();
|
||||
@@ -173,7 +173,7 @@ export class CursorRenderLayer extends BaseRenderLayer {
|
||||
this._state.y = viewportRelativeCursorY;
|
||||
this._state.isFocused = false;
|
||||
this._state.style = terminal.options.cursorStyle;
|
||||
this._state.width = this._cell.width;
|
||||
this._state.width = this._cell.getWidth();
|
||||
}
|
||||
|
||||
private _clearCursor(): void {
|
||||
@@ -199,7 +199,7 @@ export class CursorRenderLayer extends BaseRenderLayer {
|
||||
private _renderBlockCursor(terminal: ITerminal, x: number, y: number, cell: ICellData): void {
|
||||
this._ctx.save();
|
||||
this._ctx.fillStyle = this._colors.cursor.css;
|
||||
this.fillCells(x, y, cell.width, 1);
|
||||
this.fillCells(x, y, cell.getWidth(), 1);
|
||||
this._ctx.fillStyle = this._colors.cursorAccent.css;
|
||||
this.fillCharTrueColor(terminal, cell, x, y);
|
||||
this._ctx.restore();
|
||||
@@ -215,7 +215,7 @@ export class CursorRenderLayer extends BaseRenderLayer {
|
||||
private _renderBlurCursor(terminal: ITerminal, x: number, y: number, cell: ICellData): void {
|
||||
this._ctx.save();
|
||||
this._ctx.strokeStyle = this._colors.cursor.css;
|
||||
this.strokeRectAtCell(x, y, cell.width, 1);
|
||||
this.strokeRectAtCell(x, y, cell.getWidth(), 1);
|
||||
this._ctx.restore();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ export class TextRenderLayer extends BaseRenderLayer {
|
||||
|
||||
// The character to the left is a wide character, drawing is owned by
|
||||
// the char at x-1
|
||||
if (cell.width === 0) {
|
||||
if (cell.getWidth() === 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -223,7 +223,7 @@ export class TextRenderLayer extends BaseRenderLayer {
|
||||
this._ctx.fillStyle = this._colors.ansi[cell.getFgColor()].css;
|
||||
}
|
||||
|
||||
this.fillBottomLineAtCells(x, y, cell.width);
|
||||
this.fillBottomLineAtCells(x, y, cell.getWidth());
|
||||
this._ctx.restore();
|
||||
}
|
||||
this.drawChars(terminal, cell, x, y);
|
||||
@@ -255,18 +255,20 @@ export class TextRenderLayer extends BaseRenderLayer {
|
||||
private _isOverlapping(cell: ICellData): boolean {
|
||||
// Only single cell characters can be overlapping, rendering issues can
|
||||
// occur without this check
|
||||
if (cell.width !== 1) {
|
||||
if (cell.getWidth() !== 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// We assume that any ascii character will not overlap
|
||||
if (cell.code < 256) {
|
||||
if (cell.getCode() < 256) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const chars = cell.getChars();
|
||||
|
||||
// Deliver from cache if available
|
||||
if (this._characterOverlapCache.hasOwnProperty(cell.chars)) {
|
||||
return this._characterOverlapCache[cell.chars];
|
||||
if (this._characterOverlapCache.hasOwnProperty(chars)) {
|
||||
return this._characterOverlapCache[chars];
|
||||
}
|
||||
|
||||
// Setup the font
|
||||
@@ -276,13 +278,13 @@ export class TextRenderLayer extends BaseRenderLayer {
|
||||
// Measure the width of the character, but Math.floor it
|
||||
// because that is what the renderer does when it calculates
|
||||
// the character dimensions we are comparing against
|
||||
const overlaps = Math.floor(this._ctx.measureText(cell.chars).width) > this._characterWidth;
|
||||
const overlaps = Math.floor(this._ctx.measureText(chars).width) > this._characterWidth;
|
||||
|
||||
// Restore the original context
|
||||
this._ctx.restore();
|
||||
|
||||
// Cache and return
|
||||
this._characterOverlapCache[cell.chars] = overlaps;
|
||||
this._characterOverlapCache[chars] = overlaps;
|
||||
return overlaps;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ export class DomRendererRowFactory {
|
||||
// the viewport).
|
||||
let lineLength = 0;
|
||||
for (let x = Math.min(lineData.length, cols) - 1; x >= 0; x--) {
|
||||
if (lineData.loadCell(x, this._cell).code !== NULL_CELL_CODE || (isCursorRow && x === cursorX)) {
|
||||
if (lineData.loadCell(x, this._cell).getCode() !== NULL_CELL_CODE || (isCursorRow && x === cursorX)) {
|
||||
lineLength = x + 1;
|
||||
break;
|
||||
}
|
||||
@@ -40,7 +40,7 @@ export class DomRendererRowFactory {
|
||||
|
||||
for (let x = 0; x < lineLength; x++) {
|
||||
lineData.loadCell(x, this._cell);
|
||||
const width = this._cell.width;
|
||||
const width = this._cell.getWidth();
|
||||
|
||||
// The character to the left is a wide character, drawing is owned by the char at x-1
|
||||
if (width === 0) {
|
||||
@@ -76,7 +76,7 @@ export class DomRendererRowFactory {
|
||||
charElement.classList.add(ITALIC_CLASS);
|
||||
}
|
||||
|
||||
charElement.textContent = this._cell.chars || WHITESPACE_CELL_CHAR;
|
||||
charElement.textContent = this._cell.getChars() || WHITESPACE_CELL_CHAR;
|
||||
|
||||
const swapColor = this._cell.isInverse();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user