@xterm/addon-search 0.16.0-beta.7 → 0.16.0-beta.70

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,8 +5,8 @@
5
5
 
6
6
  import type { Terminal, IDisposable, ITerminalAddon, IDecoration } from '@xterm/xterm';
7
7
  import type { SearchAddon as ISearchApi } from '@xterm/addon-search';
8
- import { EventEmitter } from 'common/EventEmitter';
9
- import { Disposable, toDisposable, disposeArray, MutableDisposable, getDisposeArrayDisposable } from 'common/Lifecycle';
8
+ import { Emitter } from 'vs/base/common/event';
9
+ import { combinedDisposable, Disposable, dispose, MutableDisposable, toDisposable } from 'vs/base/common/lifecycle';
10
10
 
11
11
  export interface ISearchOptions {
12
12
  regex?: boolean;
@@ -67,7 +67,7 @@ export class SearchAddon extends Disposable implements ITerminalAddon , ISearchA
67
67
  private _cachedSearchTerm: string | undefined;
68
68
  private _highlightedLines: Set<number> = new Set();
69
69
  private _highlightDecorations: IHighlight[] = [];
70
- private _selectedDecoration: MutableDisposable<IHighlight> = this.register(new MutableDisposable());
70
+ private _selectedDecoration: MutableDisposable<IHighlight> = this._register(new MutableDisposable());
71
71
  private _highlightLimit: number;
72
72
  private _lastSearchOptions: ISearchOptions | undefined;
73
73
  private _highlightTimeout: number | undefined;
@@ -80,7 +80,7 @@ export class SearchAddon extends Disposable implements ITerminalAddon , ISearchA
80
80
  private _linesCacheTimeoutId = 0;
81
81
  private _linesCacheDisposables = new MutableDisposable();
82
82
 
83
- private readonly _onDidChangeResults = this.register(new EventEmitter<{ resultIndex: number, resultCount: number }>());
83
+ private readonly _onDidChangeResults = this._register(new Emitter<{ resultIndex: number, resultCount: number }>());
84
84
  public readonly onDidChangeResults = this._onDidChangeResults.event;
85
85
 
86
86
  constructor(options?: Partial<ISearchAddonOptions>) {
@@ -91,9 +91,9 @@ export class SearchAddon extends Disposable implements ITerminalAddon , ISearchA
91
91
 
92
92
  public activate(terminal: Terminal): void {
93
93
  this._terminal = terminal;
94
- this.register(this._terminal.onWriteParsed(() => this._updateMatches()));
95
- this.register(this._terminal.onResize(() => this._updateMatches()));
96
- this.register(toDisposable(() => this.clearDecorations()));
94
+ this._register(this._terminal.onWriteParsed(() => this._updateMatches()));
95
+ this._register(this._terminal.onResize(() => this._updateMatches()));
96
+ this._register(toDisposable(() => this.clearDecorations()));
97
97
  }
98
98
 
99
99
  private _updateMatches(): void {
@@ -111,7 +111,7 @@ export class SearchAddon extends Disposable implements ITerminalAddon , ISearchA
111
111
 
112
112
  public clearDecorations(retainCachedSearchTerm?: boolean): void {
113
113
  this._selectedDecoration.clear();
114
- disposeArray(this._highlightDecorations);
114
+ dispose(this._highlightDecorations);
115
115
  this._highlightDecorations = [];
116
116
  this._highlightedLines.clear();
117
117
  if (!retainCachedSearchTerm) {
@@ -426,11 +426,11 @@ export class SearchAddon extends Disposable implements ITerminalAddon , ISearchA
426
426
  const terminal = this._terminal!;
427
427
  if (!this._linesCache) {
428
428
  this._linesCache = new Array(terminal.buffer.active.length);
429
- this._linesCacheDisposables.value = getDisposeArrayDisposable([
429
+ this._linesCacheDisposables.value = combinedDisposable(
430
430
  terminal.onLineFeed(() => this._destroyLinesCache()),
431
431
  terminal.onCursorMove(() => this._destroyLinesCache()),
432
432
  terminal.onResize(() => this._destroyLinesCache())
433
- ]);
433
+ );
434
434
  }
435
435
 
436
436
  window.clearTimeout(this._linesCacheTimeoutId);
@@ -678,7 +678,7 @@ export class SearchAddon extends Disposable implements ITerminalAddon , ISearchA
678
678
  const disposables: IDisposable[] = [];
679
679
  disposables.push(marker);
680
680
  disposables.push(decoration.onRender((e) => this._applyStyles(e, options.activeMatchBorder, true)));
681
- disposables.push(decoration.onDispose(() => disposeArray(disposables)));
681
+ disposables.push(decoration.onDispose(() => dispose(disposables)));
682
682
  this._selectedDecoration.value = { decoration, match: result, dispose() { decoration.dispose(); } };
683
683
  }
684
684
  }
@@ -740,7 +740,7 @@ export class SearchAddon extends Disposable implements ITerminalAddon , ISearchA
740
740
  const disposables: IDisposable[] = [];
741
741
  disposables.push(marker);
742
742
  disposables.push(findResultDecoration.onRender((e) => this._applyStyles(e, options.matchBorder, false)));
743
- disposables.push(findResultDecoration.onDispose(() => disposeArray(disposables)));
743
+ disposables.push(findResultDecoration.onDispose(() => dispose(disposables)));
744
744
  }
745
745
  return findResultDecoration;
746
746
  }