@@ -21,7 +21,7 @@
|
||||
* http://linux.die.net/man/7/urxvt
|
||||
*/
|
||||
|
||||
import { IDecoration, IDecorationOptions, IDisposable, ILinkProvider, IMarker } from '@xterm/xterm';
|
||||
import { IDecoration, IDecorationOptions, IDisposable, ILinkProvider, IMarker, IRenderDimensions as IRenderDimensionsApi } from '@xterm/xterm';
|
||||
import { copyHandler, handlePasteEvent, moveTextAreaUnderMouseCursor, paste, rightClickHandler } from 'browser/Clipboard';
|
||||
import * as Strings from 'browser/LocalizableStrings';
|
||||
import { OscLinkProvider } from 'browser/OscLinkProvider';
|
||||
@@ -143,6 +143,26 @@ export class CoreBrowserTerminal extends CoreTerminal implements ITerminal {
|
||||
public get onA11yTab(): Event<number> { return this._onA11yTabEmitter.event; }
|
||||
private _onWillOpen = this._register(new Emitter<HTMLElement>());
|
||||
public get onWillOpen(): Event<HTMLElement> { return this._onWillOpen.event; }
|
||||
private readonly _onDimensionsChange = this._register(new Emitter<IRenderDimensionsApi>());
|
||||
public readonly onDimensionsChange = this._onDimensionsChange.event;
|
||||
|
||||
public get dimensions(): IRenderDimensionsApi | undefined {
|
||||
if (!this._renderService) {
|
||||
return undefined;
|
||||
}
|
||||
const dimensions = this._renderService.dimensions;
|
||||
return {
|
||||
css: {
|
||||
canvas: { ...dimensions.css.canvas },
|
||||
cell: { ...dimensions.css.cell }
|
||||
},
|
||||
device: {
|
||||
canvas: { ...dimensions.device.canvas },
|
||||
cell: { ...dimensions.device.cell },
|
||||
char: { ...dimensions.device.char }
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
constructor(
|
||||
options: Partial<ITerminalOptions> = {}
|
||||
@@ -476,6 +496,17 @@ export class CoreBrowserTerminal extends CoreTerminal implements ITerminal {
|
||||
this._renderService = this._register(this._instantiationService.createInstance(RenderService, this.rows, this.screenElement));
|
||||
this._instantiationService.setService(IRenderService, this._renderService);
|
||||
this._register(this._renderService.onRenderedViewportChange(e => this._onRender.fire(e)));
|
||||
this._register(this._renderService.onDimensionsChange(e => this._onDimensionsChange.fire({
|
||||
css: {
|
||||
canvas: { ...e.css.canvas },
|
||||
cell: { ...e.css.cell }
|
||||
},
|
||||
device: {
|
||||
canvas: { ...e.device.canvas },
|
||||
cell: { ...e.device.cell },
|
||||
char: { ...e.device.char }
|
||||
}
|
||||
})));
|
||||
this.onResize(e => this._renderService!.resize(e.cols, e.rows));
|
||||
|
||||
this._compositionView = this._document.createElement('div');
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
import { IDisposable, IMarker, ILinkProvider, IDecorationOptions, IDecoration } from '@xterm/xterm';
|
||||
import { IDisposable, IMarker, ILinkProvider, IDecorationOptions, IDecoration, IRenderDimensions as IRenderDimensionsApi } from '@xterm/xterm';
|
||||
import { ICharacterJoinerService, ICharSizeService, ICoreBrowserService, IMouseService, IRenderService, ISelectionService, IThemeService } from 'browser/services/Services';
|
||||
import { IRenderDimensions, IRenderer, IRequestRedrawEvent } from 'browser/renderer/shared/Types';
|
||||
import { IColorSet, ITerminal, ILinkifier2, IBrowser, IViewport, ICompositionHelper, CharacterJoinerHandler, IBufferRange, ReadonlyColorSet, IBufferElementProvider } from 'browser/Types';
|
||||
@@ -47,6 +47,8 @@ export class MockTerminal implements ITerminal {
|
||||
public onKey!: Event<{ key: string, domEvent: KeyboardEvent }>;
|
||||
public onRender!: Event<{ start: number, end: number }>;
|
||||
public onResize!: Event<{ cols: number, rows: number }>;
|
||||
public onDimensionsChange!: Event<IRenderDimensionsApi>;
|
||||
public dimensions: IRenderDimensionsApi | undefined;
|
||||
public markers!: IMarker[];
|
||||
public linkifier: ILinkifier2 | undefined;
|
||||
public coreMouseService!: ICoreMouseService;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import { CharData, IColor, ICoreTerminal, ITerminalOptions } from 'common/Types';
|
||||
import { IBuffer } from 'common/buffer/Types';
|
||||
import { IDisposable, Terminal as ITerminalApi } from '@xterm/xterm';
|
||||
import { IDisposable, IRenderDimensions as IRenderDimensionsApi, Terminal as ITerminalApi } from '@xterm/xterm';
|
||||
import { channels, css } from 'common/Color';
|
||||
import type { Event } from 'vs/base/common/event';
|
||||
|
||||
@@ -21,8 +21,11 @@ export interface ITerminal extends InternalPassthroughApis, ICoreTerminal {
|
||||
linkifier: ILinkifier2 | undefined;
|
||||
options: Required<ITerminalOptions>;
|
||||
|
||||
readonly dimensions: IRenderDimensionsApi | undefined;
|
||||
|
||||
onBlur: Event<void>;
|
||||
onFocus: Event<void>;
|
||||
onDimensionsChange: Event<IRenderDimensionsApi>;
|
||||
onA11yChar: Event<string>;
|
||||
onA11yTab: Event<number>;
|
||||
onWillOpen: Event<HTMLElement>;
|
||||
|
||||
@@ -12,7 +12,7 @@ import { AddonManager } from 'common/public/AddonManager';
|
||||
import { BufferNamespaceApi } from 'common/public/BufferNamespaceApi';
|
||||
import { ParserApi } from 'common/public/ParserApi';
|
||||
import { UnicodeApi } from 'common/public/UnicodeApi';
|
||||
import { IBufferNamespace as IBufferNamespaceApi, IDecoration, IDecorationOptions, IDisposable, ILinkProvider, ILocalizableStrings, IMarker, IModes, IParser, ITerminalAddon, Terminal as ITerminalApi, ITerminalInitOnlyOptions, IUnicodeHandling } from '@xterm/xterm';
|
||||
import { IBufferNamespace as IBufferNamespaceApi, IDecoration, IDecorationOptions, IDisposable, ILinkProvider, ILocalizableStrings, IMarker, IModes, IParser, IRenderDimensions, ITerminalAddon, Terminal as ITerminalApi, ITerminalInitOnlyOptions, IUnicodeHandling } from '@xterm/xterm';
|
||||
import type { Event } from 'vs/base/common/event';
|
||||
|
||||
/**
|
||||
@@ -80,6 +80,7 @@ export class Terminal extends Disposable implements ITerminalApi {
|
||||
public get onSelectionChange(): Event<void> { return this._core.onSelectionChange; }
|
||||
public get onTitleChange(): Event<string> { return this._core.onTitleChange; }
|
||||
public get onWriteParsed(): Event<void> { return this._core.onWriteParsed; }
|
||||
public get onDimensionsChange(): Event<IRenderDimensions> { return this._core.onDimensionsChange; }
|
||||
|
||||
public get element(): HTMLElement | undefined { return this._core.element; }
|
||||
public get parser(): IParser {
|
||||
@@ -127,6 +128,9 @@ export class Terminal extends Disposable implements ITerminalApi {
|
||||
wraparoundMode: m.wraparound
|
||||
};
|
||||
}
|
||||
public get dimensions(): IRenderDimensions | undefined {
|
||||
return this._core.dimensions;
|
||||
}
|
||||
public get options(): Required<ITerminalOptions> {
|
||||
return this._publicOptions;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user