@opensumi/ide-terminal-next 3.7.2-next-1740448398.0 → 3.7.2-next-1741226843.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.
Files changed (97) hide show
  1. package/lib/browser/component/resize.view.d.ts.map +1 -1
  2. package/lib/browser/component/resize.view.js +2 -2
  3. package/lib/browser/component/resize.view.js.map +1 -1
  4. package/lib/browser/component/tab.item.d.ts.map +1 -1
  5. package/lib/browser/component/tab.item.js +1 -23
  6. package/lib/browser/component/tab.item.js.map +1 -1
  7. package/lib/browser/component/tab.view.d.ts.map +1 -1
  8. package/lib/browser/component/tab.view.js +1 -10
  9. package/lib/browser/component/tab.view.js.map +1 -1
  10. package/lib/browser/component/terminal.module.less +27 -3
  11. package/lib/browser/component/terminal.view.d.ts.map +1 -1
  12. package/lib/browser/component/terminal.view.js +32 -2
  13. package/lib/browser/component/terminal.view.js.map +1 -1
  14. package/lib/browser/component/terminal.widget.d.ts.map +1 -1
  15. package/lib/browser/component/terminal.widget.js +3 -9
  16. package/lib/browser/component/terminal.widget.js.map +1 -1
  17. package/lib/browser/contribution/terminal.view.d.ts.map +1 -1
  18. package/lib/browser/contribution/terminal.view.js +0 -2
  19. package/lib/browser/contribution/terminal.view.js.map +1 -1
  20. package/lib/browser/links/link-manager.d.ts.map +1 -1
  21. package/lib/browser/links/link-manager.js +7 -10
  22. package/lib/browser/links/link-manager.js.map +1 -1
  23. package/lib/browser/links/validated-local-link-provider.d.ts +0 -1
  24. package/lib/browser/links/validated-local-link-provider.d.ts.map +1 -1
  25. package/lib/browser/links/validated-local-link-provider.js +42 -55
  26. package/lib/browser/links/validated-local-link-provider.js.map +1 -1
  27. package/lib/browser/terminal.client.d.ts +1 -7
  28. package/lib/browser/terminal.client.d.ts.map +1 -1
  29. package/lib/browser/terminal.client.js +2 -9
  30. package/lib/browser/terminal.client.js.map +1 -1
  31. package/lib/browser/terminal.controller.d.ts +2 -1
  32. package/lib/browser/terminal.controller.d.ts.map +1 -1
  33. package/lib/browser/terminal.controller.js +6 -6
  34. package/lib/browser/terminal.controller.js.map +1 -1
  35. package/lib/browser/terminal.hover.manager.d.ts.map +1 -1
  36. package/lib/browser/terminal.hover.manager.js +2 -4
  37. package/lib/browser/terminal.hover.manager.js.map +1 -1
  38. package/lib/browser/terminal.search.d.ts +1 -9
  39. package/lib/browser/terminal.search.d.ts.map +1 -1
  40. package/lib/browser/terminal.search.js +1 -49
  41. package/lib/browser/terminal.search.js.map +1 -1
  42. package/lib/browser/terminal.view.d.ts +5 -6
  43. package/lib/browser/terminal.view.d.ts.map +1 -1
  44. package/lib/browser/terminal.view.js +0 -13
  45. package/lib/browser/terminal.view.js.map +1 -1
  46. package/lib/browser/xterm.d.ts +1 -7
  47. package/lib/browser/xterm.d.ts.map +1 -1
  48. package/lib/browser/xterm.js +1 -12
  49. package/lib/browser/xterm.js.map +1 -1
  50. package/lib/common/client.d.ts +2 -8
  51. package/lib/common/client.d.ts.map +1 -1
  52. package/lib/common/client.js.map +1 -1
  53. package/lib/common/controller.d.ts +0 -16
  54. package/lib/common/controller.d.ts.map +1 -1
  55. package/lib/common/controller.js.map +1 -1
  56. package/lib/common/pty.d.ts +1 -1
  57. package/lib/common/pty.d.ts.map +1 -1
  58. package/lib/common/render.d.ts +0 -3
  59. package/lib/common/render.d.ts.map +1 -1
  60. package/lib/common/render.js.map +1 -1
  61. package/lib/common/xterm.d.ts +2 -8
  62. package/lib/common/xterm.d.ts.map +1 -1
  63. package/lib/common/xterm.js.map +1 -1
  64. package/package.json +18 -18
  65. package/src/browser/component/resize.view.tsx +1 -2
  66. package/src/browser/component/tab.item.tsx +0 -38
  67. package/src/browser/component/tab.view.tsx +0 -12
  68. package/src/browser/component/terminal.module.less +27 -3
  69. package/src/browser/component/terminal.view.tsx +56 -3
  70. package/src/browser/component/terminal.widget.tsx +3 -8
  71. package/src/browser/contribution/terminal.view.ts +0 -2
  72. package/src/browser/links/link-manager.ts +8 -11
  73. package/src/browser/links/validated-local-link-provider.ts +48 -68
  74. package/src/browser/terminal.client.ts +2 -13
  75. package/src/browser/terminal.controller.ts +8 -7
  76. package/src/browser/terminal.hover.manager.ts +4 -4
  77. package/src/browser/terminal.search.ts +2 -49
  78. package/src/browser/terminal.view.ts +0 -17
  79. package/src/browser/xterm.ts +1 -14
  80. package/src/common/client.ts +2 -7
  81. package/src/common/controller.ts +0 -20
  82. package/src/common/pty.ts +1 -1
  83. package/src/common/render.ts +0 -3
  84. package/src/common/xterm-private.d.ts +4 -7
  85. package/src/common/xterm.ts +2 -6
  86. package/lib/browser/component/search.module.less +0 -61
  87. package/lib/browser/component/search.view.d.ts +0 -3
  88. package/lib/browser/component/search.view.d.ts.map +0 -1
  89. package/lib/browser/component/search.view.js +0 -89
  90. package/lib/browser/component/search.view.js.map +0 -1
  91. package/lib/browser/links/word-link-provider.d.ts +0 -29
  92. package/lib/browser/links/word-link-provider.d.ts.map +0 -1
  93. package/lib/browser/links/word-link-provider.js +0 -153
  94. package/lib/browser/links/word-link-provider.js.map +0 -1
  95. package/src/browser/component/search.module.less +0 -61
  96. package/src/browser/component/search.view.tsx +0 -142
  97. package/src/browser/links/word-link-provider.ts +0 -175
