Remove circular dependency
This commit is contained in:
@@ -75,7 +75,7 @@ export class DomRenderer extends EventEmitter implements IRenderer {
|
|||||||
this._updateDimensions();
|
this._updateDimensions();
|
||||||
|
|
||||||
this._renderDebouncer = new RenderDebouncer(this._terminal, this._renderRows.bind(this));
|
this._renderDebouncer = new RenderDebouncer(this._terminal, this._renderRows.bind(this));
|
||||||
this._rowFactory = new DomRendererRowFactory(_terminal, document);
|
this._rowFactory = new DomRendererRowFactory(_terminal.options, document);
|
||||||
|
|
||||||
this._terminal.element.classList.add(TERMINAL_CLASS_PREFIX + this._terminalClass);
|
this._terminal.element.classList.add(TERMINAL_CLASS_PREFIX + this._terminalClass);
|
||||||
this._terminal.screenElement.appendChild(this._rowContainer);
|
this._terminal.screenElement.appendChild(this._rowContainer);
|
||||||
|
|||||||
@@ -9,24 +9,22 @@ import { DomRendererRowFactory } from './DomRendererRowFactory';
|
|||||||
import { DEFAULT_ATTR, NULL_CELL_CODE, NULL_CELL_WIDTH, NULL_CELL_CHAR } from '../../Buffer';
|
import { DEFAULT_ATTR, NULL_CELL_CODE, NULL_CELL_WIDTH, NULL_CELL_CHAR } from '../../Buffer';
|
||||||
import { FLAGS } from '../Types';
|
import { FLAGS } from '../Types';
|
||||||
import { BufferLine } from '../../BufferLine';
|
import { BufferLine } from '../../BufferLine';
|
||||||
import { IBufferLine, ITerminal } from '../../Types';
|
import { IBufferLine, ITerminalOptions } from '../../Types';
|
||||||
import { DEFAULT_COLOR } from '../atlas/Types';
|
import { DEFAULT_COLOR } from '../atlas/Types';
|
||||||
import { MockTerminal } from '../../ui/TestUtils.test';
|
|
||||||
|
|
||||||
describe('DomRendererRowFactory', () => {
|
describe('DomRendererRowFactory', () => {
|
||||||
let dom: jsdom.JSDOM;
|
let dom: jsdom.JSDOM;
|
||||||
let term: ITerminal;
|
const options: ITerminalOptions = {};
|
||||||
let rowFactory: DomRendererRowFactory;
|
let rowFactory: DomRendererRowFactory;
|
||||||
let lineData: IBufferLine;
|
let lineData: IBufferLine;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
dom = new jsdom.JSDOM('');
|
dom = new jsdom.JSDOM('');
|
||||||
|
|
||||||
term = new MockTerminal();
|
options.enableBold = true;
|
||||||
term.options.enableBold = true;
|
options.drawBoldTextInBrightColors = true;
|
||||||
term.options.drawBoldTextInBrightColors = true;
|
|
||||||
|
|
||||||
rowFactory = new DomRendererRowFactory(term, dom.window.document);
|
rowFactory = new DomRendererRowFactory(options, dom.window.document);
|
||||||
lineData = createEmptyLineData(2);
|
lineData = createEmptyLineData(2);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { CHAR_DATA_CHAR_INDEX, CHAR_DATA_ATTR_INDEX, CHAR_DATA_WIDTH_INDEX, CHAR_DATA_CODE_INDEX, NULL_CELL_CODE, WHITESPACE_CELL_CHAR } from '../../Buffer';
|
import { CHAR_DATA_CHAR_INDEX, CHAR_DATA_ATTR_INDEX, CHAR_DATA_WIDTH_INDEX, CHAR_DATA_CODE_INDEX, NULL_CELL_CODE, WHITESPACE_CELL_CHAR } from '../../Buffer';
|
||||||
import { FLAGS } from '../Types';
|
import { FLAGS } from '../Types';
|
||||||
import { IBufferLine, ITerminal } from '../../Types';
|
import { IBufferLine, ITerminalOptions } from '../../Types';
|
||||||
import { DEFAULT_COLOR, INVERTED_DEFAULT_COLOR } from '../atlas/Types';
|
import { DEFAULT_COLOR, INVERTED_DEFAULT_COLOR } from '../atlas/Types';
|
||||||
|
|
||||||
export const BOLD_CLASS = 'xterm-bold';
|
export const BOLD_CLASS = 'xterm-bold';
|
||||||
@@ -17,7 +17,7 @@ export const CURSOR_STYLE_UNDERLINE_CLASS = 'xterm-cursor-underline';
|
|||||||
|
|
||||||
export class DomRendererRowFactory {
|
export class DomRendererRowFactory {
|
||||||
constructor(
|
constructor(
|
||||||
private _terminal: ITerminal,
|
private _terminalOptions: ITerminalOptions,
|
||||||
private _document: Document
|
private _document: Document
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
@@ -89,10 +89,10 @@ export class DomRendererRowFactory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & FLAGS.BOLD && this._terminal.options.enableBold) {
|
if (flags & FLAGS.BOLD && this._terminalOptions.enableBold) {
|
||||||
// Convert the FG color to the bold variant. This should not happen when
|
// Convert the FG color to the bold variant. This should not happen when
|
||||||
// the fg is the inverse default color as there is no bold variant.
|
// the fg is the inverse default color as there is no bold variant.
|
||||||
if (fg < 8 && this._terminal.options.drawBoldTextInBrightColors) {
|
if (fg < 8 && this._terminalOptions.drawBoldTextInBrightColors) {
|
||||||
fg += 8;
|
fg += 8;
|
||||||
}
|
}
|
||||||
charElement.classList.add(BOLD_CLASS);
|
charElement.classList.add(BOLD_CLASS);
|
||||||
|
|||||||
Reference in New Issue
Block a user