@theia/terminal 1.45.1 → 1.46.0-next.72
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/README.md +30 -30
- package/lib/browser/base/terminal-service.d.ts +34 -34
- package/lib/browser/base/terminal-service.js +7 -7
- package/lib/browser/base/terminal-widget.d.ts +192 -192
- package/lib/browser/base/terminal-widget.js +34 -34
- package/lib/browser/index.d.ts +1 -1
- package/lib/browser/index.js +28 -28
- package/lib/browser/search/terminal-search-container.d.ts +3 -3
- package/lib/browser/search/terminal-search-container.js +28 -28
- package/lib/browser/search/terminal-search-widget.d.ts +30 -30
- package/lib/browser/search/terminal-search-widget.js +147 -147
- package/lib/browser/shell-terminal-profile.d.ts +20 -20
- package/lib/browser/shell-terminal-profile.js +42 -42
- package/lib/browser/terminal-contribution.d.ts +3 -3
- package/lib/browser/terminal-contribution.js +20 -20
- package/lib/browser/terminal-copy-on-selection-handler.d.ts +10 -10
- package/lib/browser/terminal-copy-on-selection-handler.js +103 -103
- package/lib/browser/terminal-file-link-provider.d.ts +24 -24
- package/lib/browser/terminal-file-link-provider.js +200 -200
- package/lib/browser/terminal-frontend-contribution.d.ts +115 -115
- package/lib/browser/terminal-frontend-contribution.d.ts.map +1 -1
- package/lib/browser/terminal-frontend-contribution.js +1078 -1056
- package/lib/browser/terminal-frontend-contribution.js.map +1 -1
- package/lib/browser/terminal-frontend-module.d.ts +5 -5
- package/lib/browser/terminal-frontend-module.js +117 -117
- package/lib/browser/terminal-link-helpers.d.ts +27 -27
- package/lib/browser/terminal-link-helpers.js +155 -155
- package/lib/browser/terminal-link-provider.d.ts +51 -51
- package/lib/browser/terminal-link-provider.js +197 -197
- package/lib/browser/terminal-preferences.d.ts +61 -61
- package/lib/browser/terminal-preferences.d.ts.map +1 -1
- package/lib/browser/terminal-preferences.js +357 -356
- package/lib/browser/terminal-preferences.js.map +1 -1
- package/lib/browser/terminal-profile-service.d.ts +58 -58
- package/lib/browser/terminal-profile-service.js +158 -158
- package/lib/browser/terminal-quick-open-service.d.ts +36 -36
- package/lib/browser/terminal-quick-open-service.js +137 -137
- package/lib/browser/terminal-theme-service.d.ts +21 -21
- package/lib/browser/terminal-theme-service.d.ts.map +1 -1
- package/lib/browser/terminal-theme-service.js +222 -218
- package/lib/browser/terminal-theme-service.js.map +1 -1
- package/lib/browser/terminal-url-link-provider.d.ts +11 -11
- package/lib/browser/terminal-url-link-provider.js +76 -76
- package/lib/browser/terminal-widget-impl.d.ts +180 -187
- package/lib/browser/terminal-widget-impl.d.ts.map +1 -1
- package/lib/browser/terminal-widget-impl.js +857 -867
- package/lib/browser/terminal-widget-impl.js.map +1 -1
- package/lib/common/base-terminal-protocol.d.ts +55 -55
- package/lib/common/base-terminal-protocol.js +84 -84
- package/lib/common/shell-terminal-protocol.d.ts +66 -66
- package/lib/common/shell-terminal-protocol.js +35 -35
- package/lib/common/terminal-common-module.d.ts +7 -7
- package/lib/common/terminal-common-module.js +31 -31
- package/lib/common/terminal-protocol.d.ts +12 -12
- package/lib/common/terminal-protocol.js +21 -21
- package/lib/common/terminal-watcher.d.ts +13 -13
- package/lib/common/terminal-watcher.js +70 -70
- package/lib/node/base-terminal-server.d.ts +24 -24
- package/lib/node/base-terminal-server.js +168 -168
- package/lib/node/buffering-stream.d.ts +39 -39
- package/lib/node/buffering-stream.js +75 -75
- package/lib/node/buffering-stream.spec.d.ts +1 -1
- package/lib/node/buffering-stream.spec.js +43 -43
- package/lib/node/index.d.ts +1 -1
- package/lib/node/index.js +28 -28
- package/lib/node/shell-process.d.ts +27 -27
- package/lib/node/shell-process.js +107 -107
- package/lib/node/shell-process.js.map +1 -1
- package/lib/node/shell-terminal-server.d.ts +30 -30
- package/lib/node/shell-terminal-server.js +212 -212
- package/lib/node/shell-terminal-server.spec.d.ts +1 -1
- package/lib/node/shell-terminal-server.spec.js +35 -35
- package/lib/node/terminal-backend-contribution.d.ts +9 -9
- package/lib/node/terminal-backend-contribution.js +75 -75
- package/lib/node/terminal-backend-contribution.slow-spec.d.ts +1 -1
- package/lib/node/terminal-backend-contribution.slow-spec.js +54 -54
- package/lib/node/terminal-backend-module.d.ts +11 -11
- package/lib/node/terminal-backend-module.js +69 -69
- package/lib/node/terminal-server.d.ts +9 -9
- package/lib/node/terminal-server.js +64 -64
- package/lib/node/terminal-server.spec.d.ts +1 -1
- package/lib/node/terminal-server.spec.js +41 -41
- package/lib/node/test/terminal-test-container.d.ts +2 -2
- package/lib/node/test/terminal-test-container.js +40 -40
- package/lib/package.spec.js +25 -25
- package/package.json +12 -12
- package/src/browser/base/terminal-service.ts +60 -60
- package/src/browser/base/terminal-widget.ts +254 -254
- package/src/browser/index.ts +17 -17
- package/src/browser/search/terminal-search-container.ts +28 -28
- package/src/browser/search/terminal-search-widget.tsx +161 -161
- package/src/browser/shell-terminal-profile.ts +45 -45
- package/src/browser/style/terminal-search.css +99 -99
- package/src/browser/style/terminal.css +32 -32
- package/src/browser/terminal-contribution.ts +19 -19
- package/src/browser/terminal-copy-on-selection-handler.ts +92 -92
- package/src/browser/terminal-file-link-provider.ts +200 -200
- package/src/browser/terminal-frontend-contribution.ts +1120 -1098
- package/src/browser/terminal-frontend-module.ts +136 -136
- package/src/browser/terminal-link-helpers.ts +187 -187
- package/src/browser/terminal-link-provider.ts +203 -203
- package/src/browser/terminal-preferences.ts +428 -427
- package/src/browser/terminal-profile-service.ts +180 -180
- package/src/browser/terminal-quick-open-service.ts +132 -132
- package/src/browser/terminal-theme-service.ts +213 -209
- package/src/browser/terminal-url-link-provider.ts +66 -66
- package/src/browser/terminal-widget-impl.ts +939 -936
- package/src/common/base-terminal-protocol.ts +125 -125
- package/src/common/shell-terminal-protocol.ts +103 -103
- package/src/common/terminal-common-module.ts +30 -30
- package/src/common/terminal-protocol.ts +32 -32
- package/src/common/terminal-watcher.ts +69 -69
- package/src/node/base-terminal-server.ts +173 -173
- package/src/node/buffering-stream.spec.ts +46 -46
- package/src/node/buffering-stream.ts +95 -95
- package/src/node/index.ts +17 -17
- package/src/node/shell-process.ts +101 -101
- package/src/node/shell-terminal-server.spec.ts +40 -40
- package/src/node/shell-terminal-server.ts +221 -221
- package/src/node/terminal-backend-contribution.slow-spec.ts +63 -63
- package/src/node/terminal-backend-contribution.ts +60 -60
- package/src/node/terminal-backend-module.ts +82 -82
- package/src/node/terminal-server.spec.ts +47 -47
- package/src/node/terminal-server.ts +52 -52
- package/src/node/test/terminal-test-container.ts +39 -39
- package/src/package.spec.ts +28 -28
|
@@ -1,161 +1,161 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2019 Red Hat, Inc. and others.
|
|
3
|
-
//
|
|
4
|
-
// This program and the accompanying materials are made available under the
|
|
5
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
//
|
|
8
|
-
// This Source Code may also be made available under the following Secondary
|
|
9
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
// with the GNU Classpath Exception which is available at
|
|
12
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
//
|
|
14
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
|
|
17
|
-
import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
|
|
18
|
-
import { ReactWidget } from '@theia/core/lib/browser/widgets/react-widget';
|
|
19
|
-
import * as React from '@theia/core/shared/react';
|
|
20
|
-
import '../../../src/browser/style/terminal-search.css';
|
|
21
|
-
import { Terminal } from 'xterm';
|
|
22
|
-
import { SearchAddon, ISearchOptions } from 'xterm-addon-search';
|
|
23
|
-
import { codicon, Key } from '@theia/core/lib/browser';
|
|
24
|
-
|
|
25
|
-
export const TERMINAL_SEARCH_WIDGET_FACTORY_ID = 'terminal-search';
|
|
26
|
-
export const TerminalSearchWidgetFactory = Symbol('TerminalSearchWidgetFactory');
|
|
27
|
-
export type TerminalSearchWidgetFactory = (terminal: Terminal) => TerminalSearchWidget;
|
|
28
|
-
|
|
29
|
-
@injectable()
|
|
30
|
-
export class TerminalSearchWidget extends ReactWidget {
|
|
31
|
-
|
|
32
|
-
private searchInput: HTMLInputElement | null;
|
|
33
|
-
private searchBox: HTMLDivElement | null;
|
|
34
|
-
private searchOptions: ISearchOptions = {};
|
|
35
|
-
private searchAddon: SearchAddon;
|
|
36
|
-
|
|
37
|
-
@inject(Terminal)
|
|
38
|
-
protected terminal: Terminal;
|
|
39
|
-
|
|
40
|
-
@postConstruct()
|
|
41
|
-
protected init(): void {
|
|
42
|
-
this.node.classList.add('theia-search-terminal-widget-parent');
|
|
43
|
-
|
|
44
|
-
this.searchAddon = new SearchAddon();
|
|
45
|
-
this.terminal.loadAddon(this.searchAddon);
|
|
46
|
-
|
|
47
|
-
this.hide();
|
|
48
|
-
this.update();
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
protected render(): React.ReactNode {
|
|
52
|
-
return <div className='theia-search-terminal-widget'>
|
|
53
|
-
<div className='theia-search-elem-box' ref={searchBox => this.searchBox = searchBox} >
|
|
54
|
-
<input
|
|
55
|
-
title='Find'
|
|
56
|
-
type='text'
|
|
57
|
-
spellCheck='false'
|
|
58
|
-
placeholder='Find'
|
|
59
|
-
ref={ip => this.searchInput = ip}
|
|
60
|
-
onKeyUp={this.onInputChanged}
|
|
61
|
-
onFocus={this.onSearchInputFocus}
|
|
62
|
-
onBlur={this.onSearchInputBlur}
|
|
63
|
-
/>
|
|
64
|
-
<div title='Match case' tabIndex={0} className={'search-elem ' + codicon('case-sensitive')} onClick={this.handleCaseSensitiveOptionClicked}></div>
|
|
65
|
-
<div title='Match whole word' tabIndex={0} className={'search-elem ' + codicon('whole-word')} onClick={this.handleWholeWordOptionClicked}></div>
|
|
66
|
-
<div title='Use regular expression' tabIndex={0} className={'search-elem ' + codicon('regex')} onClick={this.handleRegexOptionClicked}></div>
|
|
67
|
-
</div>
|
|
68
|
-
<button title='Previous match' className={'search-elem ' + codicon('arrow-up')} onClick={this.handlePreviousButtonClicked}></button>
|
|
69
|
-
<button title='Next match' className={'search-elem ' + codicon('arrow-down')} onClick={this.handleNextButtonClicked}></button>
|
|
70
|
-
<button title='Close' className={'search-elem ' + codicon('close')} onClick={this.handleHide}></button>
|
|
71
|
-
</div>;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
onSearchInputFocus = (): void => {
|
|
75
|
-
if (this.searchBox) {
|
|
76
|
-
this.searchBox.classList.add('focused');
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
onSearchInputBlur = (): void => {
|
|
81
|
-
if (this.searchBox) {
|
|
82
|
-
this.searchBox.classList.remove('focused');
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
private handleHide = (): void => {
|
|
87
|
-
this.hide();
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
private handleCaseSensitiveOptionClicked = (event: React.MouseEvent<HTMLSpanElement>): void => {
|
|
91
|
-
this.searchOptions.caseSensitive = !this.searchOptions.caseSensitive;
|
|
92
|
-
this.updateSearchInputBox(this.searchOptions.caseSensitive, event.currentTarget);
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
private handleWholeWordOptionClicked = (event: React.MouseEvent<HTMLSpanElement>): void => {
|
|
96
|
-
this.searchOptions.wholeWord = !this.searchOptions.wholeWord;
|
|
97
|
-
this.updateSearchInputBox(this.searchOptions.wholeWord, event.currentTarget);
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
private handleRegexOptionClicked = (event: React.MouseEvent<HTMLSpanElement>): void => {
|
|
101
|
-
this.searchOptions.regex = !this.searchOptions.regex;
|
|
102
|
-
this.updateSearchInputBox(this.searchOptions.regex, event.currentTarget);
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
private updateSearchInputBox(enable: boolean, optionElement: HTMLSpanElement): void {
|
|
106
|
-
if (enable) {
|
|
107
|
-
optionElement.classList.add('option-enabled');
|
|
108
|
-
} else {
|
|
109
|
-
optionElement.classList.remove('option-enabled');
|
|
110
|
-
}
|
|
111
|
-
this.searchInput!.focus();
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
private onInputChanged = (event: React.KeyboardEvent): void => {
|
|
115
|
-
// move to previous search result on `Shift + Enter`
|
|
116
|
-
if (event && event.shiftKey && event.keyCode === Key.ENTER.keyCode) {
|
|
117
|
-
this.search(false, 'previous');
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
// move to next search result on `Enter`
|
|
121
|
-
if (event && event.keyCode === Key.ENTER.keyCode) {
|
|
122
|
-
this.search(false, 'next');
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
this.search(true, 'next');
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
search(incremental: boolean, searchDirection: 'next' | 'previous'): void {
|
|
130
|
-
if (this.searchInput) {
|
|
131
|
-
this.searchOptions.incremental = incremental;
|
|
132
|
-
const searchText = this.searchInput.value;
|
|
133
|
-
|
|
134
|
-
if (searchDirection === 'next') {
|
|
135
|
-
this.searchAddon.findNext(searchText, this.searchOptions);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
if (searchDirection === 'previous') {
|
|
139
|
-
this.searchAddon.findPrevious(searchText, this.searchOptions);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
private handleNextButtonClicked = (): void => {
|
|
145
|
-
this.search(false, 'next');
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
private handlePreviousButtonClicked = (): void => {
|
|
149
|
-
this.search(false, 'previous');
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
override onAfterHide(): void {
|
|
153
|
-
this.terminal.focus();
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
override onAfterShow(): void {
|
|
157
|
-
if (this.searchInput) {
|
|
158
|
-
this.searchInput.select();
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2019 Red Hat, Inc. and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
|
|
18
|
+
import { ReactWidget } from '@theia/core/lib/browser/widgets/react-widget';
|
|
19
|
+
import * as React from '@theia/core/shared/react';
|
|
20
|
+
import '../../../src/browser/style/terminal-search.css';
|
|
21
|
+
import { Terminal } from 'xterm';
|
|
22
|
+
import { SearchAddon, ISearchOptions } from 'xterm-addon-search';
|
|
23
|
+
import { codicon, Key } from '@theia/core/lib/browser';
|
|
24
|
+
|
|
25
|
+
export const TERMINAL_SEARCH_WIDGET_FACTORY_ID = 'terminal-search';
|
|
26
|
+
export const TerminalSearchWidgetFactory = Symbol('TerminalSearchWidgetFactory');
|
|
27
|
+
export type TerminalSearchWidgetFactory = (terminal: Terminal) => TerminalSearchWidget;
|
|
28
|
+
|
|
29
|
+
@injectable()
|
|
30
|
+
export class TerminalSearchWidget extends ReactWidget {
|
|
31
|
+
|
|
32
|
+
private searchInput: HTMLInputElement | null;
|
|
33
|
+
private searchBox: HTMLDivElement | null;
|
|
34
|
+
private searchOptions: ISearchOptions = {};
|
|
35
|
+
private searchAddon: SearchAddon;
|
|
36
|
+
|
|
37
|
+
@inject(Terminal)
|
|
38
|
+
protected terminal: Terminal;
|
|
39
|
+
|
|
40
|
+
@postConstruct()
|
|
41
|
+
protected init(): void {
|
|
42
|
+
this.node.classList.add('theia-search-terminal-widget-parent');
|
|
43
|
+
|
|
44
|
+
this.searchAddon = new SearchAddon();
|
|
45
|
+
this.terminal.loadAddon(this.searchAddon);
|
|
46
|
+
|
|
47
|
+
this.hide();
|
|
48
|
+
this.update();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
protected render(): React.ReactNode {
|
|
52
|
+
return <div className='theia-search-terminal-widget'>
|
|
53
|
+
<div className='theia-search-elem-box' ref={searchBox => this.searchBox = searchBox} >
|
|
54
|
+
<input
|
|
55
|
+
title='Find'
|
|
56
|
+
type='text'
|
|
57
|
+
spellCheck='false'
|
|
58
|
+
placeholder='Find'
|
|
59
|
+
ref={ip => this.searchInput = ip}
|
|
60
|
+
onKeyUp={this.onInputChanged}
|
|
61
|
+
onFocus={this.onSearchInputFocus}
|
|
62
|
+
onBlur={this.onSearchInputBlur}
|
|
63
|
+
/>
|
|
64
|
+
<div title='Match case' tabIndex={0} className={'search-elem ' + codicon('case-sensitive')} onClick={this.handleCaseSensitiveOptionClicked}></div>
|
|
65
|
+
<div title='Match whole word' tabIndex={0} className={'search-elem ' + codicon('whole-word')} onClick={this.handleWholeWordOptionClicked}></div>
|
|
66
|
+
<div title='Use regular expression' tabIndex={0} className={'search-elem ' + codicon('regex')} onClick={this.handleRegexOptionClicked}></div>
|
|
67
|
+
</div>
|
|
68
|
+
<button title='Previous match' className={'search-elem ' + codicon('arrow-up')} onClick={this.handlePreviousButtonClicked}></button>
|
|
69
|
+
<button title='Next match' className={'search-elem ' + codicon('arrow-down')} onClick={this.handleNextButtonClicked}></button>
|
|
70
|
+
<button title='Close' className={'search-elem ' + codicon('close')} onClick={this.handleHide}></button>
|
|
71
|
+
</div>;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
onSearchInputFocus = (): void => {
|
|
75
|
+
if (this.searchBox) {
|
|
76
|
+
this.searchBox.classList.add('focused');
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
onSearchInputBlur = (): void => {
|
|
81
|
+
if (this.searchBox) {
|
|
82
|
+
this.searchBox.classList.remove('focused');
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
private handleHide = (): void => {
|
|
87
|
+
this.hide();
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
private handleCaseSensitiveOptionClicked = (event: React.MouseEvent<HTMLSpanElement>): void => {
|
|
91
|
+
this.searchOptions.caseSensitive = !this.searchOptions.caseSensitive;
|
|
92
|
+
this.updateSearchInputBox(this.searchOptions.caseSensitive, event.currentTarget);
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
private handleWholeWordOptionClicked = (event: React.MouseEvent<HTMLSpanElement>): void => {
|
|
96
|
+
this.searchOptions.wholeWord = !this.searchOptions.wholeWord;
|
|
97
|
+
this.updateSearchInputBox(this.searchOptions.wholeWord, event.currentTarget);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
private handleRegexOptionClicked = (event: React.MouseEvent<HTMLSpanElement>): void => {
|
|
101
|
+
this.searchOptions.regex = !this.searchOptions.regex;
|
|
102
|
+
this.updateSearchInputBox(this.searchOptions.regex, event.currentTarget);
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
private updateSearchInputBox(enable: boolean, optionElement: HTMLSpanElement): void {
|
|
106
|
+
if (enable) {
|
|
107
|
+
optionElement.classList.add('option-enabled');
|
|
108
|
+
} else {
|
|
109
|
+
optionElement.classList.remove('option-enabled');
|
|
110
|
+
}
|
|
111
|
+
this.searchInput!.focus();
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
private onInputChanged = (event: React.KeyboardEvent): void => {
|
|
115
|
+
// move to previous search result on `Shift + Enter`
|
|
116
|
+
if (event && event.shiftKey && event.keyCode === Key.ENTER.keyCode) {
|
|
117
|
+
this.search(false, 'previous');
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
// move to next search result on `Enter`
|
|
121
|
+
if (event && event.keyCode === Key.ENTER.keyCode) {
|
|
122
|
+
this.search(false, 'next');
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
this.search(true, 'next');
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
search(incremental: boolean, searchDirection: 'next' | 'previous'): void {
|
|
130
|
+
if (this.searchInput) {
|
|
131
|
+
this.searchOptions.incremental = incremental;
|
|
132
|
+
const searchText = this.searchInput.value;
|
|
133
|
+
|
|
134
|
+
if (searchDirection === 'next') {
|
|
135
|
+
this.searchAddon.findNext(searchText, this.searchOptions);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (searchDirection === 'previous') {
|
|
139
|
+
this.searchAddon.findPrevious(searchText, this.searchOptions);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
private handleNextButtonClicked = (): void => {
|
|
145
|
+
this.search(false, 'next');
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
private handlePreviousButtonClicked = (): void => {
|
|
149
|
+
this.search(false, 'previous');
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
override onAfterHide(): void {
|
|
153
|
+
this.terminal.focus();
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
override onAfterShow(): void {
|
|
157
|
+
if (this.searchInput) {
|
|
158
|
+
this.searchInput.select();
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2022 STMicroelectronics and others.
|
|
3
|
-
//
|
|
4
|
-
// This program and the accompanying materials are made available under the
|
|
5
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
//
|
|
8
|
-
// This Source Code may also be made available under the following Secondary
|
|
9
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
// with the GNU Classpath Exception which is available at
|
|
12
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
//
|
|
14
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
|
|
17
|
-
import { URI } from '@theia/core';
|
|
18
|
-
import { TerminalService } from './base/terminal-service';
|
|
19
|
-
import { TerminalWidget, TerminalWidgetOptions } from './base/terminal-widget';
|
|
20
|
-
import { TerminalProfile } from './terminal-profile-service';
|
|
21
|
-
|
|
22
|
-
export class ShellTerminalProfile implements TerminalProfile {
|
|
23
|
-
|
|
24
|
-
get shellPath(): string | undefined {
|
|
25
|
-
return this.options.shellPath;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
constructor(protected readonly terminalService: TerminalService, protected readonly options: TerminalWidgetOptions) { }
|
|
29
|
-
|
|
30
|
-
async start(): Promise<TerminalWidget> {
|
|
31
|
-
const widget = await this.terminalService.newTerminal(this.options);
|
|
32
|
-
widget.start();
|
|
33
|
-
return widget;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Makes a copy of this profile modified with the options given
|
|
38
|
-
* as an argument.
|
|
39
|
-
* @param options the options to override
|
|
40
|
-
* @returns a modified copy of this profile
|
|
41
|
-
*/
|
|
42
|
-
modify(options: { cwd?: string | URI }): TerminalProfile {
|
|
43
|
-
return new ShellTerminalProfile(this.terminalService, { ...this.options, ...options });
|
|
44
|
-
}
|
|
45
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2022 STMicroelectronics and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import { URI } from '@theia/core';
|
|
18
|
+
import { TerminalService } from './base/terminal-service';
|
|
19
|
+
import { TerminalWidget, TerminalWidgetOptions } from './base/terminal-widget';
|
|
20
|
+
import { TerminalProfile } from './terminal-profile-service';
|
|
21
|
+
|
|
22
|
+
export class ShellTerminalProfile implements TerminalProfile {
|
|
23
|
+
|
|
24
|
+
get shellPath(): string | undefined {
|
|
25
|
+
return this.options.shellPath;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
constructor(protected readonly terminalService: TerminalService, protected readonly options: TerminalWidgetOptions) { }
|
|
29
|
+
|
|
30
|
+
async start(): Promise<TerminalWidget> {
|
|
31
|
+
const widget = await this.terminalService.newTerminal(this.options);
|
|
32
|
+
widget.start();
|
|
33
|
+
return widget;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Makes a copy of this profile modified with the options given
|
|
38
|
+
* as an argument.
|
|
39
|
+
* @param options the options to override
|
|
40
|
+
* @returns a modified copy of this profile
|
|
41
|
+
*/
|
|
42
|
+
modify(options: { cwd?: string | URI }): TerminalProfile {
|
|
43
|
+
return new ShellTerminalProfile(this.terminalService, { ...this.options, ...options });
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -1,99 +1,99 @@
|
|
|
1
|
-
/********************************************************************************
|
|
2
|
-
* Copyright (C) 2019 Red Hat, Inc. and others.
|
|
3
|
-
*
|
|
4
|
-
* This program and the accompanying materials are made available under the
|
|
5
|
-
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
*
|
|
8
|
-
* This Source Code may also be made available under the following Secondary
|
|
9
|
-
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
* with the GNU Classpath Exception which is available at
|
|
12
|
-
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
*
|
|
14
|
-
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
-
********************************************************************************/
|
|
16
|
-
|
|
17
|
-
.theia-search-terminal-widget-parent {
|
|
18
|
-
background: var(--theia-sideBar-background);
|
|
19
|
-
position: absolute;
|
|
20
|
-
margin: 0px;
|
|
21
|
-
border: var(--theia-border-width) solid transparent;
|
|
22
|
-
padding: 0px;
|
|
23
|
-
top: 1px;
|
|
24
|
-
right: 19px;
|
|
25
|
-
|
|
26
|
-
z-index: 10;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.theia-search-terminal-widget-parent .theia-search-elem-box {
|
|
30
|
-
display: flex;
|
|
31
|
-
margin: 0px;
|
|
32
|
-
border: var(--theia-border-width) solid transparent;
|
|
33
|
-
padding: 0px;
|
|
34
|
-
align-items: center;
|
|
35
|
-
color: var(--theia-input-foreground);
|
|
36
|
-
background: var(--theia-input-background);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.theia-search-terminal-widget-parent .theia-search-elem-box input {
|
|
40
|
-
margin-left: 5px;
|
|
41
|
-
padding: 0px;
|
|
42
|
-
width: 100px;
|
|
43
|
-
height: 18px;
|
|
44
|
-
color: inherit;
|
|
45
|
-
background-color: inherit;
|
|
46
|
-
border: var(--theia-border-width) solid transparent;
|
|
47
|
-
outline: none;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.theia-search-terminal-widget-parent
|
|
51
|
-
.theia-search-elem-box
|
|
52
|
-
.search-elem.codicon {
|
|
53
|
-
height: 16px;
|
|
54
|
-
width: 18px;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.theia-search-terminal-widget-parent .search-elem.codicon {
|
|
58
|
-
border: var(--theia-border-width) solid transparent;
|
|
59
|
-
height: 20px;
|
|
60
|
-
width: 20px;
|
|
61
|
-
opacity: 0.7;
|
|
62
|
-
outline: none;
|
|
63
|
-
color: var(--theia-input-foreground);
|
|
64
|
-
padding: 0px;
|
|
65
|
-
margin-left: 3px;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.theia-search-terminal-widget-parent .search-elem:hover {
|
|
69
|
-
opacity: 1;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
.theia-search-terminal-widget-parent .theia-search-elem-box.focused {
|
|
73
|
-
border: var(--theia-border-width) solid var(--theia-focusBorder);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.theia-search-terminal-widget-parent
|
|
77
|
-
.theia-search-elem-box
|
|
78
|
-
.search-elem.option-enabled {
|
|
79
|
-
border: var(--theia-border-width) solid var(--theia-inputOption-activeBorder);
|
|
80
|
-
background-color: var(--theia-inputOption-activeBackground);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
.theia-search-terminal-widget-parent .theia-search-terminal-widget {
|
|
84
|
-
margin: 2px;
|
|
85
|
-
display: flex;
|
|
86
|
-
align-items: center;
|
|
87
|
-
font: var(--theia-content-font-size);
|
|
88
|
-
color: var(--theia-input-foreground);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.theia-search-terminal-widget-parent .theia-search-terminal-widget button {
|
|
92
|
-
background-color: transparent;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
.theia-search-terminal-widget-parent
|
|
96
|
-
.theia-search-terminal-widget
|
|
97
|
-
button:focus {
|
|
98
|
-
border: var(--theia-border-width) var(--theia-focusBorder) solid;
|
|
99
|
-
}
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (C) 2019 Red Hat, Inc. and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
*
|
|
8
|
+
* This Source Code may also be made available under the following Secondary
|
|
9
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
* with the GNU Classpath Exception which is available at
|
|
12
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
*
|
|
14
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
********************************************************************************/
|
|
16
|
+
|
|
17
|
+
.theia-search-terminal-widget-parent {
|
|
18
|
+
background: var(--theia-sideBar-background);
|
|
19
|
+
position: absolute;
|
|
20
|
+
margin: 0px;
|
|
21
|
+
border: var(--theia-border-width) solid transparent;
|
|
22
|
+
padding: 0px;
|
|
23
|
+
top: 1px;
|
|
24
|
+
right: 19px;
|
|
25
|
+
|
|
26
|
+
z-index: 10;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.theia-search-terminal-widget-parent .theia-search-elem-box {
|
|
30
|
+
display: flex;
|
|
31
|
+
margin: 0px;
|
|
32
|
+
border: var(--theia-border-width) solid transparent;
|
|
33
|
+
padding: 0px;
|
|
34
|
+
align-items: center;
|
|
35
|
+
color: var(--theia-input-foreground);
|
|
36
|
+
background: var(--theia-input-background);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.theia-search-terminal-widget-parent .theia-search-elem-box input {
|
|
40
|
+
margin-left: 5px;
|
|
41
|
+
padding: 0px;
|
|
42
|
+
width: 100px;
|
|
43
|
+
height: 18px;
|
|
44
|
+
color: inherit;
|
|
45
|
+
background-color: inherit;
|
|
46
|
+
border: var(--theia-border-width) solid transparent;
|
|
47
|
+
outline: none;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.theia-search-terminal-widget-parent
|
|
51
|
+
.theia-search-elem-box
|
|
52
|
+
.search-elem.codicon {
|
|
53
|
+
height: 16px;
|
|
54
|
+
width: 18px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.theia-search-terminal-widget-parent .search-elem.codicon {
|
|
58
|
+
border: var(--theia-border-width) solid transparent;
|
|
59
|
+
height: 20px;
|
|
60
|
+
width: 20px;
|
|
61
|
+
opacity: 0.7;
|
|
62
|
+
outline: none;
|
|
63
|
+
color: var(--theia-input-foreground);
|
|
64
|
+
padding: 0px;
|
|
65
|
+
margin-left: 3px;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.theia-search-terminal-widget-parent .search-elem:hover {
|
|
69
|
+
opacity: 1;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.theia-search-terminal-widget-parent .theia-search-elem-box.focused {
|
|
73
|
+
border: var(--theia-border-width) solid var(--theia-focusBorder);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.theia-search-terminal-widget-parent
|
|
77
|
+
.theia-search-elem-box
|
|
78
|
+
.search-elem.option-enabled {
|
|
79
|
+
border: var(--theia-border-width) solid var(--theia-inputOption-activeBorder);
|
|
80
|
+
background-color: var(--theia-inputOption-activeBackground);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.theia-search-terminal-widget-parent .theia-search-terminal-widget {
|
|
84
|
+
margin: 2px;
|
|
85
|
+
display: flex;
|
|
86
|
+
align-items: center;
|
|
87
|
+
font: var(--theia-content-font-size);
|
|
88
|
+
color: var(--theia-input-foreground);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.theia-search-terminal-widget-parent .theia-search-terminal-widget button {
|
|
92
|
+
background-color: transparent;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.theia-search-terminal-widget-parent
|
|
96
|
+
.theia-search-terminal-widget
|
|
97
|
+
button:focus {
|
|
98
|
+
border: var(--theia-border-width) var(--theia-focusBorder) solid;
|
|
99
|
+
}
|