linkHandler option and default handler

This commit is contained in:
Daniel Imms
2022-08-07 07:35:46 -07:00
parent ace99d125d
commit d9b8c6a838
6 changed files with 72 additions and 10 deletions
+1
View File
@@ -24,6 +24,7 @@ export const DEFAULT_OPTIONS: Readonly<ITerminalOptions> = {
fontWeightBold: 'bold',
lineHeight: 1.0,
letterSpacing: 0,
linkHandler: null,
logLevel: 'info',
scrollback: 1000,
scrollSensitivity: 1,
+2 -2
View File
@@ -24,7 +24,6 @@ export class OscLinkService implements IOscLinkService {
}
public registerLink(data: IOscLinkData): number {
// TODO: Extend range where appropriate
const buffer = this._bufferService.buffer;
// Links with no id will only ever be registered a single time
@@ -39,6 +38,7 @@ export class OscLinkService implements IOscLinkService {
return entry.id;
}
// Add the line to the link if it already exists
const castData = data as Required<IOscLinkData>;
const key = this._getEntryIdKey(castData);
const match = this._entriesWithId.get(key);
@@ -47,6 +47,7 @@ export class OscLinkService implements IOscLinkService {
return match.id;
}
// Create the link
const entry: IOscLinkEntryWithId = {
id: this._nextId++,
key: this._getEntryIdKey(castData),
@@ -64,7 +65,6 @@ export class OscLinkService implements IOscLinkService {
return;
}
if (link.lines.every(e => e.line !== y)) {
console.log(' add new line', y);
link.lines.push(this._bufferService.buffer.addMarker(y));
}
}
+2 -1
View File
@@ -7,7 +7,7 @@ import { IEvent, IEventEmitter } from 'common/EventEmitter';
import { IBuffer, IBufferSet } from 'common/buffer/Types';
import { IDecPrivateModes, ICoreMouseEvent, CoreMouseEncoding, ICoreMouseProtocol, CoreMouseEventType, ICharset, IWindowOptions, IModes, IAttributeData, ScrollSource, IDisposable, IColorRGB, IColor, CursorStyle, IOscLinkData } from 'common/Types';
import { createDecorator } from 'common/services/ServiceRegistry';
import { IDecorationOptions, IDecoration } from 'xterm';
import { IDecorationOptions, IDecoration, ILinkHandler } from 'xterm';
export const IBufferService = createDecorator<IBufferService>('BufferService');
export interface IBufferService {
@@ -223,6 +223,7 @@ export interface ITerminalOptions {
fontWeightBold: FontWeight;
letterSpacing: number;
lineHeight: number;
linkHandler: ILinkHandler | null;
logLevel: LogLevel;
macOptionIsMeta: boolean;
macOptionClickForcesSelection: boolean;