Fix feedback

This commit is contained in:
Daniel Imms
2019-04-01 00:01:41 -07:00
parent 69f8700557
commit 5c8c680dac
11 changed files with 98 additions and 94 deletions
+6 -6
View File
@@ -6,7 +6,7 @@ export class CharacterJoinerRegistry implements ICharacterJoinerRegistry {
private _characterJoiners: ICharacterJoiner[] = [];
private _nextCharacterJoinerId: number = 0;
private _cell: CellData = new CellData();
private _workCell: CellData = new CellData();
constructor(private _terminal: ITerminal) {
}
@@ -52,13 +52,13 @@ export class CharacterJoinerRegistry implements ICharacterJoinerRegistry {
let rangeStartColumn = 0;
let currentStringIndex = 0;
let rangeStartStringIndex = 0;
let rangeAttr = line.getFG(0) >> 9;
let rangeAttr = line.getFg(0) >> 9;
for (let x = 0; x < this._terminal.cols; x++) {
line.loadCell(x, this._cell);
const chars = this._cell.getChars();
const width = this._cell.getWidth();
const attr = this._cell.fg >> 9;
line.loadCell(x, this._workCell);
const chars = this._workCell.getChars();
const width = this._workCell.getWidth();
const attr = this._workCell.fg >> 9;
if (width === 0) {
// If this character is of width 0, skip it.
+7 -7
View File
@@ -25,7 +25,7 @@ export class TextRenderLayer extends BaseRenderLayer {
private _characterFont: string;
private _characterOverlapCache: { [key: string]: boolean } = {};
private _characterJoinerRegistry: ICharacterJoinerRegistry;
private _cell = new CellData();
private _workCell = new CellData();
constructor(container: HTMLElement, zIndex: number, colors: IColorSet, characterJoinerRegistry: ICharacterJoinerRegistry, alpha: boolean) {
super(container, 'text', zIndex, alpha, colors);
@@ -74,14 +74,14 @@ export class TextRenderLayer extends BaseRenderLayer {
const line = terminal.buffer.lines.get(row);
const joinedRanges = joinerRegistry ? joinerRegistry.getJoinedCharacters(row) : [];
for (let x = 0; x < terminal.cols; x++) {
(line as any).loadCell(x, this._cell);
let code: number = this._cell.getCode() || WHITESPACE_CELL_CODE;
line.loadCell(x, this._workCell);
let code: number = this._workCell.getCode() || WHITESPACE_CELL_CODE;
// Can either represent character(s) for a single cell or multiple cells
// if indicated by a character joiner.
let chars = this._cell.getChars() || WHITESPACE_CELL_CHAR;
const attr = this._cell.fg;
let width = this._cell.getWidth();
let chars = this._workCell.getChars() || WHITESPACE_CELL_CHAR;
const attr = this._workCell.fg;
let width = this._workCell.getWidth();
// If true, indicates that the current character(s) to draw were joined.
let isJoined = false;
@@ -127,7 +127,7 @@ export class TextRenderLayer extends BaseRenderLayer {
// get removed, and `a` would not re-render because it thinks it's
// already in the correct state.
// this._state.cache[x][y] = OVERLAP_OWNED_CHAR_DATA;
if (lastCharX < line.length - 1 && line.loadCell(lastCharX + 1, this._cell).getCode() === NULL_CELL_CODE) {
if (lastCharX < line.length - 1 && line.loadCell(lastCharX + 1, this._workCell).getCode() === NULL_CELL_CODE) {
width = 2;
// this._clearChar(x + 1, y);
// The overlapping char's char data will force a clear and render when the
+7 -6
View File
@@ -18,7 +18,8 @@ export const CURSOR_STYLE_BAR_CLASS = 'xterm-cursor-bar';
export const CURSOR_STYLE_UNDERLINE_CLASS = 'xterm-cursor-underline';
export class DomRendererRowFactory {
private _cell: CellData = new CellData();
private _workCell: CellData = new CellData();
constructor(
private _terminalOptions: ITerminalOptions,
private _document: Document
@@ -35,16 +36,16 @@ 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).getCode() !== NULL_CELL_CODE || (isCursorRow && x === cursorX)) {
if (lineData.loadCell(x, this._workCell).getCode() !== NULL_CELL_CODE || (isCursorRow && x === cursorX)) {
lineLength = x + 1;
break;
}
}
for (let x = 0; x < lineLength; x++) {
lineData.loadCell(x, this._cell);
const attr = this._cell.fg;
const width = this._cell.getWidth();
lineData.loadCell(x, this._workCell);
const attr = this._workCell.fg;
const width = this._workCell.getWidth();
// The character to the left is a wide character, drawing is owned by the char at x-1
if (width === 0) {
@@ -106,7 +107,7 @@ export class DomRendererRowFactory {
charElement.classList.add(ITALIC_CLASS);
}
charElement.textContent = this._cell.getChars() || WHITESPACE_CELL_CHAR;
charElement.textContent = this._workCell.getChars() || WHITESPACE_CELL_CHAR;
if (fg !== DEFAULT_COLOR) {
charElement.classList.add(`xterm-fg-${fg}`);
}