Polish
This commit is contained in:
@@ -20,6 +20,10 @@ export const enum FLAGS {
|
|||||||
ITALIC = 64
|
ITALIC = 64
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Note that IRenderer implementations should emit the refresh event after
|
||||||
|
* rendering rows to the screen.
|
||||||
|
*/
|
||||||
export interface IRenderer extends IEventEmitter {
|
export interface IRenderer extends IEventEmitter {
|
||||||
dimensions: IRenderDimensions;
|
dimensions: IRenderDimensions;
|
||||||
colorManager: IColorManager;
|
colorManager: IColorManager;
|
||||||
|
|||||||
@@ -96,7 +96,6 @@ export class DomRenderer extends EventEmitter implements IRenderer {
|
|||||||
element.style.height = `${this._terminal.charMeasure.height}px`;
|
element.style.height = `${this._terminal.charMeasure.height}px`;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
if (!this._dimensionsStyleElement) {
|
if (!this._dimensionsStyleElement) {
|
||||||
this._dimensionsStyleElement = document.createElement('style');
|
this._dimensionsStyleElement = document.createElement('style');
|
||||||
this._terminal.screenElement.appendChild(this._dimensionsStyleElement);
|
this._terminal.screenElement.appendChild(this._dimensionsStyleElement);
|
||||||
@@ -130,7 +129,7 @@ export class DomRenderer extends EventEmitter implements IRenderer {
|
|||||||
`.xterm .${ROW_CONTAINER_CLASS} {` +
|
`.xterm .${ROW_CONTAINER_CLASS} {` +
|
||||||
` color: ${this.colorManager.colors.foreground.css};` +
|
` color: ${this.colorManager.colors.foreground.css};` +
|
||||||
` background-color: ${this.colorManager.colors.background.css};` +
|
` background-color: ${this.colorManager.colors.background.css};` +
|
||||||
`}`;;
|
`}`;
|
||||||
// Text styles
|
// Text styles
|
||||||
styles +=
|
styles +=
|
||||||
`.xterm span:not(.${BOLD_CLASS}) {` +
|
`.xterm span:not(.${BOLD_CLASS}) {` +
|
||||||
@@ -296,13 +295,11 @@ export class DomRenderer extends EventEmitter implements IRenderer {
|
|||||||
const line = terminal.buffer.lines.get(row);
|
const line = terminal.buffer.lines.get(row);
|
||||||
for (let x = 0; x < terminal.cols; x++) {
|
for (let x = 0; x < terminal.cols; x++) {
|
||||||
const charData = line[x];
|
const charData = line[x];
|
||||||
// const code: number = <number>charData[CHAR_DATA_CODE_INDEX];
|
|
||||||
const char: string = charData[CHAR_DATA_CHAR_INDEX];
|
const char: string = charData[CHAR_DATA_CHAR_INDEX];
|
||||||
const attr: number = charData[CHAR_DATA_ATTR_INDEX];
|
const attr: number = charData[CHAR_DATA_ATTR_INDEX];
|
||||||
let width: number = charData[CHAR_DATA_WIDTH_INDEX];
|
let width: number = charData[CHAR_DATA_WIDTH_INDEX];
|
||||||
|
|
||||||
// The character to the left is a wide character, drawing is owned by
|
// The character to the left is a wide character, drawing is owned by the char at x-1
|
||||||
// the char at x-1
|
|
||||||
if (width === 0) {
|
if (width === 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -335,7 +332,6 @@ export class DomRenderer extends EventEmitter implements IRenderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (flags & FLAGS.BOLD) {
|
if (flags & FLAGS.BOLD) {
|
||||||
// TODO: Support option that turns bold->bright off
|
|
||||||
// Convert the FG color to the bold variant
|
// Convert the FG color to the bold variant
|
||||||
if (fg < 8) {
|
if (fg < 8) {
|
||||||
fg += 8;
|
fg += 8;
|
||||||
@@ -348,11 +344,9 @@ export class DomRenderer extends EventEmitter implements IRenderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
charElement.textContent = char;
|
charElement.textContent = char;
|
||||||
// TODO: Make 257 a constant
|
|
||||||
if (fg !== 257) {
|
if (fg !== 257) {
|
||||||
charElement.classList.add(`xterm-fg-${fg}`);
|
charElement.classList.add(`xterm-fg-${fg}`);
|
||||||
}
|
}
|
||||||
// TODO: Make 256 a constant
|
|
||||||
if (bg !== 256) {
|
if (bg !== 256) {
|
||||||
charElement.classList.add(`xterm-bg-${bg}`);
|
charElement.classList.add(`xterm-bg-${bg}`);
|
||||||
}
|
}
|
||||||
@@ -360,7 +354,6 @@ export class DomRenderer extends EventEmitter implements IRenderer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Document that IRenderer needs to emit this?
|
|
||||||
this._terminal.emit('refresh', {start, end});
|
this._terminal.emit('refresh', {start, end});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user