@xterm/addon-search 0.17.0-beta.9 → 0.17.0-beta.91
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.17.0-beta.
|
|
3
|
+
"version": "0.17.0-beta.91",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "The xterm.js authors",
|
|
6
6
|
"url": "https://xtermjs.org/"
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"prepublishOnly": "npm run package",
|
|
22
22
|
"start": "node ../../demo/start"
|
|
23
23
|
},
|
|
24
|
-
"commit": "
|
|
24
|
+
"commit": "94a264679e6bd51b7021ca59e3b2e1e80d02c633",
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"@xterm/xterm": "^6.1.0-beta.
|
|
26
|
+
"@xterm/xterm": "^6.1.0-beta.91"
|
|
27
27
|
}
|
|
28
28
|
}
|
package/src/DecorationManager.ts
CHANGED
|
@@ -135,6 +135,7 @@ export class DecorationManager extends Disposable {
|
|
|
135
135
|
marker,
|
|
136
136
|
x: range[1],
|
|
137
137
|
width: range[2],
|
|
138
|
+
layer: isActiveResult ? 'top' : 'bottom',
|
|
138
139
|
backgroundColor: isActiveResult ? options.activeMatchBackground : options.matchBackground,
|
|
139
140
|
overviewRulerOptions: this._highlightedLines.has(marker.line) ? undefined : {
|
|
140
141
|
color: isActiveResult ? options.activeMatchColorOverviewRuler : options.matchOverviewRuler,
|
package/src/SearchAddon.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import type { Terminal, IDisposable, ITerminalAddon } from '@xterm/xterm';
|
|
7
7
|
import type { SearchAddon as ISearchApi, ISearchOptions, ISearchAddonOptions, ISearchResultChangeEvent } from '@xterm/addon-search';
|
|
8
|
-
import { Event } from 'vs/base/common/event';
|
|
8
|
+
import { Emitter, Event } from 'vs/base/common/event';
|
|
9
9
|
import { Disposable, MutableDisposable, toDisposable } from 'vs/base/common/lifecycle';
|
|
10
10
|
import { disposableTimeout } from 'vs/base/common/async';
|
|
11
11
|
import { SearchLineCache } from './SearchLineCache';
|
|
@@ -42,6 +42,11 @@ export class SearchAddon extends Disposable implements ITerminalAddon, ISearchAp
|
|
|
42
42
|
private _decorationManager: DecorationManager | undefined;
|
|
43
43
|
private _resultTracker = this._register(new SearchResultTracker());
|
|
44
44
|
|
|
45
|
+
private readonly _onAfterSearch = this._register(new Emitter<void>());
|
|
46
|
+
public readonly onAfterSearch = this._onAfterSearch.event;
|
|
47
|
+
private readonly _onBeforeSearch = this._register(new Emitter<void>());
|
|
48
|
+
public readonly onBeforeSearch = this._onBeforeSearch.event;
|
|
49
|
+
|
|
45
50
|
public get onDidChangeResults(): Event<ISearchResultChangeEvent> {
|
|
46
51
|
return this._resultTracker.onDidChangeResults;
|
|
47
52
|
}
|
|
@@ -98,6 +103,8 @@ export class SearchAddon extends Disposable implements ITerminalAddon, ISearchAp
|
|
|
98
103
|
throw new Error('Cannot use addon until it has been loaded');
|
|
99
104
|
}
|
|
100
105
|
|
|
106
|
+
this._onBeforeSearch.fire();
|
|
107
|
+
|
|
101
108
|
this._state.lastSearchOptions = searchOptions;
|
|
102
109
|
|
|
103
110
|
if (this._state.shouldUpdateHighlighting(term, searchOptions)) {
|
|
@@ -108,6 +115,8 @@ export class SearchAddon extends Disposable implements ITerminalAddon, ISearchAp
|
|
|
108
115
|
this._fireResults(searchOptions);
|
|
109
116
|
this._state.cachedSearchTerm = term;
|
|
110
117
|
|
|
118
|
+
this._onAfterSearch.fire();
|
|
119
|
+
|
|
111
120
|
return found;
|
|
112
121
|
}
|
|
113
122
|
|
|
@@ -173,6 +182,8 @@ export class SearchAddon extends Disposable implements ITerminalAddon, ISearchAp
|
|
|
173
182
|
throw new Error('Cannot use addon until it has been loaded');
|
|
174
183
|
}
|
|
175
184
|
|
|
185
|
+
this._onBeforeSearch.fire();
|
|
186
|
+
|
|
176
187
|
this._state.lastSearchOptions = searchOptions;
|
|
177
188
|
|
|
178
189
|
if (this._state.shouldUpdateHighlighting(term, searchOptions)) {
|
|
@@ -183,6 +194,8 @@ export class SearchAddon extends Disposable implements ITerminalAddon, ISearchAp
|
|
|
183
194
|
this._fireResults(searchOptions);
|
|
184
195
|
this._state.cachedSearchTerm = term;
|
|
185
196
|
|
|
197
|
+
this._onAfterSearch.fire();
|
|
198
|
+
|
|
186
199
|
return found;
|
|
187
200
|
}
|
|
188
201
|
|
|
@@ -152,8 +152,17 @@ declare module '@xterm/addon-search' {
|
|
|
152
152
|
public clearActiveDecoration(): void;
|
|
153
153
|
|
|
154
154
|
/**
|
|
155
|
-
*
|
|
156
|
-
|
|
155
|
+
* Fires after a search is performed.
|
|
156
|
+
*/
|
|
157
|
+
readonly onAfterSearch: IEvent<void>;
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Fires before a search is performed.
|
|
161
|
+
*/
|
|
162
|
+
readonly onBeforeSearch: IEvent<void>;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* When decorations are enabled, fires when the search results change.
|
|
157
166
|
*/
|
|
158
167
|
readonly onDidChangeResults: IEvent<ISearchResultChangeEvent>;
|
|
159
168
|
}
|