@xterm/addon-search 0.16.0-beta.122 → 0.16.0-beta.124

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xterm/addon-search",
3
- "version": "0.16.0-beta.122",
3
+ "version": "0.16.0-beta.124",
4
4
  "author": {
5
5
  "name": "The xterm.js authors",
6
6
  "url": "https://xtermjs.org/"
@@ -22,7 +22,7 @@
22
22
  "start": "node ../../demo/start"
23
23
  },
24
24
  "peerDependencies": {
25
- "@xterm/xterm": "^5.6.0-beta.122"
25
+ "@xterm/xterm": "^5.6.0-beta.124"
26
26
  },
27
- "commit": "e37aba592464668145f61ee874ab9d4a95fc56a9"
27
+ "commit": "02b3704af0b1823ccb4ebb6c5fa4059a7934dbd8"
28
28
  }
@@ -4,28 +4,14 @@
4
4
  */
5
5
 
6
6
  import type { Terminal, IDisposable, ITerminalAddon, IDecoration } from '@xterm/xterm';
7
- import type { SearchAddon as ISearchApi } from '@xterm/addon-search';
7
+ import type { SearchAddon as ISearchApi, ISearchOptions, ISearchDecorationOptions } from '@xterm/addon-search';
8
8
  import { Emitter, Event } from 'vs/base/common/event';
9
9
  import { combinedDisposable, Disposable, dispose, MutableDisposable, toDisposable } from 'vs/base/common/lifecycle';
10
10
 
11
- export interface ISearchOptions {
12
- regex?: boolean;
13
- wholeWord?: boolean;
14
- caseSensitive?: boolean;
15
- incremental?: boolean;
16
- decorations?: ISearchDecorationOptions;
11
+ interface IInternalSearchOptions {
17
12
  noScroll?: boolean;
18
13
  }
19
14
 
20
- interface ISearchDecorationOptions {
21
- matchBackground?: string;
22
- matchBorder?: string;
23
- matchOverviewRuler: string;
24
- activeMatchBackground?: string;
25
- activeMatchBorder?: string;
26
- activeMatchColorOverviewRuler: string;
27
- }
28
-
29
15
  export interface ISearchPosition {
30
16
  startCol: number;
31
17
  startRow: number;
@@ -136,7 +122,7 @@ export class SearchAddon extends Disposable implements ITerminalAddon, ISearchAp
136
122
  this._highlightTimeout = setTimeout(() => {
137
123
  const term = this._cachedSearchTerm;
138
124
  this._cachedSearchTerm = undefined;
139
- this.findPrevious(term!, { ...this._lastSearchOptions, incremental: true, noScroll: true });
125
+ this.findPrevious(term!, { ...this._lastSearchOptions, incremental: true }, { noScroll: true });
140
126
  }, 200);
141
127
  }
142
128
  }
@@ -163,7 +149,7 @@ export class SearchAddon extends Disposable implements ITerminalAddon, ISearchAp
163
149
  * @param searchOptions Search options.
164
150
  * @returns Whether a result was found.
165
151
  */
166
- public findNext(term: string, searchOptions?: ISearchOptions): boolean {
152
+ public findNext(term: string, searchOptions?: ISearchOptions, internalSearchOptions?: IInternalSearchOptions): boolean {
167
153
  if (!this._terminal) {
168
154
  throw new Error('Cannot use addon until it has been loaded');
169
155
  }
@@ -175,7 +161,7 @@ export class SearchAddon extends Disposable implements ITerminalAddon, ISearchAp
175
161
  }
176
162
  }
177
163
 
178
- const found = this._findNextAndSelect(term, searchOptions);
164
+ const found = this._findNextAndSelect(term, searchOptions, internalSearchOptions);
179
165
  this._fireResults(searchOptions);
180
166
  this._cachedSearchTerm = term;
181
167
 
@@ -263,7 +249,7 @@ export class SearchAddon extends Disposable implements ITerminalAddon, ISearchAp
263
249
  return result;
264
250
  }
265
251
 
266
- private _findNextAndSelect(term: string, searchOptions?: ISearchOptions): boolean {
252
+ private _findNextAndSelect(term: string, searchOptions?: ISearchOptions, internalSearchOptions?: IInternalSearchOptions): boolean {
267
253
  if (!this._terminal || !term || term.length === 0) {
268
254
  this._terminal?.clearSelection();
269
255
  this.clearDecorations();
@@ -328,7 +314,7 @@ export class SearchAddon extends Disposable implements ITerminalAddon, ISearchAp
328
314
  }
329
315
 
330
316
  // Set selection and scroll if a result was found
331
- return this._selectResult(result, searchOptions?.decorations, searchOptions?.noScroll);
317
+ return this._selectResult(result, searchOptions?.decorations, internalSearchOptions?.noScroll);
332
318
  }
333
319
  /**
334
320
  * Find the previous instance of the term, then scroll to and select it. If it
@@ -337,7 +323,7 @@ export class SearchAddon extends Disposable implements ITerminalAddon, ISearchAp
337
323
  * @param searchOptions Search options.
338
324
  * @returns Whether a result was found.
339
325
  */
340
- public findPrevious(term: string, searchOptions?: ISearchOptions): boolean {
326
+ public findPrevious(term: string, searchOptions?: ISearchOptions, internalSearchOptions?: IInternalSearchOptions): boolean {
341
327
  if (!this._terminal) {
342
328
  throw new Error('Cannot use addon until it has been loaded');
343
329
  }
@@ -349,7 +335,7 @@ export class SearchAddon extends Disposable implements ITerminalAddon, ISearchAp
349
335
  }
350
336
  }
351
337
 
352
- const found = this._findPreviousAndSelect(term, searchOptions);
338
+ const found = this._findPreviousAndSelect(term, searchOptions, internalSearchOptions);
353
339
  this._fireResults(searchOptions);
354
340
  this._cachedSearchTerm = term;
355
341
 
@@ -389,7 +375,7 @@ export class SearchAddon extends Disposable implements ITerminalAddon, ISearchAp
389
375
  }
390
376
  }
391
377
 
392
- private _findPreviousAndSelect(term: string, searchOptions?: ISearchOptions): boolean {
378
+ private _findPreviousAndSelect(term: string, searchOptions?: ISearchOptions, internalSearchOptions?: IInternalSearchOptions): boolean {
393
379
  if (!this._terminal) {
394
380
  throw new Error('Cannot use addon until it has been loaded');
395
381
  }
@@ -454,7 +440,7 @@ export class SearchAddon extends Disposable implements ITerminalAddon, ISearchAp
454
440
  }
455
441
 
456
442
  // Set selection and scroll if a result was found
457
- return this._selectResult(result, searchOptions?.decorations, searchOptions?.noScroll);
443
+ return this._selectResult(result, searchOptions?.decorations, internalSearchOptions?.noScroll);
458
444
  }
459
445
 
460
446
  /**