@codingame/monaco-vscode-xterm-common 24.1.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 (45) hide show
  1. package/empty.js +1 -0
  2. package/package.json +45 -0
  3. package/vscode/src/vs/platform/terminal/common/capabilities/naiveCwdDetectionCapability.d.ts +11 -0
  4. package/vscode/src/vs/platform/terminal/common/capabilities/naiveCwdDetectionCapability.js +26 -0
  5. package/vscode/src/vs/platform/terminal/common/environmentVariable.d.ts +86 -0
  6. package/vscode/src/vs/platform/terminal/common/environmentVariable.js +10 -0
  7. package/vscode/src/vs/platform/terminal/common/environmentVariableCollection.d.ts +17 -0
  8. package/vscode/src/vs/platform/terminal/common/environmentVariableCollection.js +214 -0
  9. package/vscode/src/vs/platform/terminal/common/terminalRecorder.d.ts +14 -0
  10. package/vscode/src/vs/platform/terminal/common/terminalRecorder.js +75 -0
  11. package/vscode/src/vs/workbench/contrib/terminal/browser/environmentVariableInfo.d.ts +28 -0
  12. package/vscode/src/vs/workbench/contrib/terminal/browser/environmentVariableInfo.js +125 -0
  13. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalActions.d.ts +104 -0
  14. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalActions.js +1554 -0
  15. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalContextMenu.d.ts +19 -0
  16. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalContextMenu.js +45 -0
  17. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalIconPicker.d.ts +12 -0
  18. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalIconPicker.js +82 -0
  19. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalInstance.d.ts +408 -0
  20. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalInstance.js +2338 -0
  21. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalProcessManager.d.ts +143 -0
  22. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalProcessManager.js +684 -0
  23. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalResizeDebouncer.d.ts +17 -0
  24. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalResizeDebouncer.js +68 -0
  25. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalStatusList.d.ts +57 -0
  26. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalStatusList.js +135 -0
  27. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalTabsList.d.ts +40 -0
  28. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalTabsList.js +754 -0
  29. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalTooltip.d.ts +10 -0
  30. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalTooltip.js +112 -0
  31. package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/lineDataEventAddon.d.ts +17 -0
  32. package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/lineDataEventAddon.js +59 -0
  33. package/vscode/src/vs/workbench/contrib/terminal/common/terminalEnvironment.d.ts +38 -0
  34. package/vscode/src/vs/workbench/contrib/terminal/common/terminalEnvironment.js +319 -0
  35. package/vscode/src/vs/workbench/contrib/terminal/common/terminalStorageKeys.d.ts +12 -0
  36. package/vscode/src/vs/workbench/contrib/terminal/common/terminalStorageKeys.js +17 -0
  37. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChat.d.ts +58 -0
  38. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChat.js +69 -0
  39. package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/media/stickyScroll.css +49 -0
  40. package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollColorRegistry.d.ts +2 -0
  41. package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollColorRegistry.js +25 -0
  42. package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollContribution.d.ts +35 -0
  43. package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollContribution.js +117 -0
  44. package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollOverlay.d.ts +56 -0
  45. package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollOverlay.js +428 -0
