Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/browser/MouseZoneManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ import { Disposable } from 'common/Lifecycle';
import { addDisposableDomListener } from 'browser/Lifecycle';
import { IMouseService, ISelectionService } from 'browser/services/Services';
import { IMouseZoneManager, IMouseZone } from 'browser/Types';
import { IBufferService } from 'common/services/Services';

const HOVER_DURATION = 500;
import { IBufferService, IOptionsService } from 'common/services/Services';

/**
* The MouseZoneManager allows components to register zones within the terminal
Expand Down Expand Up @@ -37,7 +35,8 @@ export class MouseZoneManager extends Disposable implements IMouseZoneManager {
private readonly _screenElement: HTMLElement,
@IBufferService private readonly _bufferService: IBufferService,
@IMouseService private readonly _mouseService: IMouseService,
@ISelectionService private readonly _selectionService: ISelectionService
@ISelectionService private readonly _selectionService: ISelectionService,
@IOptionsService private readonly _optionsService: IOptionsService
) {
super();

Expand Down Expand Up @@ -151,7 +150,7 @@ export class MouseZoneManager extends Disposable implements IMouseZoneManager {
}

// Restart the tooltip timeout
this._tooltipTimeout = <number><any>setTimeout(() => this._onTooltip(e), HOVER_DURATION);
this._tooltipTimeout = window.setTimeout(() => this._onTooltip(e), this._optionsService.options.linkTooltipHoverDuration);
}

private _onTooltip(e: MouseEvent): void {
Expand Down
1 change: 1 addition & 0 deletions src/common/services/OptionsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const DEFAULT_OPTIONS: ITerminalOptions = Object.freeze({
fontWeight: 'normal',
fontWeightBold: 'bold',
lineHeight: 1.0,
linkTooltipHoverDuration: 500,
letterSpacing: 0,
logLevel: 'info',
scrollback: 1000,
Expand Down
1 change: 1 addition & 0 deletions src/common/services/Services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ export interface ITerminalOptions {
fontWeightBold: FontWeight;
letterSpacing: number;
lineHeight: number;
linkTooltipHoverDuration: number;
logLevel: LogLevel;
macOptionIsMeta: boolean;
macOptionClickForcesSelection: boolean;
Expand Down
12 changes: 10 additions & 2 deletions typings/xterm.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ declare module 'xterm' {
fontWeightBold?: FontWeight;

/**
* The spacing in whole pixels between characters..
* The spacing in whole pixels between characters.
*/
letterSpacing?: number;

Expand All @@ -127,6 +127,13 @@ declare module 'xterm' {
*/
lineHeight?: number;

/**
* The duration in milliseconds before link tooltip events fire when
* hovering on a link.
* @deprecated This will be removed when the link matcher API is removed.
*/
linkTooltipHoverDuration?: number;

/**
* What log level to use, this will log for all levels below and including
* what is set:
Expand Down Expand Up @@ -305,7 +312,8 @@ declare module 'xterm' {
validationCallback?: (uri: string, callback: (isValid: boolean) => void) => void;

/**
* A callback that fires when the mouse hovers over a link for a moment.
* A callback that fires when the mouse hovers over a link for a period of
* time (defined by {@link ITerminalOptions.linkTooltipHoverDuration}).
*/
tooltipCallback?: (event: MouseEvent, uri: string, location: IViewportRange) => boolean | void;

Expand Down