@opensumi/ide-terminal-next 3.7.2-next-1739848467.0 → 3.7.2-next-1739945875.0
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/lib/browser/component/search.module.less +61 -0
- package/lib/browser/component/search.view.d.ts +3 -0
- package/lib/browser/component/search.view.d.ts.map +1 -0
- package/lib/browser/component/search.view.js +89 -0
- package/lib/browser/component/search.view.js.map +1 -0
- package/lib/browser/component/terminal.module.less +0 -30
- package/lib/browser/component/terminal.view.d.ts.map +1 -1
- package/lib/browser/component/terminal.view.js +2 -32
- package/lib/browser/component/terminal.view.js.map +1 -1
- package/lib/browser/terminal.client.d.ts +7 -1
- package/lib/browser/terminal.client.d.ts.map +1 -1
- package/lib/browser/terminal.client.js +9 -2
- package/lib/browser/terminal.client.js.map +1 -1
- package/lib/browser/terminal.search.d.ts +9 -1
- package/lib/browser/terminal.search.d.ts.map +1 -1
- package/lib/browser/terminal.search.js +49 -1
- package/lib/browser/terminal.search.js.map +1 -1
- package/lib/browser/xterm.d.ts +7 -1
- package/lib/browser/xterm.d.ts.map +1 -1
- package/lib/browser/xterm.js +12 -1
- package/lib/browser/xterm.js.map +1 -1
- package/lib/common/client.d.ts +8 -2
- package/lib/common/client.d.ts.map +1 -1
- package/lib/common/client.js.map +1 -1
- package/lib/common/controller.d.ts +15 -0
- package/lib/common/controller.d.ts.map +1 -1
- package/lib/common/controller.js.map +1 -1
- package/lib/common/xterm.d.ts +8 -2
- package/lib/common/xterm.d.ts.map +1 -1
- package/lib/common/xterm.js.map +1 -1
- package/package.json +18 -18
- package/src/browser/component/search.module.less +61 -0
- package/src/browser/component/search.view.tsx +142 -0
- package/src/browser/component/terminal.module.less +0 -30
- package/src/browser/component/terminal.view.tsx +3 -56
- package/src/browser/terminal.client.ts +13 -2
- package/src/browser/terminal.search.ts +49 -2
- package/src/browser/xterm.ts +14 -1
- package/src/common/client.ts +7 -2
- package/src/common/controller.ts +18 -0
- package/src/common/xterm.ts +6 -2
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
import { Autowired, Injectable } from '@opensumi/di';
|
|
2
2
|
import { Emitter, Event, debounce } from '@opensumi/ide-core-common';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
ITerminalClient,
|
|
6
|
+
ITerminalController,
|
|
7
|
+
ITerminalGroupViewService,
|
|
8
|
+
ITerminalSearchService,
|
|
9
|
+
IUIState,
|
|
10
|
+
} from '../common';
|
|
5
11
|
|
|
6
12
|
@Injectable()
|
|
7
13
|
export class TerminalSearchService implements ITerminalSearchService {
|
|
8
14
|
protected _isVisible: boolean = false;
|
|
15
|
+
|
|
16
|
+
public UIState: IUIState = {
|
|
17
|
+
isMatchCase: false,
|
|
18
|
+
isUseRegexp: false,
|
|
19
|
+
isWholeWord: false,
|
|
20
|
+
};
|
|
21
|
+
|
|
9
22
|
get isVisible() {
|
|
10
23
|
return this._isVisible;
|
|
11
24
|
}
|
|
@@ -31,6 +44,10 @@ export class TerminalSearchService implements ITerminalSearchService {
|
|
|
31
44
|
this.isVisible = true;
|
|
32
45
|
}
|
|
33
46
|
|
|
47
|
+
get onResultChange() {
|
|
48
|
+
return this.client?.onSearchResultsChange;
|
|
49
|
+
}
|
|
50
|
+
|
|
34
51
|
close() {
|
|
35
52
|
this.client?.closeSearch();
|
|
36
53
|
this.isVisible = false;
|
|
@@ -45,6 +62,36 @@ export class TerminalSearchService implements ITerminalSearchService {
|
|
|
45
62
|
|
|
46
63
|
@debounce(150)
|
|
47
64
|
search() {
|
|
48
|
-
this.client?.findNext(this.text
|
|
65
|
+
this.client?.findNext(this.text, {
|
|
66
|
+
wholeWord: this.UIState.isWholeWord,
|
|
67
|
+
regex: this.UIState.isUseRegexp,
|
|
68
|
+
caseSensitive: this.UIState.isMatchCase,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@debounce(150)
|
|
73
|
+
searchPrevious() {
|
|
74
|
+
this.client?.findPrevious(this.text, {
|
|
75
|
+
wholeWord: this.UIState.isWholeWord,
|
|
76
|
+
regex: this.UIState.isUseRegexp,
|
|
77
|
+
caseSensitive: this.UIState.isMatchCase,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@debounce(150)
|
|
82
|
+
searchNext(): void {
|
|
83
|
+
this.client?.findNext(this.text, {
|
|
84
|
+
wholeWord: this.UIState.isWholeWord,
|
|
85
|
+
regex: this.UIState.isUseRegexp,
|
|
86
|
+
caseSensitive: this.UIState.isMatchCase,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
updateUIState(state: Partial<IUIState>): void {
|
|
91
|
+
this.UIState = {
|
|
92
|
+
...this.UIState,
|
|
93
|
+
...state,
|
|
94
|
+
};
|
|
95
|
+
this.search();
|
|
49
96
|
}
|
|
50
97
|
}
|
package/src/browser/xterm.ts
CHANGED
|
@@ -177,13 +177,26 @@ export class XTerm extends Disposable implements IXTerm {
|
|
|
177
177
|
};
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
-
findNext(text: string) {
|
|
180
|
+
findNext(text: string, searchOptions: ISearchOptions = {}) {
|
|
181
181
|
const options: ISearchOptions = {
|
|
182
182
|
decorations: this.getFindColors(),
|
|
183
|
+
...searchOptions,
|
|
183
184
|
};
|
|
184
185
|
return this._searchAddon.findNext(text, options);
|
|
185
186
|
}
|
|
186
187
|
|
|
188
|
+
findPrevious(text: string, searchOptions: ISearchOptions = {}) {
|
|
189
|
+
const options: ISearchOptions = {
|
|
190
|
+
decorations: this.getFindColors(),
|
|
191
|
+
...searchOptions,
|
|
192
|
+
};
|
|
193
|
+
return this._searchAddon.findPrevious(text, options);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
get onSearchResultsChange() {
|
|
197
|
+
return this._searchAddon.onDidChangeResults;
|
|
198
|
+
}
|
|
199
|
+
|
|
187
200
|
closeSearch() {
|
|
188
201
|
this._searchAddon.clearDecorations();
|
|
189
202
|
}
|
package/src/common/client.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ISearchOptions } from '@xterm/addon-search';
|
|
2
|
+
import { IEvent, Terminal } from '@xterm/xterm';
|
|
2
3
|
|
|
3
4
|
import { Deferred, Disposable, Event, IDisposable } from '@opensumi/ide-core-common';
|
|
4
5
|
|
|
@@ -116,7 +117,11 @@ export interface ITerminalClient extends Disposable {
|
|
|
116
117
|
*
|
|
117
118
|
* @param text 用户输入的字符串
|
|
118
119
|
*/
|
|
119
|
-
findNext(text: string): void;
|
|
120
|
+
findNext(text: string, searchOptions?: ISearchOptions): void;
|
|
121
|
+
|
|
122
|
+
findPrevious(text: string, searchOptions?: ISearchOptions): void;
|
|
123
|
+
|
|
124
|
+
onSearchResultsChange: IEvent<{ resultIndex: number; resultCount: number }>;
|
|
120
125
|
|
|
121
126
|
closeSearch(): void;
|
|
122
127
|
|
package/src/common/controller.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { IEvent } from '@xterm/xterm';
|
|
2
|
+
|
|
1
3
|
import { IContextKeyService } from '@opensumi/ide-core-browser';
|
|
2
4
|
import { Deferred, Disposable, Event, IDisposable, Uri } from '@opensumi/ide-core-common';
|
|
3
5
|
import { IObservable } from '@opensumi/ide-monaco/lib/common/observable';
|
|
@@ -113,10 +115,23 @@ export interface ITerminalController extends Disposable {
|
|
|
113
115
|
registerLinkProvider(provider: ITerminalExternalLinkProvider): IDisposable;
|
|
114
116
|
}
|
|
115
117
|
|
|
118
|
+
export interface IUIState {
|
|
119
|
+
isMatchCase: boolean;
|
|
120
|
+
isWholeWord: boolean;
|
|
121
|
+
isUseRegexp: boolean;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export interface ISearchResult {
|
|
125
|
+
resultCount: number;
|
|
126
|
+
resultIndex: number;
|
|
127
|
+
}
|
|
128
|
+
|
|
116
129
|
export const ITerminalSearchService = Symbol('ITerminalSearchService');
|
|
117
130
|
export interface ITerminalSearchService {
|
|
118
131
|
isVisible: boolean;
|
|
119
132
|
onVisibleChange: Event<boolean>;
|
|
133
|
+
UIState: IUIState;
|
|
134
|
+
onResultChange: IEvent<ISearchResult> | undefined;
|
|
120
135
|
|
|
121
136
|
text: string;
|
|
122
137
|
|
|
@@ -124,6 +139,9 @@ export interface ITerminalSearchService {
|
|
|
124
139
|
clear(): void;
|
|
125
140
|
close(): void;
|
|
126
141
|
search(): void;
|
|
142
|
+
searchNext(): void;
|
|
143
|
+
searchPrevious(): void;
|
|
144
|
+
updateUIState(state: Partial<IUIState>): void;
|
|
127
145
|
}
|
|
128
146
|
|
|
129
147
|
export const ITerminalGroupViewService = Symbol('ITerminalGroupViewService');
|
package/src/common/xterm.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ISearchOptions } from '@xterm/addon-search';
|
|
2
|
+
import { IEvent, ITerminalOptions, ITheme, Terminal } from '@xterm/xterm';
|
|
2
3
|
|
|
3
4
|
import { SupportedOptions } from './preference';
|
|
4
5
|
|
|
@@ -13,11 +14,14 @@ export interface IXTerm {
|
|
|
13
14
|
container: HTMLDivElement;
|
|
14
15
|
xtermOptions: ITerminalOptions & SupportedOptions;
|
|
15
16
|
|
|
17
|
+
onSearchResultsChange: IEvent<{ resultIndex: number; resultCount: number }>;
|
|
18
|
+
|
|
16
19
|
copySelection(): Promise<void>;
|
|
17
20
|
onSelectionChange(): Promise<void>;
|
|
18
21
|
open(): void;
|
|
19
22
|
fit(): void;
|
|
20
|
-
findNext(text: string): boolean;
|
|
23
|
+
findNext(text: string, searchOptions?: ISearchOptions): boolean;
|
|
24
|
+
findPrevious(text: string, searchOptions?: ISearchOptions): boolean;
|
|
21
25
|
closeSearch(): void;
|
|
22
26
|
updatePreferences(options: SupportedOptions): void;
|
|
23
27
|
updateTheme(theme: ITheme | undefined): void;
|