@@ -1,7 +1,8 @@
1
+ import cls from 'classnames';
1
2
  import debounce from 'lodash/debounce';
2
3
  import React from 'react';
3
4
 
4
- import { FRAME_THREE, useAutorun, useEventEffect, useInjectable } from '@opensumi/ide-core-browser';
5
+ import { FRAME_THREE, getIcon, localize, useAutorun, useEventEffect, useInjectable } from '@opensumi/ide-core-browser';
5
6
 
6
7
  import {
7
8
  ITerminalController,
@@ -14,7 +15,6 @@ import {
14
15
  } from '../../common';
15
16
 
16
17
  import ResizeView, { ResizeDirection } from './resize.view';
17
- import { TerminalSearch } from './search.view';
18
18
  import styles from './terminal.module.less';
19
19
  import TerminalWidget from './terminal.widget';
20
20
 
@@ -26,6 +26,7 @@ export default () => {
26
26
  const errorService = useInjectable<ITerminalErrorService>(ITerminalErrorService);
27
27
  const network = useInjectable<ITerminalNetwork>(ITerminalNetwork);
28
28
 
29
+ const inputRef = React.useRef<HTMLInputElement>(null);
29
30
  const wrapperRef = React.useRef<HTMLDivElement | null>(null);
30
31
 
31
32
  const view = useInjectable<ITerminalGroupViewService>(ITerminalGroupViewService);
@@ -33,6 +34,19 @@ export default () => {
33
34
  const currentGroupIndex = useAutorun(view.currentGroupIndex);
34
35
  const groups = useAutorun(view.groups);
35
36
 
37
+ React.useEffect(() => {
38
+ const dispose = searchService.onVisibleChange((show) => {
39
+ if (show && inputRef.current) {
40
+ inputRef.current.focus();
41
+
42
+ if (inputRef.current.value.length > 0) {
43
+ inputRef.current.setSelectionRange(0, inputRef.current.value.length);
44
+ }
45
+ }
46
+ });
47
+ return () => dispose.dispose();
48
+ }, [searchService, inputRef.current]);
49
+
36
50
  const [themeBackground, setThemeBackground] = React.useState(controller.themeBackground);
37
51
 
38
52
  useEventEffect(controller.onThemeBackgroundChange, (themeBackground) => {
@@ -64,6 +78,31 @@ export default () => {
64
78
  setIsVisible(visible);
65
79
  });
66
80
 
81
+ const [inputText, setInputText] = React.useState('');
82
+
83
+ const searchInput = React.useCallback(
84
+ (event: React.ChangeEvent<HTMLInputElement>) => {
85
+ searchService.text = event.target.value;
86
+ searchService.search();
87
+ setInputText(event.target.value);
88
+ },
89
+ [searchService],
90
+ );
91
+
92
+ const searchKeyDown = React.useCallback(
93
+ (event: React.KeyboardEvent<HTMLInputElement>) => {
94
+ if (event.key === 'Enter') {
95
+ searchService.search();
96
+ }
97
+
98
+ if (event.key === 'Escape') {
99
+ searchService.close();
100
+ searchService.clear();
101
+ }
102
+ },
103
+ [searchService],
104
+ );
105
+
67
106
  React.useEffect(() => {
68
107
  if (wrapperRef.current) {
69
108
  controller.initContextKey(wrapperRef.current);
@@ -78,7 +117,21 @@ export default () => {
78
117
  style={{ backgroundColor: themeBackground }}
79
118
  data-group-current={currentGroupId}
80
119
  >
81
- {isVisible && <TerminalSearch />}
120
+ {isVisible && (
121
+ <div className={styles.terminalSearch}>
122
+ <div className='kt-input-box'>
123
+ <input
124
+ autoFocus
125
+ ref={inputRef}
126
+ placeholder={localize('common.find')}
127
+ value={inputText}
128
+ onChange={searchInput}
129
+ onKeyDown={searchKeyDown}
130
+ />
131
+ </div>
132
+ <div className={cls(styles.closeBtn, getIcon('close'))} onClick={() => searchService.close()}></div>
133
+ </div>
134
+ )}
82
135
  {groups.map((group, index) => {
83
136
  if (!group.activated.get()) {
84
137
  return;
@@ -68,13 +68,8 @@ export default ({ widget, error, show }: IProps) => {
68
68
  const view = useInjectable<ITerminalGroupViewService>(ITerminalGroupViewService);
69
69
 
70
70
  React.useEffect(() => {
71
- if (content.current && widget.element) {
72
- content.current.appendChild(widget.element);
73
- } else if (content.current && !widget.element) {
74
- const ele = document.createElement('div');
75
- content.current.appendChild(ele);
76
- ele.className = styles.terminalContent;
77
- widget.element = ele;
71
+ if (content.current) {
72
+ widget.element = content.current;
78
73
  }
79
74
  }, []);
80
75
 
@@ -96,7 +91,7 @@ export default ({ widget, error, show }: IProps) => {
96
91
  <div
97
92
  data-term-id={widget.id}
98
93
  style={{ display: error ? 'none' : 'block' }}
99
- className={styles.terminalContentWrapper}
94
+ className={styles.terminalContent}
100
95
  onFocus={onFocus}
101
96
  ref={content}
102
97
  ></div>
@@ -56,8 +56,6 @@ export class TerminalRenderContribution implements ComponentContribution, TabBar
56
56
  activateKeyBinding: 'ctrl+`',
57
57
  containerId: TerminalRenderContribution.viewId,
58
58
  titleComponent: TerminalTabs,
59
- draggable: true,
60
- hideLocationTab: ['right'],
61
59
  },
62
60
  );
63
61
  }
@@ -41,7 +41,6 @@ import {
41
41
  winLineAndColumnMatchIndex,
42
42
  winLocalLinkClause,
43
43
  } from './validated-local-link-provider';
44
- import { TerminalWordLinkProvider } from './word-link-provider';
45
44
 
46
45
  const { posix, win32 } = path;
47
46
 
@@ -137,13 +136,6 @@ export class TerminalLinkManager extends Disposable {
137
136
  ]);
138
137
  this._standardLinkProviders.push(validatedProvider);
139
138
 
140
- const wordLinkProvider = this.injector.get(TerminalWordLinkProvider, [
141
- this._xterm,
142
- async (link, cb) => cb(await this._resolvePath(link)),
143
- wrappedTextLinkActivateCallback,
144
- ]);
145
- this._standardLinkProviders.push(wordLinkProvider);
146
-
147
139
  this._registerStandardLinkProviders();
148
140
  }
149
141
 
@@ -173,8 +165,8 @@ export class TerminalLinkManager extends Disposable {
173
165
  ) {
174
166
  const core = (this._xterm as any)._core as XTermCore;
175
167
  const cellDimensions = {
176
- width: core._renderService.dimensions.css.cell.width,
177
- height: core._renderService.dimensions.css.cell.height,
168
+ width: core._renderService.dimensions.actualCellWidth,
169
+ height: core._renderService.dimensions.actualCellHeight,
178
170
  };
179
171
  const terminalDimensions = {
180
172
  width: this._xterm.cols,
@@ -383,8 +375,13 @@ export class TerminalLinkManager extends Disposable {
383
375
  return undefined;
384
376
  }
385
377
 
378
+ const linkUrl = this.extractLinkUrl(preprocessedLink);
379
+ if (!linkUrl) {
380
+ return undefined;
381
+ }
382
+
386
383
  try {
387
- const uri = URI.file(preprocessedLink);
384
+ const uri = URI.file(linkUrl);
388
385
  const stat = await this._fileService.getFileStat(uri.toString());
389
386
  if (stat) {
390
387
  return { uri, isDirectory: stat.isDirectory };
@@ -138,6 +138,7 @@ export class TerminalValidatedLocalLinkProvider extends TerminalBaseLinkProvider
138
138
  let match;
139
139
  let stringIndex = -1;
140
140
  while ((match = rex.exec(text)) !== null) {
141
+ // const link = match[typeof matcher.matchIndex !== 'number' ? 0 : matcher.matchIndex];
141
142
  let link = match[0];
142
143
  if (!link) {
143
144
  // something matched but does not comply with the given matchIndex
@@ -168,81 +169,60 @@ export class TerminalValidatedLocalLinkProvider extends TerminalBaseLinkProvider
168
169
  link = link.substring(2);
169
170
  stringIndex += 2;
170
171
  }
171
- const validatedLinks = await this.detectLocalLink(link, lines, startLine, stringIndex, 1);
172
172
 
173
- if (validatedLinks.length > 0) {
174
- result.push(...validatedLinks);
175
- }
176
- }
177
-
178
- if (result.length === 0) {
179
- const validatedLinks = await this.detectLocalLink(text, lines, startLine, stringIndex, 2);
180
- if (validatedLinks.length > 0) {
181
- result.push(...validatedLinks);
173
+ // Convert the link text's string index into a wrapped buffer range
174
+ const bufferRange = convertLinkRangeToBuffer(
175
+ lines,
176
+ this._xterm.cols,
177
+ {
178
+ startColumn: stringIndex + 1,
179
+ startLineNumber: 1,
180
+ endColumn: stringIndex + link.length + 1,
181
+ endLineNumber: 1,
182
+ },
183
+ startLine,
184
+ );
185
+
186
+ const validatedLink = await new Promise<TerminalLink | undefined>((r) => {
187
+ this._validationCallback(link, async (result) => {
188
+ if (result) {
189
+ const label = result.isDirectory
190
+ ? (await this._isDirectoryInsideWorkspace(result.uri))
191
+ ? FOLDER_IN_WORKSPACE_LABEL
192
+ : FOLDER_NOT_IN_WORKSPACE_LABEL
193
+ : OPEN_FILE_LABEL;
194
+ const activateCallback = this._wrapLinkHandler((event: MouseEvent | undefined, text: string) => {
195
+ if (result.isDirectory) {
196
+ this._handleLocalFolderLink(result.uri);
197
+ } else {
198
+ this._activateFileCallback(event, text);
199
+ }
200
+ });
201
+ r(
202
+ this.injector.get(TerminalLink, [
203
+ this._xterm,
204
+ bufferRange,
205
+ link,
206
+ this._xterm.buffer.active.viewportY,
207
+ activateCallback,
208
+ this._tooltipCallback,
209
+ true,
210
+ label,
211
+ ]),
212
+ );
213
+ } else {
214
+ r(undefined);
215
+ }
216
+ });
217
+ });
218
+ if (validatedLink) {
219
+ result.push(validatedLink);
182
220
  }
183
221
  }
184
222
 
185
223
  return result;
186
224
  }
187
225
 
188
- private async detectLocalLink(
189
- text: string,
190
- bufferLines: IBufferLine[],
191
- startLine: number,
192
- stringIndex: number,
193
- offset,
194
- ) {
195
- const result: TerminalLink[] = [];
196
- const validatedLink = await new Promise<TerminalLink | undefined>((r) => {
197
- this._validationCallback(text, async (result) => {
198
- if (result) {
199
- const label = result.isDirectory
200
- ? (await this._isDirectoryInsideWorkspace(result.uri))
201
- ? FOLDER_IN_WORKSPACE_LABEL
202
- : FOLDER_NOT_IN_WORKSPACE_LABEL
203
- : OPEN_FILE_LABEL;
204
- const activateCallback = this._wrapLinkHandler((event: MouseEvent | undefined, text: string) => {
205
- if (result.isDirectory) {
206
- this._handleLocalFolderLink(result.uri);
207
- } else {
208
- this._activateFileCallback(event, text);
209
- }
210
- });
211
- // Convert the link text's string index into a wrapped buffer range
212
- const bufferRange = convertLinkRangeToBuffer(
213
- bufferLines,
214
- this._xterm.cols,
215
- {
216
- startColumn: stringIndex + 1,
217
- startLineNumber: 1,
218
- endColumn: stringIndex + text.length + offset,
219
- endLineNumber: 1,
220
- },
221
- startLine,
222
- );
223
- r(
224
- this.injector.get(TerminalLink, [
225
- this._xterm,
226
- bufferRange,
227
- text,
228
- this._xterm.buffer.active.viewportY,
229
- activateCallback,
230
- this._tooltipCallback,
231
- true,
232
- label,
233
- ]),
234
- );
235
- } else {
236
- r(undefined);
237
- }
238
- });
239
- });
240
- if (validatedLink) {
241
- result.push(validatedLink);
242
- }
243
- return result;
244
- }
245
-
246
226
  protected get _localLinkRegex(): RegExp {
247
227
  const baseLocalLinkClause = this._client.os === OperatingSystem.Windows ? winLocalLinkClause : unixLocalLinkClause;
248
228
  // Append line and column number regex
@@ -1,5 +1,3 @@
1
- import { ISearchOptions } from '@xterm/addon-search';
2
-
3
1
  import { Autowired, INJECTOR_TOKEN, Injectable, Injector } from '@opensumi/di';
4
2
  import { IEventBus, QuickPickService, TerminalClientAttachEvent, localize } from '@opensumi/ide-core-browser';
5
3
  import { PreferenceService } from '@opensumi/ide-core-browser/lib/preferences/types';
@@ -731,18 +729,9 @@ export class TerminalClient extends Disposable implements ITerminalClient {
731
729
  return this.xterm.raw.paste(text);
732
730
  }
733
731
 
734
- findNext(text: string, searchOptions: ISearchOptions = {}) {
735
- this._checkReady();
736
- return this.xterm.findNext(text, searchOptions);
737
- }
738
-
739
- findPrevious(text: string, searchOptions: ISearchOptions = {}) {
732
+ findNext(text: string) {
740
733
  this._checkReady();
741
- return this.xterm.findPrevious(text, searchOptions);
742
- }
743
-
744
- get onSearchResultsChange() {
745
- return this.xterm.onSearchResultsChange;
734
+ return this.xterm.findNext(text);
746
735
  }
747
736
 
748
737
  closeSearch() {
@@ -23,6 +23,7 @@ import {
23
23
  } from '@opensumi/ide-core-common';
24
24
  import { WorkbenchEditorService } from '@opensumi/ide-editor';
25
25
  import { IMainLayoutService } from '@opensumi/ide-main-layout';
26
+ import { TabBarHandler } from '@opensumi/ide-main-layout/lib/browser/tabbar-handler';
26
27
  import { IThemeService } from '@opensumi/ide-theme';
27
28
 
28
29
  import {
@@ -61,6 +62,7 @@ import { TerminalGroupViewService } from './terminal.view';
61
62
  @Injectable()
62
63
  export class TerminalController extends WithEventBus implements ITerminalController {
63
64
  protected _focus: boolean;
65
+ protected _tabBarHandler: TabBarHandler | undefined;
64
66
  protected _clients: Map<string, ITerminalClient>;
65
67
  protected _onDidOpenTerminal = new Emitter<ITerminalInfo>();
66
68
  protected _onDidCloseTerminal = new Emitter<ITerminalExitEvent>();
@@ -197,10 +199,6 @@ export class TerminalController extends WithEventBus implements ITerminalControl
197
199
  return this._clientId;
198
200
  }
199
201
 
200
- get _tabBarHandler() {
201
- return this.layoutService.getTabbarHandler(TERMINAL_CONTAINER_ID);
202
- }
203
-
204
202
  private async _createClientOrIgnore(widget: IWidget) {
205
203
  if (this._clients.has(widget.id)) {
206
204
  return this._clients.get(widget.id)!;
@@ -399,9 +397,11 @@ export class TerminalController extends WithEventBus implements ITerminalControl
399
397
  }
400
398
 
401
399
  initContextKey(dom: HTMLDivElement) {
402
- this.terminalContextKey = this.injector.get(TerminalContextKey, [dom]);
403
- this.terminalContextKey.isTerminalFocused.set(this._focus);
404
- this.terminalContextKey.isTerminalViewInitialized.set(true);
400
+ if (!this.terminalContextKey) {
401
+ this.terminalContextKey = this.injector.get(TerminalContextKey, [dom]);
402
+ this.terminalContextKey.isTerminalFocused.set(this._focus);
403
+ this.terminalContextKey.isTerminalViewInitialized.set(true);
404
+ }
405
405
  }
406
406
 
407
407
  async firstInitialize() {
@@ -418,6 +418,7 @@ export class TerminalController extends WithEventBus implements ITerminalControl
418
418
  }),
419
419
  ]);
420
420
 
421
+ this._tabBarHandler = this.layoutService.getTabbarHandler(TERMINAL_CONTAINER_ID);
421
422
  this.themeBackground = this.terminalTheme.terminalTheme.background || '';
422
423
 
423
424
  this.addDispose(
@@ -14,12 +14,10 @@ export class TerminalHoverManagerService implements ITerminalHoverManagerService
14
14
  private hoverWidget: HTMLElement | undefined;
15
15
 
16
16
  private appendTerminalHoverOverlay() {
17
- let overlayContainer = document.querySelector('#terminal-link-hover-overlay');
17
+ const overlayContainer = document.querySelector('#ide-overlay');
18
18
 
19
19
  if (!overlayContainer) {
20
- overlayContainer = document.createElement('div');
21
- overlayContainer.id = 'terminal-link-hover-overlay';
22
- document.body.appendChild(overlayContainer);
20
+ throw new Error('ide-overlay is requried');
23
21
  }
24
22
 
25
23
  const overlay = document.createElement('div');
@@ -74,11 +72,13 @@ export class TerminalHoverManagerService implements ITerminalHoverManagerService
74
72
  this.hoverWidget.style.top = `${
75
73
  (viewportRange.start.y - 1) * cellDimensions.height + boundingClientRect.y - TIPS_OFFSET_Y
76
74
  }px`;
75
+
77
76
  let tooltipsLeft = viewportRange.start.x * cellDimensions.width + boundingClientRect.x + TIPS_OFFSET_X;
78
77
  // if the tooltip is too close to the right edge of the terminal, move it to the left
79
78
  if (tooltipsLeft + this.hoverWidget.clientWidth > boundingClientRect.x + boundingClientRect.width) {
80
79
  tooltipsLeft = boundingClientRect.x + boundingClientRect.width - this.hoverWidget.clientWidth - TIPS_OFFSET_X;
81
80
  }
81
+
82
82
  this.hoverWidget.style.left = `${tooltipsLeft}px`;
83
83
  }
84
84
  });
@@ -1,24 +1,11 @@
1
1
  import { Autowired, Injectable } from '@opensumi/di';
2
2
  import { Emitter, Event, debounce } from '@opensumi/ide-core-common';
3
3
 
4
- import {
5
- ITerminalClient,
6
- ITerminalController,
7
- ITerminalGroupViewService,
8
- ITerminalSearchService,
9
- IUIState,
10
- } from '../common';
4
+ import { ITerminalClient, ITerminalController, ITerminalGroupViewService, ITerminalSearchService } from '../common';
11
5
 
12
6
  @Injectable()
13
7
  export class TerminalSearchService implements ITerminalSearchService {
14
8
  protected _isVisible: boolean = false;
15
-
16
- public UIState: IUIState = {
17
- isMatchCase: false,
18
- isUseRegexp: false,
19
- isWholeWord: false,
20
- };
21
-
22
9
  get isVisible() {
23
10
  return this._isVisible;
24
11
  }
@@ -44,10 +31,6 @@ export class TerminalSearchService implements ITerminalSearchService {
44
31
  this.isVisible = true;
45
32
  }
46
33
 
47
- get onResultChange() {
48
- return this.client?.onSearchResultsChange;
49
- }
50
-
51
34
  close() {
52
35
  this.client?.closeSearch();
53
36
  this.isVisible = false;
@@ -62,36 +45,6 @@ export class TerminalSearchService implements ITerminalSearchService {
62
45
 
63
46
  @debounce(150)
64
47
  search() {
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();
48
+ this.client?.findNext(this.text);
96
49
  }
97
50
  }
@@ -275,23 +275,6 @@ export class TerminalGroupViewService implements ITerminalGroupViewService {
275
275
  return this.groups.get()[index];
276
276
  }
277
277
 
278
- swapGroup(i: number, j: number) {
279
- const groups = this.groups.get();
280
-
281
- if (i === -1 || j === -1) {
282
- return;
283
- }
284
-
285
- const newGroups = [...groups];
286
- const temp = newGroups[i];
287
- newGroups[i] = newGroups[j];
288
- newGroups[j] = temp;
289
-
290
- transaction((tx) => {
291
- this.groups.set(newGroups, tx);
292
- });
293
- }
294
-
295
278
  private _doSelectGroup(index: number) {
296
279
  const group = this.getGroup(index);
297
280
  transaction((tx) => {
@@ -177,26 +177,13 @@ export class XTerm extends Disposable implements IXTerm {
177
177
  };
178
178
  }
179
179
 
180
- findNext(text: string, searchOptions: ISearchOptions = {}) {
180
+ findNext(text: string) {
181
181
  const options: ISearchOptions = {
182
182
  decorations: this.getFindColors(),
183
- ...searchOptions,
184
183
  };
185
184
  return this._searchAddon.findNext(text, options);
186
185
  }
187
186
 
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
-
200
187
  closeSearch() {
201
188
  this._searchAddon.clearDecorations();
202
189
  }
@@ -1,5 +1,4 @@
1
- import { ISearchOptions } from '@xterm/addon-search';
2
- import { IEvent, Terminal } from '@xterm/xterm';
1
+ import { Terminal } from '@xterm/xterm';
3
2
 
4
3
  import { Deferred, Disposable, Event, IDisposable } from '@opensumi/ide-core-common';
5
4
 
@@ -117,11 +116,7 @@ export interface ITerminalClient extends Disposable {
117
116
  *
118
117
  * @param text 用户输入的字符串
119
118
  */
120
- findNext(text: string, searchOptions?: ISearchOptions): void;
121
-
122
- findPrevious(text: string, searchOptions?: ISearchOptions): void;
123
-
124
- onSearchResultsChange: IEvent<{ resultIndex: number; resultCount: number }>;
119
+ findNext(text: string): void;
125
120
 
126
121
  closeSearch(): void;
127
122
 
@@ -1,5 +1,3 @@
1
- import { IEvent } from '@xterm/xterm';
2
-
3
1
  import { IContextKeyService } from '@opensumi/ide-core-browser';
4
2
  import { Deferred, Disposable, Event, IDisposable, Uri } from '@opensumi/ide-core-common';
5
3
  import { IObservable } from '@opensumi/ide-monaco/lib/common/observable';
@@ -115,23 +113,10 @@ export interface ITerminalController extends Disposable {
115
113
  registerLinkProvider(provider: ITerminalExternalLinkProvider): IDisposable;
116
114
  }
117
115
 
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
-
129
116
  export const ITerminalSearchService = Symbol('ITerminalSearchService');
130
117
  export interface ITerminalSearchService {
131
118
  isVisible: boolean;
132
119
  onVisibleChange: Event<boolean>;
133
- UIState: IUIState;
134
- onResultChange: IEvent<ISearchResult> | undefined;
135
120
 
136
121
  text: string;
137
122
 
@@ -139,9 +124,6 @@ export interface ITerminalSearchService {
139
124
  clear(): void;
140
125
  close(): void;
141
126
  search(): void;
142
- searchNext(): void;
143
- searchPrevious(): void;
144
- updateUIState(state: Partial<IUIState>): void;
145
127
  }
146
128
 
147
129
  export const ITerminalGroupViewService = Symbol('ITerminalGroupViewService');
@@ -158,8 +140,6 @@ export interface ITerminalGroupViewService {
158
140
  selectGroup(index: number): void;
159
141
  removeGroup(index: number): void;
160
142
 
161
- swapGroup(i: number, j: number): void;
162
-
163
143
  createWidget(group: IWidgetGroup, id?: string, reuse?: boolean, isSimpleWidget?: boolean): IWidget;
164
144
  getWidget(id: string): IWidget;
165
145
  selectWidget(widgetId: string): void;
package/src/common/pty.ts CHANGED
@@ -539,7 +539,7 @@ export interface IShellLaunchConfig {
539
539
  /**
540
540
  * The color ID to use for this terminal. If not specified it will use the default fallback
541
541
  */
542
- color?: string | vscode.ThemeColor;
542
+ color?: vscode.ThemeColor;
543
543
 
544
544
  /**
545
545
  * When a parent terminal is provided via API, the group needs
@@ -18,11 +18,8 @@ export interface ItemProps {
18
18
  onDropdown?: (event: React.MouseEvent<HTMLElement>) => void;
19
19
  onContextMenu?: (event: React.MouseEvent<HTMLElement>) => void;
20
20
  getKeybinding?: (command: string) => string;
21
- onDrop?: (event: React.DragEvent) => void;
22
- onDragStart?: (event: React.DragEvent) => void;
23
21
  provider: ITerminalRenderProvider;
24
22
  theme: ThemeType;
25
- draggable?: boolean;
26
23
  }
27
24
 
28
25
  export const ITerminalRenderProvider = Symbol('TerminalRenderProvider');
@@ -25,16 +25,13 @@ export interface XTermCore {
25
25
 
26
26
  _renderService: {
27
27
  dimensions: {
28
- css: {
29
- cell: {
30
- width: number;
31
- height: number;
32
- };
33
- };
28
+ actualCellWidth: number;
29
+ actualCellHeight: number;
34
30
  };
35
31
  _renderer: {
36
- value?: unknown;
32
+ _renderLayers: any[];
37
33
  };
34
+ _onIntersectionChange: any;
38
35
  };
39
36
  }
40
37