Merge pull request #4210 from Tyriar/todo_type_tabs
Fix a bunch of TODOs
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ICharacterJoinerService, ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';
|
import { ICharacterJoinerService, ICharSizeService, ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';
|
||||||
import { ITerminal } from 'browser/Types';
|
import { ITerminal } from 'browser/Types';
|
||||||
import { EventEmitter, forwardEvent } from 'common/EventEmitter';
|
import { EventEmitter, forwardEvent } from 'common/EventEmitter';
|
||||||
import { Disposable, toDisposable } from 'common/Lifecycle';
|
import { Disposable, toDisposable } from 'common/Lifecycle';
|
||||||
@@ -46,11 +46,22 @@ export class WebglAddon extends Disposable implements ITerminalAddon {
|
|||||||
const unsafeCore = core as any;
|
const unsafeCore = core as any;
|
||||||
const renderService: IRenderService = unsafeCore._renderService;
|
const renderService: IRenderService = unsafeCore._renderService;
|
||||||
const characterJoinerService: ICharacterJoinerService = unsafeCore._characterJoinerService;
|
const characterJoinerService: ICharacterJoinerService = unsafeCore._characterJoinerService;
|
||||||
|
const charSizeService: ICharSizeService = unsafeCore._charSizeService;
|
||||||
const coreBrowserService: ICoreBrowserService = unsafeCore._coreBrowserService;
|
const coreBrowserService: ICoreBrowserService = unsafeCore._coreBrowserService;
|
||||||
const decorationService: IDecorationService = unsafeCore._decorationService;
|
const decorationService: IDecorationService = unsafeCore._decorationService;
|
||||||
const themeService: IThemeService = unsafeCore._themeService;
|
const themeService: IThemeService = unsafeCore._themeService;
|
||||||
|
|
||||||
this._renderer = this.register(new WebglRenderer(terminal, themeService, characterJoinerService, coreBrowserService, optionsService, coreService, decorationService, this._preserveDrawingBuffer));
|
this._renderer = this.register(new WebglRenderer(
|
||||||
|
terminal,
|
||||||
|
characterJoinerService,
|
||||||
|
charSizeService,
|
||||||
|
coreBrowserService,
|
||||||
|
coreService,
|
||||||
|
decorationService,
|
||||||
|
optionsService,
|
||||||
|
themeService,
|
||||||
|
this._preserveDrawingBuffer
|
||||||
|
));
|
||||||
this.register(forwardEvent(this._renderer.onContextLoss, this._onContextLoss));
|
this.register(forwardEvent(this._renderer.onContextLoss, this._onContextLoss));
|
||||||
this.register(forwardEvent(this._renderer.onChangeTextureAtlas, this._onChangeTextureAtlas));
|
this.register(forwardEvent(this._renderer.onChangeTextureAtlas, this._onChangeTextureAtlas));
|
||||||
renderService.setRenderer(this._renderer);
|
renderService.setRenderer(this._renderer);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { acquireTextureAtlas, removeTerminalFromCache } from 'browser/renderer/s
|
|||||||
import { observeDevicePixelDimensions } from 'browser/renderer/shared/DevicePixelObserver';
|
import { observeDevicePixelDimensions } from 'browser/renderer/shared/DevicePixelObserver';
|
||||||
import { createRenderDimensions } from 'browser/renderer/shared/RendererUtils';
|
import { createRenderDimensions } from 'browser/renderer/shared/RendererUtils';
|
||||||
import { IRenderDimensions, IRenderer, IRequestRedrawEvent, ITextureAtlas } from 'browser/renderer/shared/Types';
|
import { IRenderDimensions, IRenderer, IRequestRedrawEvent, ITextureAtlas } from 'browser/renderer/shared/Types';
|
||||||
import { ICharacterJoinerService, ICoreBrowserService, IThemeService } from 'browser/services/Services';
|
import { ICharacterJoinerService, ICharSizeService, ICoreBrowserService, IThemeService } from 'browser/services/Services';
|
||||||
import { ITerminal } from 'browser/Types';
|
import { ITerminal } from 'browser/Types';
|
||||||
import { AttributeData } from 'common/buffer/AttributeData';
|
import { AttributeData } from 'common/buffer/AttributeData';
|
||||||
import { CellData } from 'common/buffer/CellData';
|
import { CellData } from 'common/buffer/CellData';
|
||||||
@@ -56,12 +56,13 @@ export class WebglRenderer extends Disposable implements IRenderer {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private _terminal: Terminal,
|
private _terminal: Terminal,
|
||||||
private readonly _themeService: IThemeService,
|
|
||||||
private readonly _characterJoinerService: ICharacterJoinerService,
|
private readonly _characterJoinerService: ICharacterJoinerService,
|
||||||
|
private readonly _charSizeService: ICharSizeService,
|
||||||
private readonly _coreBrowserService: ICoreBrowserService,
|
private readonly _coreBrowserService: ICoreBrowserService,
|
||||||
optionsService: IOptionsService,
|
|
||||||
coreService: ICoreService,
|
coreService: ICoreService,
|
||||||
private readonly _decorationService: IDecorationService,
|
private readonly _decorationService: IDecorationService,
|
||||||
|
optionsService: IOptionsService,
|
||||||
|
private readonly _themeService: IThemeService,
|
||||||
preserveDrawingBuffer?: boolean
|
preserveDrawingBuffer?: boolean
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
@@ -302,7 +303,7 @@ export class WebglRenderer extends Disposable implements IRenderer {
|
|||||||
|
|
||||||
public renderRows(start: number, end: number): void {
|
public renderRows(start: number, end: number): void {
|
||||||
if (!this._isAttached) {
|
if (!this._isAttached) {
|
||||||
if (this._coreBrowserService.window.document.body.contains(this._core.screenElement!) && (this._core as any)._charSizeService.width && (this._core as any)._charSizeService.height) {
|
if (this._coreBrowserService.window.document.body.contains(this._core.screenElement!) && this._charSizeService.width && this._charSizeService.height) {
|
||||||
this._updateDimensions();
|
this._updateDimensions();
|
||||||
this._refreshCharAtlas();
|
this._refreshCharAtlas();
|
||||||
this._isAttached = true;
|
this._isAttached = true;
|
||||||
@@ -440,21 +441,19 @@ export class WebglRenderer extends Disposable implements IRenderer {
|
|||||||
* Recalculates the character and canvas dimensions.
|
* Recalculates the character and canvas dimensions.
|
||||||
*/
|
*/
|
||||||
private _updateDimensions(): void {
|
private _updateDimensions(): void {
|
||||||
// TODO: Acquire CharSizeService properly
|
|
||||||
|
|
||||||
// Perform a new measure if the CharMeasure dimensions are not yet available
|
// Perform a new measure if the CharMeasure dimensions are not yet available
|
||||||
if (!(this._core as any)._charSizeService.width || !(this._core as any)._charSizeService.height) {
|
if (!this._charSizeService.width || !this._charSizeService.height) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate the device character width. Width is floored as it must be drawn to an integer grid
|
// Calculate the device character width. Width is floored as it must be drawn to an integer grid
|
||||||
// in order for the char atlas glyphs to not be blurry.
|
// in order for the char atlas glyphs to not be blurry.
|
||||||
this.dimensions.device.char.width = Math.floor((this._core as any)._charSizeService.width * this._devicePixelRatio);
|
this.dimensions.device.char.width = Math.floor(this._charSizeService.width * this._devicePixelRatio);
|
||||||
|
|
||||||
// Calculate the device character height. Height is ceiled in case devicePixelRatio is a
|
// Calculate the device character height. Height is ceiled in case devicePixelRatio is a
|
||||||
// floating point number in order to ensure there is enough space to draw the character to the
|
// floating point number in order to ensure there is enough space to draw the character to the
|
||||||
// cell.
|
// cell.
|
||||||
this.dimensions.device.char.height = Math.ceil((this._core as any)._charSizeService.height * this._devicePixelRatio);
|
this.dimensions.device.char.height = Math.ceil(this._charSizeService.height * this._devicePixelRatio);
|
||||||
|
|
||||||
// Calculate the device cell height, if lineHeight is _not_ 1, the resulting value will be
|
// Calculate the device cell height, if lineHeight is _not_ 1, the resulting value will be
|
||||||
// floored since lineHeight can never be lower then 1, this guarentees the device cell height
|
// floored since lineHeight can never be lower then 1, this guarentees the device cell height
|
||||||
|
|||||||
+1
-2
@@ -248,8 +248,7 @@ function createTerminal(): void {
|
|||||||
addons.fit.instance = new FitAddon();
|
addons.fit.instance = new FitAddon();
|
||||||
addons.unicode11.instance = new Unicode11Addon();
|
addons.unicode11.instance = new Unicode11Addon();
|
||||||
addons.webgl.instance = new WebglAddon();
|
addons.webgl.instance = new WebglAddon();
|
||||||
// TODO: Remove arguments when link provider API is the default
|
addons['web-links'].instance = new WebLinksAddon();
|
||||||
addons['web-links'].instance = new WebLinksAddon(undefined, undefined, true);
|
|
||||||
typedTerm.loadAddon(addons.fit.instance);
|
typedTerm.loadAddon(addons.fit.instance);
|
||||||
typedTerm.loadAddon(addons.search.instance);
|
typedTerm.loadAddon(addons.search.instance);
|
||||||
typedTerm.loadAddon(addons.serialize.instance);
|
typedTerm.loadAddon(addons.serialize.instance);
|
||||||
|
|||||||
@@ -190,8 +190,6 @@ export class OverviewRulerRenderer extends Disposable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _renderColorZone(zone: IColorZone): void {
|
private _renderColorZone(zone: IColorZone): void {
|
||||||
// TODO: Is _decorationElements needed?
|
|
||||||
|
|
||||||
this._ctx.fillStyle = zone.color;
|
this._ctx.fillStyle = zone.color;
|
||||||
this._ctx.fillRect(
|
this._ctx.fillRect(
|
||||||
/* x */ drawX[zone.position || 'full'],
|
/* x */ drawX[zone.position || 'full'],
|
||||||
|
|||||||
@@ -32,8 +32,7 @@ export class Buffer implements IBuffer {
|
|||||||
public x: number = 0;
|
public x: number = 0;
|
||||||
public scrollBottom: number;
|
public scrollBottom: number;
|
||||||
public scrollTop: number;
|
public scrollTop: number;
|
||||||
// TODO: Type me
|
public tabs: { [column: number]: boolean | undefined } = {};
|
||||||
public tabs: any;
|
|
||||||
public savedY: number = 0;
|
public savedY: number = 0;
|
||||||
public savedX: number = 0;
|
public savedX: number = 0;
|
||||||
public savedCurAttrData = DEFAULT_ATTR_DATA.clone();
|
public savedCurAttrData = DEFAULT_ATTR_DATA.clone();
|
||||||
|
|||||||
Reference in New Issue
Block a user