@@ -0,0 +1,428 @@
1
+
2
+ import { registerCss } from '@codingame/monaco-vscode-api/css';
3
+ import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
4
+ import { addStandardDisposableListener, $, addDisposableListener, getWindow } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
5
+ import { debounce, throttle } from '@codingame/monaco-vscode-api/vscode/vs/base/common/decorators';
6
+ import { Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
7
+ import { Disposable, MutableDisposable, combinedDisposable, toDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
8
+ import { removeAnsiEscapeCodes } from '@codingame/monaco-vscode-api/vscode/vs/base/common/strings';
9
+ import * as stickyScroll from './media/stickyScroll.css';
10
+ import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
11
+ import { MenuId } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions';
12
+ import { IMenuService } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions.service';
13
+ import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
14
+ import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
15
+ import { IContextMenuService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextview/browser/contextView.service';
16
+ import { IKeybindingService } from '@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybinding.service';
17
+ import { isFullTerminalCommand } from '@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/capabilities/commandDetection/terminalCommand';
18
+ import { IThemeService } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service';
19
+ import { ITerminalConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminal.service';
20
+ import { openContextMenu } from '../../../terminal/browser/terminalContextMenu.js';
21
+ import { TERMINAL_CONFIG_SECTION, TerminalCommandId } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/common/terminal';
22
+ import { terminalStrings } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/common/terminalStrings';
23
+ import { TerminalStickyScrollSettingId } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminalContrib/stickyScroll/common/terminalStickyScrollConfiguration';
24
+ import { terminalStickyScrollHoverBackground, terminalStickyScrollBackground } from './terminalStickyScrollColorRegistry.js';
25
+ import { XtermAddonImporter } from '@codingame/monaco-vscode-xterm-addons-common/vscode/vs/workbench/contrib/terminal/browser/xterm/xtermAddonImporter';
26
+
27
+ registerCss(stickyScroll);
28
+ var OverlayState;
29
+ (function (OverlayState) {
30
+ OverlayState[OverlayState["Off"] = 0] = "Off";
31
+ OverlayState[OverlayState["On"] = 1] = "On";
32
+ })(OverlayState || (OverlayState = {}));
33
+ var CssClasses;
34
+ (function (CssClasses) {
35
+ CssClasses["Visible"] = "visible";
36
+ })(CssClasses || (CssClasses = {}));
37
+ var Constants;
38
+ (function (Constants) {
39
+ Constants[Constants["StickyScrollPercentageCap"] = 0.4] = "StickyScrollPercentageCap";
40
+ })(Constants || (Constants = {}));
41
+ let TerminalStickyScrollOverlay = class TerminalStickyScrollOverlay extends Disposable {
42
+ constructor(_instance, _xterm, _xtermColorProvider, _commandDetection, xtermCtor, configurationService, contextKeyService, _contextMenuService, _keybindingService, menuService, _terminalConfigurationService, _themeService) {
43
+ super();
44
+ this._instance = _instance;
45
+ this._xterm = _xterm;
46
+ this._xtermColorProvider = _xtermColorProvider;
47
+ this._commandDetection = _commandDetection;
48
+ this._contextMenuService = _contextMenuService;
49
+ this._keybindingService = _keybindingService;
50
+ this._terminalConfigurationService = _terminalConfigurationService;
51
+ this._themeService = _themeService;
52
+ this._xtermAddonLoader = ( new XtermAddonImporter());
53
+ this._refreshListeners = this._register(( new MutableDisposable()));
54
+ this._state = OverlayState.Off;
55
+ this._isRefreshQueued = false;
56
+ this._rawMaxLineCount = 5;
57
+ this._pendingShowOperation = false;
58
+ this._contextMenu = this._register(menuService.createMenu(MenuId.TerminalStickyScrollContext, contextKeyService));
59
+ this._register(Event.runAndSubscribe(this._xterm.raw.buffer.onBufferChange, buffer => {
60
+ this._setState((buffer ?? this._xterm.raw.buffer.active).type === 'normal' ? OverlayState.On : OverlayState.Off);
61
+ }));
62
+ this._register(Event.runAndSubscribe(configurationService.onDidChangeConfiguration, e => {
63
+ if (!e || e.affectsConfiguration(TerminalStickyScrollSettingId.MaxLineCount)) {
64
+ this._rawMaxLineCount = configurationService.getValue(TerminalStickyScrollSettingId.MaxLineCount);
65
+ }
66
+ }));
67
+ this._register(this._instance.onDidChangeTarget(() => this._syncOptions()));
68
+ xtermCtor.then(ctor => {
69
+ if (this._store.isDisposed) {
70
+ return;
71
+ }
72
+ this._stickyScrollOverlay = this._register(( new ctor({
73
+ rows: 1,
74
+ cols: this._xterm.raw.cols,
75
+ allowProposedApi: true,
76
+ ...this._getOptions()
77
+ })));
78
+ this._refreshGpuAcceleration();
79
+ this._register(configurationService.onDidChangeConfiguration(e => {
80
+ if (e.affectsConfiguration(TERMINAL_CONFIG_SECTION)) {
81
+ this._syncOptions();
82
+ }
83
+ }));
84
+ this._register(this._themeService.onDidColorThemeChange(() => {
85
+ this._syncOptions();
86
+ }));
87
+ this._register(this._xterm.raw.onResize(() => {
88
+ this._syncOptions();
89
+ this._refresh();
90
+ }));
91
+ this._register(this._instance.onDidChangeVisibility(isVisible => {
92
+ if (isVisible) {
93
+ this._refresh();
94
+ }
95
+ }));
96
+ this._xtermAddonLoader.importAddon('serialize').then(SerializeAddon => {
97
+ if (this._store.isDisposed) {
98
+ return;
99
+ }
100
+ this._serializeAddon = this._register(( new SerializeAddon()));
101
+ this._xterm.raw.loadAddon(this._serializeAddon);
102
+ this._refresh();
103
+ });
104
+ });
105
+ }
106
+ lockHide() {
107
+ this._element?.classList.add('lock-hide');
108
+ }
109
+ unlockHide() {
110
+ this._element?.classList.remove('lock-hide');
111
+ }
112
+ _setState(state) {
113
+ if (this._state === state) {
114
+ return;
115
+ }
116
+ switch (state) {
117
+ case OverlayState.Off: {
118
+ this._setVisible(false);
119
+ this._uninstallRefreshListeners();
120
+ break;
121
+ }
122
+ case OverlayState.On: {
123
+ this._refresh();
124
+ this._installRefreshListeners();
125
+ break;
126
+ }
127
+ }
128
+ }
129
+ _installRefreshListeners() {
130
+ if (!this._refreshListeners.value) {
131
+ this._refreshListeners.value = combinedDisposable(Event.any(this._xterm.raw.onScroll, this._xterm.raw.onLineFeed,
132
+ this._xterm.raw.onCursorMove)(() => this._refresh()),
133
+ addStandardDisposableListener(this._xterm.raw.element.querySelector('.xterm-viewport'), 'scroll', () => this._refresh()));
134
+ }
135
+ }
136
+ _uninstallRefreshListeners() {
137
+ this._refreshListeners.clear();
138
+ }
139
+ _setVisible(isVisible) {
140
+ if (isVisible) {
141
+ this._pendingShowOperation = true;
142
+ this._show();
143
+ }
144
+ else {
145
+ this._hide();
146
+ }
147
+ }
148
+ _show() {
149
+ if (this._pendingShowOperation) {
150
+ this._ensureElement();
151
+ this._element?.classList.toggle(CssClasses.Visible, true);
152
+ }
153
+ this._pendingShowOperation = false;
154
+ }
155
+ _hide() {
156
+ this._pendingShowOperation = false;
157
+ this._element?.classList.toggle(CssClasses.Visible, false);
158
+ }
159
+ _refresh() {
160
+ if (this._isRefreshQueued) {
161
+ return;
162
+ }
163
+ this._isRefreshQueued = true;
164
+ queueMicrotask(() => {
165
+ this._refreshNow();
166
+ this._isRefreshQueued = false;
167
+ });
168
+ }
169
+ _refreshNow() {
170
+ const command = this._commandDetection.getCommandForLine(this._xterm.raw.buffer.active.viewportY);
171
+ this._currentStickyCommand = undefined;
172
+ if (!command || this._isClearCommand(command)) {
173
+ this._setVisible(false);
174
+ return;
175
+ }
176
+ if (!isFullTerminalCommand(command)) {
177
+ const partialCommand = this._commandDetection.currentCommand;
178
+ if (partialCommand?.commandStartMarker && partialCommand.commandExecutedMarker) {
179
+ this._updateContent(partialCommand, partialCommand.commandStartMarker);
180
+ return;
181
+ }
182
+ this._setVisible(false);
183
+ return;
184
+ }
185
+ const marker = command.marker;
186
+ if (!marker || marker.line === -1) {
187
+ this._setVisible(false);
188
+ return;
189
+ }
190
+ this._updateContent(command, marker);
191
+ }
192
+ _updateContent(command, startMarker) {
193
+ const xterm = this._xterm.raw;
194
+ if (!xterm.element?.parentElement || !this._stickyScrollOverlay || !this._serializeAddon) {
195
+ return;
196
+ }
197
+ if (command.promptStartMarker?.line === -1) {
198
+ this._setVisible(false);
199
+ return;
200
+ }
201
+ const buffer = xterm.buffer.active;
202
+ const promptRowCount = command.getPromptRowCount();
203
+ const commandRowCount = command.getCommandRowCount();
204
+ const stickyScrollLineStart = startMarker.line - (promptRowCount - 1);
205
+ const isPartialCommand = !isFullTerminalCommand(command);
206
+ const rowOffset = !isPartialCommand && command.endMarker ? Math.max(buffer.viewportY - command.endMarker.line + 1, 0) : 0;
207
+ const maxLineCount = Math.min(this._rawMaxLineCount, Math.floor(xterm.rows * Constants.StickyScrollPercentageCap));
208
+ const stickyScrollLineCount = Math.min(promptRowCount + commandRowCount - 1, maxLineCount) - rowOffset;
209
+ const isTruncated = stickyScrollLineCount < promptRowCount + commandRowCount - 1;
210
+ if (buffer.viewportY <= stickyScrollLineStart) {
211
+ this._setVisible(false);
212
+ return;
213
+ }
214
+ if (isPartialCommand && buffer.viewportY === buffer.baseY && buffer.cursorY === xterm.rows - 1) {
215
+ const line = buffer.getLine(buffer.baseY + xterm.rows - 1);
216
+ if ((buffer.cursorX === 1 && lineStartsWith(line, ':')) ||
217
+ (buffer.cursorX === 5 && lineStartsWith(line, '(END)'))) {
218
+ this._setVisible(false);
219
+ return;
220
+ }
221
+ }
222
+ const content = this._serializeAddon.serialize({
223
+ range: {
224
+ start: stickyScrollLineStart + rowOffset,
225
+ end: stickyScrollLineStart + rowOffset + Math.max(stickyScrollLineCount - 1, 0)
226
+ }
227
+ }) + (isTruncated ? '\x1b[0m …' : '');
228
+ if (isPartialCommand && removeAnsiEscapeCodes(content).length === 0) {
229
+ this._setVisible(false);
230
+ return;
231
+ }
232
+ if (content && this._currentContent !== content ||
233
+ this._stickyScrollOverlay.cols !== xterm.cols ||
234
+ this._stickyScrollOverlay.rows !== stickyScrollLineCount) {
235
+ this._stickyScrollOverlay.resize(this._stickyScrollOverlay.cols, stickyScrollLineCount);
236
+ this._stickyScrollOverlay.write('\x1b[0m\x1b[H\x1b[2J');
237
+ this._stickyScrollOverlay.write(content);
238
+ this._currentContent = content;
239
+ }
240
+ if (content) {
241
+ this._currentStickyCommand = command;
242
+ this._setVisible(true);
243
+ if (this._element) {
244
+ const termBox = xterm.element.getBoundingClientRect();
245
+ if (termBox.height > 0) {
246
+ const rowHeight = termBox.height / xterm.rows;
247
+ const overlayHeight = stickyScrollLineCount * rowHeight;
248
+ let endMarkerOffset = 0;
249
+ if (!isPartialCommand && command.endMarker && command.endMarker.line !== -1) {
250
+ const lastLine = Math.min(command.endMarker.line, buffer.baseY + buffer.cursorY);
251
+ if (buffer.viewportY + stickyScrollLineCount > lastLine) {
252
+ const diff = buffer.viewportY + stickyScrollLineCount - lastLine;
253
+ endMarkerOffset = diff * rowHeight;
254
+ }
255
+ }
256
+ this._element.style.bottom = `${termBox.height - overlayHeight + 1 + endMarkerOffset}px`;
257
+ }
258
+ }
259
+ }
260
+ else {
261
+ this._setVisible(false);
262
+ }
263
+ }
264
+ _ensureElement() {
265
+ if (
266
+ this._element ||
267
+ !this._stickyScrollOverlay ||
268
+ !this._xterm?.raw.element?.parentElement) {
269
+ return;
270
+ }
271
+ const overlay = this._stickyScrollOverlay;
272
+ const hoverOverlay = $('.hover-overlay');
273
+ this._element = $('.terminal-sticky-scroll', undefined, hoverOverlay);
274
+ this._xterm.raw.element.parentElement.append(this._element);
275
+ this._register(toDisposable(() => this._element?.remove()));
276
+ let hoverTitle = ( localize(12219, 'Navigate to Command'));
277
+ const scrollToPreviousCommandKeybinding = this._keybindingService.lookupKeybinding(TerminalCommandId.ScrollToPreviousCommand);
278
+ if (scrollToPreviousCommandKeybinding) {
279
+ const label = scrollToPreviousCommandKeybinding.getLabel();
280
+ if (label) {
281
+ hoverTitle += '\n' + ( localize(12220, "{0} ({1})", terminalStrings.scrollToPreviousCommand.value, label));
282
+ }
283
+ }
284
+ const scrollToNextCommandKeybinding = this._keybindingService.lookupKeybinding(TerminalCommandId.ScrollToNextCommand);
285
+ if (scrollToNextCommandKeybinding) {
286
+ const label = scrollToNextCommandKeybinding.getLabel();
287
+ if (label) {
288
+ hoverTitle += '\n' + ( localize(12220, "{0} ({1})", terminalStrings.scrollToNextCommand.value, label));
289
+ }
290
+ }
291
+ hoverOverlay.title = hoverTitle;
292
+ const scrollBarWidth = this._xterm.raw._core.viewport?.scrollBarWidth;
293
+ if (scrollBarWidth !== undefined) {
294
+ this._element.style.right = `${scrollBarWidth}px`;
295
+ }
296
+ this._stickyScrollOverlay.open(this._element);
297
+ this._stickyScrollOverlay.attachCustomKeyEventHandler((event) => {
298
+ if (event.key === 'Tab') {
299
+ return false;
300
+ }
301
+ return true;
302
+ });
303
+ this._xtermAddonLoader.importAddon('ligatures').then(LigaturesAddon => {
304
+ if (this._store.isDisposed || !this._stickyScrollOverlay) {
305
+ return;
306
+ }
307
+ this._ligaturesAddon = ( new LigaturesAddon());
308
+ this._stickyScrollOverlay.loadAddon(this._ligaturesAddon);
309
+ });
310
+ this._register(addStandardDisposableListener(hoverOverlay, 'click', () => {
311
+ if (this._xterm && this._currentStickyCommand) {
312
+ this._xterm.markTracker.revealCommand(this._currentStickyCommand);
313
+ this._instance.focus();
314
+ }
315
+ }));
316
+ this._register(addStandardDisposableListener(hoverOverlay, 'wheel', e => this._xterm?.raw.element?.dispatchEvent(( new WheelEvent(e.type, e)))));
317
+ this._register(addDisposableListener(hoverOverlay, 'mousedown', e => {
318
+ e.stopImmediatePropagation();
319
+ e.preventDefault();
320
+ }));
321
+ this._register(addDisposableListener(hoverOverlay, 'contextmenu', e => {
322
+ e.stopImmediatePropagation();
323
+ e.preventDefault();
324
+ openContextMenu(getWindow(hoverOverlay), e, this._instance, this._contextMenu, this._contextMenuService);
325
+ }));
326
+ this._register(addStandardDisposableListener(hoverOverlay, 'mouseover', () => overlay.options.theme = this._getTheme(true)));
327
+ this._register(addStandardDisposableListener(hoverOverlay, 'mouseleave', () => overlay.options.theme = this._getTheme(false)));
328
+ }
329
+ _syncOptions() {
330
+ if (!this._stickyScrollOverlay) {
331
+ return;
332
+ }
333
+ this._stickyScrollOverlay.resize(this._xterm.raw.cols, this._stickyScrollOverlay.rows);
334
+ this._stickyScrollOverlay.options = this._getOptions();
335
+ this._refreshGpuAcceleration();
336
+ }
337
+ _getOptions() {
338
+ const o = this._xterm.raw.options;
339
+ return {
340
+ cursorInactiveStyle: 'none',
341
+ scrollback: 0,
342
+ logLevel: 'off',
343
+ theme: this._getTheme(false),
344
+ documentOverride: o.documentOverride,
345
+ fontFamily: o.fontFamily,
346
+ fontWeight: o.fontWeight,
347
+ fontWeightBold: o.fontWeightBold,
348
+ fontSize: o.fontSize,
349
+ letterSpacing: o.letterSpacing,
350
+ lineHeight: o.lineHeight,
351
+ drawBoldTextInBrightColors: o.drawBoldTextInBrightColors,
352
+ minimumContrastRatio: o.minimumContrastRatio,
353
+ tabStopWidth: o.tabStopWidth,
354
+ customGlyphs: o.customGlyphs,
355
+ };
356
+ }
357
+ async _refreshGpuAcceleration() {
358
+ if (this._shouldLoadWebgl() && !this._webglAddon) {
359
+ const WebglAddon = await this._xtermAddonLoader.importAddon('webgl');
360
+ if (this._store.isDisposed) {
361
+ return;
362
+ }
363
+ this._webglAddon = this._register(( new WebglAddon()));
364
+ this._stickyScrollOverlay?.loadAddon(this._webglAddon);
365
+ }
366
+ else if (!this._shouldLoadWebgl() && this._webglAddon) {
367
+ this._webglAddon.dispose();
368
+ this._webglAddon = undefined;
369
+ }
370
+ }
371
+ _shouldLoadWebgl() {
372
+ return this._terminalConfigurationService.config.gpuAcceleration === 'auto' || this._terminalConfigurationService.config.gpuAcceleration === 'on';
373
+ }
374
+ _getTheme(isHovering) {
375
+ const theme = this._themeService.getColorTheme();
376
+ return {
377
+ ...this._xterm.getXtermTheme(),
378
+ background: isHovering
379
+ ? theme.getColor(terminalStickyScrollHoverBackground)?.toString() ?? this._xtermColorProvider.getBackgroundColor(theme)?.toString()
380
+ : theme.getColor(terminalStickyScrollBackground)?.toString() ?? this._xtermColorProvider.getBackgroundColor(theme)?.toString(),
381
+ selectionBackground: undefined,
382
+ selectionInactiveBackground: undefined
383
+ };
384
+ }
385
+ _isClearCommand(command) {
386
+ if (!command.command) {
387
+ return false;
388
+ }
389
+ const trimmedCommand = command.command.trim().toLowerCase();
390
+ const clearCommands = [
391
+ 'clear',
392
+ 'cls',
393
+ 'clear-host',
394
+ ];
395
+ return clearCommands.includes(trimmedCommand);
396
+ }
397
+ };
398
+ TerminalStickyScrollOverlay.__decorator = ( __decorate([
399
+ debounce(100)
400
+ ], TerminalStickyScrollOverlay.prototype, "_show", null));
401
+ TerminalStickyScrollOverlay.__decorator = ( __decorate([
402
+ throttle(0)
403
+ ], TerminalStickyScrollOverlay.prototype, "_syncOptions", null));
404
+ TerminalStickyScrollOverlay.__decorator = ( __decorate([
405
+ throttle(0)
406
+ ], TerminalStickyScrollOverlay.prototype, "_refreshGpuAcceleration", null));
407
+ TerminalStickyScrollOverlay = ( __decorate([
408
+ ( __param(5, IConfigurationService)),
409
+ ( __param(6, IContextKeyService)),
410
+ ( __param(7, IContextMenuService)),
411
+ ( __param(8, IKeybindingService)),
412
+ ( __param(9, IMenuService)),
413
+ ( __param(10, ITerminalConfigurationService)),
414
+ ( __param(11, IThemeService))
415
+ ], TerminalStickyScrollOverlay));
416
+ function lineStartsWith(line, text) {
417
+ if (!line) {
418
+ return false;
419
+ }
420
+ for (let i = 0; i < text.length; i++) {
421
+ if (line.getCell(i)?.getChars() !== text[i]) {
422
+ return false;
423
+ }
424
+ }
425
+ return true;
426
+ }
427
+
428
+ export { TerminalStickyScrollOverlay };