]> git.proxmox.com Git - mirror_xterm.js.git/blobdiff - src/Interfaces.ts
Merge pull request #746 from Tyriar/745_colon_word_sep
[mirror_xterm.js.git] / src / Interfaces.ts
index 92094c9553a820042d8a16bb0d7d8e5292adab45..4b8576742d07a76bebabd643a2b8cd55f87b4860 100644 (file)
@@ -2,6 +2,9 @@
  * @license MIT
  */
 
+import { LinkMatcherOptions } from './Interfaces';
+import { LinkMatcherHandler, LinkMatcherValidationCallback } from './Types';
+
 export interface IBrowser {
   isNode: boolean;
   userAgent: string;
@@ -17,6 +20,8 @@ export interface IBrowser {
 export interface ITerminal {
   element: HTMLElement;
   rowContainer: HTMLElement;
+  selectionContainer: HTMLElement;
+  charMeasure: ICharMeasure;
   textarea: HTMLTextAreaElement;
   ybase: number;
   ydisp: number;
@@ -44,12 +49,23 @@ export interface ITerminal {
   emit(event: string, data: any);
 }
 
+export interface ISelectionManager {
+  selectionText: string;
+}
+
 export interface ICharMeasure {
   width: number;
   height: number;
   measure(): void;
 }
 
+export interface ILinkifier {
+  linkifyRow(rowIndex: number): void;
+  attachHypertextLinkHandler(handler: LinkMatcherHandler): void;
+  registerLinkMatcher(regex: RegExp, handler: LinkMatcherHandler, options?: LinkMatcherOptions): number;
+  deregisterLinkMatcher(matcherId: number): boolean;
+}
+
 interface ICircularList<T> {
   length: number;
   maxLength: number;
@@ -64,6 +80,25 @@ interface ICircularList<T> {
   shiftElements(start: number, count: number, offset: number): void;
 }
 
+export interface LinkMatcherOptions {
+  /**
+   * The index of the link from the regex.match(text) call. This defaults to 0
+   * (for regular expressions without capture groups).
+   */
+  matchIndex?: number;
+  /**
+   * A callback that validates an individual link, returning true if valid and
+   * false if invalid.
+   */
+  validationCallback?: LinkMatcherValidationCallback;
+  /**
+   * The priority of the link matcher, this defines the order in which the link
+   * matcher is evaluated relative to others, from highest to lowest. The
+   * default value is 0.
+   */
+  priority?: number;
+}
+
 /**
  * Handles actions generated by the parser.
  */