@codingame/monaco-vscode-xterm-addons-common 37.1.0 → 37.3.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 (29) hide show
  1. package/package.json +2 -2
  2. package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.d.ts +1 -1
  3. package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.js +3 -3
  4. package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollOverlay.d.ts +58 -0
  5. package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollOverlay.js +462 -0
  6. package/vscode/src/vs/base/browser/htmlToMarkdown.d.ts +0 -1
  7. package/vscode/src/vs/base/browser/htmlToMarkdown.js +0 -144
  8. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContext.d.ts +0 -59
  9. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContext.js +0 -482
  10. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/attachInstructionsAction.d.ts +0 -25
  11. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/attachInstructionsAction.js +0 -95
  12. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/newPromptFileActions.d.ts +0 -24
  13. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/newPromptFileActions.js +0 -355
  14. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptName.d.ts +0 -7
  15. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptName.js +0 -81
  16. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptSourceFolder.d.ts +0 -15
  17. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptSourceFolder.js +0 -181
  18. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/promptFilePickers.d.ts +0 -75
  19. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/promptFilePickers.js +0 -622
  20. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatPasteProviders.d.ts +0 -71
  21. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatPasteProviders.js +0 -800
  22. package/vscode/src/vs/workbench/contrib/git/common/utils.d.ts +0 -8
  23. package/vscode/src/vs/workbench/contrib/git/common/utils.js +0 -105
  24. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalUri.d.ts +0 -18
  25. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalUri.js +0 -51
  26. package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/decorationAddon.d.ts +0 -79
  27. package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/decorationAddon.js +0 -650
  28. package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/markNavigationAddon.d.ts +0 -64
  29. package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/markNavigationAddon.js +0 -564
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-xterm-addons-common",
3
- "version": "37.1.0",
3
+ "version": "37.3.0",
4
4
  "private": false,
5
5
  "description": "VSCode public API plugged on the monaco editor - common package depending on xterm addons",
6
6
  "keywords": [],
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "type": "module",
17
17
  "dependencies": {
18
- "@codingame/monaco-vscode-api": "37.1.0",
18
+ "@codingame/monaco-vscode-api": "37.3.0",
19
19
  "@xterm/addon-clipboard": "0.3.0-beta.303",
20
20
  "@xterm/addon-image": "0.10.0-beta.301",
21
21
  "@xterm/addon-ligatures": "0.11.0-beta.301",
@@ -8,7 +8,7 @@ import { ITerminalFont } from "@codingame/monaco-vscode-api/vscode/vs/workbench/
8
8
  import { IMarkTracker, IInternalXtermTerminal, IXtermTerminal, IXtermColorProvider, IXtermAttachToElementOptions, IDetachedXtermTerminal } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminal";
9
9
  import { ITerminalConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminal.service";
10
10
  import { INotificationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification.service";
11
- import { ScrollPosition } from "./markNavigationAddon.js";
11
+ import { ScrollPosition } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/xterm/markNavigationAddon";
12
12
  import { IColorTheme } from "@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService";
13
13
  import { IThemeService } from "@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service";
14
14
  import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
@@ -9,14 +9,14 @@ import { XtermTerminalConstants } from '@codingame/monaco-vscode-api/vscode/vs/w
9
9
  import { ITerminalConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminal.service';
10
10
  import { LogLevel } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log';
11
11
  import { INotificationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification.service';
12
- import { MarkNavigationAddon, ScrollPosition } from './markNavigationAddon.js';
12
+ import { MarkNavigationAddon, ScrollPosition } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/xterm/markNavigationAddon';
13
13
  import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
14
14
  import { IThemeService } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service';
15
15
  import { PANEL_BACKGROUND } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/theme';
16
16
  import { TERMINAL_BACKGROUND_COLOR, TERMINAL_FIND_MATCH_BACKGROUND_COLOR, TERMINAL_FIND_MATCH_BORDER_COLOR, TERMINAL_OVERVIEW_RULER_CURSOR_FOREGROUND_COLOR, TERMINAL_FIND_MATCH_HIGHLIGHT_BACKGROUND_COLOR, TERMINAL_FIND_MATCH_HIGHLIGHT_BORDER_COLOR, TERMINAL_OVERVIEW_RULER_FIND_MATCH_FOREGROUND_COLOR, TERMINAL_FOREGROUND_COLOR, TERMINAL_CURSOR_FOREGROUND_COLOR, TERMINAL_CURSOR_BACKGROUND_COLOR, TERMINAL_SELECTION_BACKGROUND_COLOR, TERMINAL_INACTIVE_SELECTION_BACKGROUND_COLOR, TERMINAL_SELECTION_FOREGROUND_COLOR, ansiColorIdentifiers, TERMINAL_OVERVIEW_RULER_BORDER_COLOR } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/common/terminalColorRegistry';
17
17
  import { ShellIntegrationAddon } from '@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/xterm/shellIntegrationAddon';
18
18
  import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
19
- import { DecorationAddon } from './decorationAddon.js';
19
+ import { DecorationAddon } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/xterm/decorationAddon';
20
20
  import { TerminalCapability } from '@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/capabilities/capabilities';
21
21
  import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
22
22
  import { ITelemetryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service';
@@ -778,7 +778,7 @@ let XtermTerminal = class XtermTerminal extends Disposable {
778
778
  await this._clipboardService.writeText(this.raw.getSelection());
779
779
  }
780
780
  } else {
781
- this._notificationService.warn(( localize(17023, "The terminal has no selection to copy")));
781
+ this._notificationService.warn(( localize(19166, "The terminal has no selection to copy")));
782
782
  }
783
783
  }
784
784
  _setCursorBlink(blink) {
@@ -0,0 +1,58 @@
1
+ import type { Terminal as RawXtermTerminal, Terminal as XTermTerminal } from "@xterm/xterm";
2
+ import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
3
+ import { IMenuService } from "@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions.service";
4
+ import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
5
+ import { IContextKeyService } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service";
6
+ import { IContextMenuService } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextview/browser/contextView.service";
7
+ import { IKeybindingService } from "@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybinding.service";
8
+ import { ICommandDetectionCapability } from "@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/capabilities/capabilities";
9
+ import { IThemeService } from "@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service";
10
+ import { ITerminalInstance, IXtermColorProvider, IXtermTerminal } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminal";
11
+ import { ITerminalConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminal.service";
12
+ export declare class TerminalStickyScrollOverlay extends Disposable {
13
+ private readonly _instance;
14
+ private readonly _xterm;
15
+ private readonly _xtermColorProvider;
16
+ private readonly _commandDetection;
17
+ private readonly _contextMenuService;
18
+ private readonly _keybindingService;
19
+ private readonly _terminalConfigurationService;
20
+ private readonly _themeService;
21
+ private _stickyScrollOverlay?;
22
+ private readonly _xtermAddonLoader;
23
+ private _serializeAddon?;
24
+ private readonly _webglAddon;
25
+ private _webglAddonCustomGlyphs?;
26
+ private _ligaturesAddon?;
27
+ private _element?;
28
+ private _currentStickyCommand?;
29
+ private _currentContent?;
30
+ private _contextMenu;
31
+ private readonly _refreshListeners;
32
+ private _state;
33
+ private _isRefreshQueued;
34
+ private _rawMaxLineCount;
35
+ private _ignoredCommands;
36
+ private _pendingShowOperation;
37
+ constructor(_instance: ITerminalInstance, _xterm: IXtermTerminal & {
38
+ raw: RawXtermTerminal;
39
+ }, _xtermColorProvider: IXtermColorProvider, _commandDetection: ICommandDetectionCapability, xtermCtor: Promise<typeof XTermTerminal>, configurationService: IConfigurationService, contextKeyService: IContextKeyService, _contextMenuService: IContextMenuService, _keybindingService: IKeybindingService, menuService: IMenuService, _terminalConfigurationService: ITerminalConfigurationService, _themeService: IThemeService);
40
+ lockHide(): void;
41
+ unlockHide(): void;
42
+ private _setState;
43
+ private _installRefreshListeners;
44
+ private _uninstallRefreshListeners;
45
+ private _setVisible;
46
+ private _show;
47
+ private _hide;
48
+ private _refresh;
49
+ private _refreshNow;
50
+ private _updateContent;
51
+ private _ensureElement;
52
+ private _syncOptions;
53
+ private _getOptions;
54
+ private _refreshGpuAcceleration;
55
+ private _shouldLoadWebgl;
56
+ private _getTheme;
57
+ private _isIgnoredCommand;
58
+ }
@@ -0,0 +1,462 @@
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 '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminalContrib/stickyScroll/browser/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 '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminalContextMenu';
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 '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollColorRegistry';
25
+ import { XtermAddonImporter } from '../../../terminal/browser/xterm/xtermAddonImporter.js';
26
+
27
+ registerCss(stickyScroll, 1);
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(
43
+ _instance,
44
+ _xterm,
45
+ _xtermColorProvider,
46
+ _commandDetection,
47
+ xtermCtor,
48
+ configurationService,
49
+ contextKeyService,
50
+ _contextMenuService,
51
+ _keybindingService,
52
+ menuService,
53
+ _terminalConfigurationService,
54
+ _themeService
55
+ ) {
56
+ super();
57
+ this._instance = _instance;
58
+ this._xterm = _xterm;
59
+ this._xtermColorProvider = _xtermColorProvider;
60
+ this._commandDetection = _commandDetection;
61
+ this._contextMenuService = _contextMenuService;
62
+ this._keybindingService = _keybindingService;
63
+ this._terminalConfigurationService = _terminalConfigurationService;
64
+ this._themeService = _themeService;
65
+ this._xtermAddonLoader = ( new XtermAddonImporter());
66
+ this._webglAddon = this._register(( new MutableDisposable()));
67
+ this._refreshListeners = this._register(( new MutableDisposable()));
68
+ this._state = OverlayState.Off;
69
+ this._isRefreshQueued = false;
70
+ this._rawMaxLineCount = 5;
71
+ this._ignoredCommands = [];
72
+ this._pendingShowOperation = false;
73
+ this._contextMenu = this._register(
74
+ menuService.createMenu(MenuId.TerminalStickyScrollContext, contextKeyService)
75
+ );
76
+ this._register(Event.runAndSubscribe(this._xterm.raw.buffer.onBufferChange, buffer => {
77
+ this._setState(
78
+ (buffer ?? this._xterm.raw.buffer.active).type === "normal" ? OverlayState.On : OverlayState.Off
79
+ );
80
+ }));
81
+ this._register(
82
+ Event.runAndSubscribe(configurationService.onDidChangeConfiguration, e => {
83
+ if (!e || e.affectsConfiguration(TerminalStickyScrollSettingId.MaxLineCount)) {
84
+ this._rawMaxLineCount = configurationService.getValue(TerminalStickyScrollSettingId.MaxLineCount);
85
+ }
86
+ if (!e || e.affectsConfiguration(TerminalStickyScrollSettingId.IgnoredCommands)) {
87
+ this._ignoredCommands = configurationService.getValue(TerminalStickyScrollSettingId.IgnoredCommands);
88
+ }
89
+ })
90
+ );
91
+ this._register(this._instance.onDidChangeTarget(() => this._syncOptions()));
92
+ xtermCtor.then(ctor => {
93
+ if (this._store.isDisposed) {
94
+ return;
95
+ }
96
+ this._stickyScrollOverlay = this._register(( new ctor({
97
+ rows: 1,
98
+ cols: this._xterm.raw.cols,
99
+ allowProposedApi: true,
100
+ ...this._getOptions()
101
+ })));
102
+ this._refreshGpuAcceleration();
103
+ this._register(configurationService.onDidChangeConfiguration(e => {
104
+ if (e.affectsConfiguration(TERMINAL_CONFIG_SECTION)) {
105
+ this._syncOptions();
106
+ }
107
+ }));
108
+ this._register(this._themeService.onDidColorThemeChange(() => {
109
+ this._syncOptions();
110
+ }));
111
+ this._register(this._xterm.raw.onResize(() => {
112
+ this._syncOptions();
113
+ this._refresh();
114
+ }));
115
+ this._register(this._instance.onDidChangeVisibility(isVisible => {
116
+ if (isVisible) {
117
+ this._refresh();
118
+ }
119
+ }));
120
+ this._xtermAddonLoader.importAddon("serialize").then(SerializeAddon => {
121
+ if (this._store.isDisposed) {
122
+ return;
123
+ }
124
+ this._serializeAddon = this._register(( new SerializeAddon()));
125
+ this._xterm.raw.loadAddon(this._serializeAddon);
126
+ this._refresh();
127
+ });
128
+ });
129
+ }
130
+ lockHide() {
131
+ this._element?.classList.add("lock-hide");
132
+ }
133
+ unlockHide() {
134
+ this._element?.classList.remove("lock-hide");
135
+ }
136
+ _setState(state) {
137
+ if (this._state === state) {
138
+ return;
139
+ }
140
+ this._state = state;
141
+ switch (state) {
142
+ case OverlayState.Off:
143
+ {
144
+ this._setVisible(false);
145
+ this._uninstallRefreshListeners();
146
+ break;
147
+ }
148
+ case OverlayState.On:
149
+ {
150
+ this._refresh();
151
+ this._installRefreshListeners();
152
+ break;
153
+ }
154
+ }
155
+ }
156
+ _installRefreshListeners() {
157
+ if (!this._refreshListeners.value) {
158
+ this._refreshListeners.value = combinedDisposable(Event.any(
159
+ this._xterm.raw.onScroll,
160
+ this._xterm.raw.onLineFeed,
161
+ this._xterm.raw.onCursorMove
162
+ )(() => this._refresh()),
163
+ addStandardDisposableListener(
164
+ this._xterm.raw.element.querySelector(".xterm-viewport"),
165
+ "scroll",
166
+ () => this._refresh()
167
+ ));
168
+ }
169
+ }
170
+ _uninstallRefreshListeners() {
171
+ this._refreshListeners.clear();
172
+ }
173
+ _setVisible(isVisible) {
174
+ if (isVisible) {
175
+ this._pendingShowOperation = true;
176
+ this._show();
177
+ } else {
178
+ this._hide();
179
+ }
180
+ }
181
+ _show() {
182
+ if (this._pendingShowOperation) {
183
+ this._ensureElement();
184
+ this._element?.classList.toggle(CssClasses.Visible, true);
185
+ }
186
+ this._pendingShowOperation = false;
187
+ }
188
+ _hide() {
189
+ this._pendingShowOperation = false;
190
+ this._element?.classList.toggle(CssClasses.Visible, false);
191
+ }
192
+ _refresh() {
193
+ if (this._isRefreshQueued) {
194
+ return;
195
+ }
196
+ this._isRefreshQueued = true;
197
+ queueMicrotask(() => {
198
+ this._refreshNow();
199
+ this._isRefreshQueued = false;
200
+ });
201
+ }
202
+ _refreshNow() {
203
+ const command = this._commandDetection.getCommandForLine(this._xterm.raw.buffer.active.viewportY);
204
+ this._currentStickyCommand = undefined;
205
+ if (!command || this._isIgnoredCommand(command)) {
206
+ this._setVisible(false);
207
+ return;
208
+ }
209
+ if (!isFullTerminalCommand(command)) {
210
+ const partialCommand = this._commandDetection.currentCommand;
211
+ if (partialCommand?.commandStartMarker && partialCommand.commandExecutedMarker) {
212
+ this._updateContent(partialCommand, partialCommand.commandStartMarker);
213
+ return;
214
+ }
215
+ this._setVisible(false);
216
+ return;
217
+ }
218
+ const marker = command.marker;
219
+ if (!marker || marker.line === -1) {
220
+ this._setVisible(false);
221
+ return;
222
+ }
223
+ this._updateContent(command, marker);
224
+ }
225
+ _updateContent(command, startMarker) {
226
+ const xterm = this._xterm.raw;
227
+ if (!xterm.element?.parentElement || !this._stickyScrollOverlay || !this._serializeAddon) {
228
+ return;
229
+ }
230
+ if (command.promptStartMarker?.line === -1) {
231
+ this._setVisible(false);
232
+ return;
233
+ }
234
+ const buffer = xterm.buffer.active;
235
+ const promptRowCount = command.getPromptRowCount();
236
+ const commandRowCount = command.getCommandRowCount();
237
+ const stickyScrollLineStart = startMarker.line - (promptRowCount - 1);
238
+ const isPartialCommand = !isFullTerminalCommand(command);
239
+ const rowOffset = !isPartialCommand && command.endMarker ? Math.max(buffer.viewportY - command.endMarker.line + 1, 0) : 0;
240
+ const maxLineCount = Math.min(
241
+ this._rawMaxLineCount,
242
+ Math.floor(xterm.rows * Constants.StickyScrollPercentageCap)
243
+ );
244
+ const stickyScrollLineCount = Math.min(promptRowCount + commandRowCount - 1, maxLineCount) - rowOffset;
245
+ const isTruncated = stickyScrollLineCount < promptRowCount + commandRowCount - 1;
246
+ if (buffer.viewportY <= stickyScrollLineStart) {
247
+ this._setVisible(false);
248
+ return;
249
+ }
250
+ if (isPartialCommand && buffer.viewportY === buffer.baseY && buffer.cursorY === xterm.rows - 1) {
251
+ const line = buffer.getLine(buffer.baseY + xterm.rows - 1);
252
+ if ((buffer.cursorX === 1 && lineStartsWith(line, ":")) || (buffer.cursorX === 5 && lineStartsWith(line, "(END)"))) {
253
+ this._setVisible(false);
254
+ return;
255
+ }
256
+ }
257
+ const content = this._serializeAddon.serialize({
258
+ range: {
259
+ start: stickyScrollLineStart + rowOffset,
260
+ end: stickyScrollLineStart + rowOffset + Math.max(stickyScrollLineCount - 1, 0)
261
+ }
262
+ }) + (isTruncated ? "\u001b[0m …" : "");
263
+ if (isPartialCommand && removeAnsiEscapeCodes(content).length === 0) {
264
+ this._setVisible(false);
265
+ return;
266
+ }
267
+ if (content && this._currentContent !== content || this._stickyScrollOverlay.cols !== xterm.cols || this._stickyScrollOverlay.rows !== stickyScrollLineCount) {
268
+ this._stickyScrollOverlay.resize(this._stickyScrollOverlay.cols, stickyScrollLineCount);
269
+ this._stickyScrollOverlay.write("\u001b[0m\u001b[H\u001b[2J");
270
+ this._stickyScrollOverlay.write(content);
271
+ this._currentContent = content;
272
+ }
273
+ if (content) {
274
+ this._currentStickyCommand = command;
275
+ this._setVisible(true);
276
+ if (this._element) {
277
+ const termBox = xterm.element.getBoundingClientRect();
278
+ if (termBox.height > 0) {
279
+ const rowHeight = termBox.height / xterm.rows;
280
+ const overlayHeight = stickyScrollLineCount * rowHeight;
281
+ let endMarkerOffset = 0;
282
+ if (!isPartialCommand && command.endMarker && command.endMarker.line !== -1) {
283
+ const lastLine = Math.min(command.endMarker.line, buffer.baseY + buffer.cursorY);
284
+ if (buffer.viewportY + stickyScrollLineCount > lastLine) {
285
+ const diff = buffer.viewportY + stickyScrollLineCount - lastLine;
286
+ endMarkerOffset = diff * rowHeight;
287
+ }
288
+ }
289
+ this._element.style.bottom = `${termBox.height - overlayHeight + 1 + endMarkerOffset}px`;
290
+ }
291
+ }
292
+ } else {
293
+ this._setVisible(false);
294
+ }
295
+ }
296
+ _ensureElement() {
297
+ if (
298
+ this._element ||
299
+ !this._stickyScrollOverlay ||
300
+ !this._xterm?.raw.element?.parentElement) {
301
+ return;
302
+ }
303
+ const overlay = this._stickyScrollOverlay;
304
+ const hoverOverlay = $(".hover-overlay");
305
+ this._element = $(".terminal-sticky-scroll", undefined, hoverOverlay);
306
+ this._xterm.raw.element.parentElement.append(this._element);
307
+ this._register(toDisposable(() => this._element?.remove()));
308
+ let hoverTitle = ( localize(19885, "Navigate to Command"));
309
+ const scrollToPreviousCommandKeybinding = this._keybindingService.lookupKeybinding(TerminalCommandId.ScrollToPreviousCommand);
310
+ if (scrollToPreviousCommandKeybinding) {
311
+ const label = scrollToPreviousCommandKeybinding.getLabel();
312
+ if (label) {
313
+ hoverTitle += "\n" + ( localize(19886, "{0} ({1})", terminalStrings.scrollToPreviousCommand.value, label));
314
+ }
315
+ }
316
+ const scrollToNextCommandKeybinding = this._keybindingService.lookupKeybinding(TerminalCommandId.ScrollToNextCommand);
317
+ if (scrollToNextCommandKeybinding) {
318
+ const label = scrollToNextCommandKeybinding.getLabel();
319
+ if (label) {
320
+ hoverTitle += "\n" + ( localize(19886, "{0} ({1})", terminalStrings.scrollToNextCommand.value, label));
321
+ }
322
+ }
323
+ hoverOverlay.title = hoverTitle;
324
+ const scrollBarWidth = this._xterm.raw._core.viewport?.scrollBarWidth;
325
+ if (scrollBarWidth !== undefined) {
326
+ this._element.style.right = `${scrollBarWidth}px`;
327
+ }
328
+ this._stickyScrollOverlay.open(this._element);
329
+ this._stickyScrollOverlay.attachCustomKeyEventHandler(event => {
330
+ if (event.key === "Tab") {
331
+ return false;
332
+ }
333
+ return true;
334
+ });
335
+ this._xtermAddonLoader.importAddon("ligatures").then(LigaturesAddon => {
336
+ if (this._store.isDisposed || !this._stickyScrollOverlay) {
337
+ return;
338
+ }
339
+ this._ligaturesAddon = ( new LigaturesAddon());
340
+ this._stickyScrollOverlay.loadAddon(this._ligaturesAddon);
341
+ });
342
+ this._register(addStandardDisposableListener(hoverOverlay, "click", () => {
343
+ if (this._xterm && this._currentStickyCommand) {
344
+ this._xterm.markTracker.revealCommand(this._currentStickyCommand);
345
+ this._instance.focus();
346
+ }
347
+ }));
348
+ this._register(addStandardDisposableListener(
349
+ hoverOverlay,
350
+ "wheel",
351
+ e => this._xterm?.raw.element?.dispatchEvent(( new WheelEvent(e.type, e)))
352
+ ));
353
+ this._register(addDisposableListener(hoverOverlay, "mousedown", e => {
354
+ e.stopImmediatePropagation();
355
+ e.preventDefault();
356
+ }));
357
+ this._register(addDisposableListener(hoverOverlay, "contextmenu", e => {
358
+ e.stopImmediatePropagation();
359
+ e.preventDefault();
360
+ openContextMenu(
361
+ getWindow(hoverOverlay),
362
+ e,
363
+ this._instance,
364
+ this._contextMenu,
365
+ this._contextMenuService
366
+ );
367
+ }));
368
+ this._register(addStandardDisposableListener(
369
+ hoverOverlay,
370
+ "mouseover",
371
+ () => overlay.options.theme = this._getTheme(true)
372
+ ));
373
+ this._register(addStandardDisposableListener(
374
+ hoverOverlay,
375
+ "mouseleave",
376
+ () => overlay.options.theme = this._getTheme(false)
377
+ ));
378
+ }
379
+ _syncOptions() {
380
+ if (!this._stickyScrollOverlay) {
381
+ return;
382
+ }
383
+ this._stickyScrollOverlay.resize(this._xterm.raw.cols, this._stickyScrollOverlay.rows);
384
+ this._stickyScrollOverlay.options = this._getOptions();
385
+ this._refreshGpuAcceleration();
386
+ }
387
+ _getOptions() {
388
+ const o = this._xterm.raw.options;
389
+ return {
390
+ cursorInactiveStyle: "none",
391
+ scrollback: 0,
392
+ logLevel: "off",
393
+ theme: this._getTheme(false),
394
+ documentOverride: o.documentOverride,
395
+ fontFamily: o.fontFamily,
396
+ fontWeight: o.fontWeight,
397
+ fontWeightBold: o.fontWeightBold,
398
+ fontSize: o.fontSize,
399
+ letterSpacing: o.letterSpacing,
400
+ lineHeight: o.lineHeight,
401
+ drawBoldTextInBrightColors: o.drawBoldTextInBrightColors,
402
+ minimumContrastRatio: o.minimumContrastRatio,
403
+ tabStopWidth: o.tabStopWidth
404
+ };
405
+ }
406
+ async _refreshGpuAcceleration() {
407
+ if (this._shouldLoadWebgl() && (!this._webglAddon.value || this._webglAddonCustomGlyphs !== this._terminalConfigurationService.config.customGlyphs)) {
408
+ const WebglAddon = await this._xtermAddonLoader.importAddon("webgl");
409
+ if (this._store.isDisposed) {
410
+ return;
411
+ }
412
+ this._webglAddon.value = ( new WebglAddon({
413
+ customGlyphs: this._terminalConfigurationService.config.customGlyphs
414
+ }));
415
+ this._webglAddonCustomGlyphs = this._terminalConfigurationService.config.customGlyphs;
416
+ this._stickyScrollOverlay?.loadAddon(this._webglAddon.value);
417
+ } else if (!this._shouldLoadWebgl() && this._webglAddon.value) {
418
+ this._webglAddon.clear();
419
+ }
420
+ }
421
+ _shouldLoadWebgl() {
422
+ return this._terminalConfigurationService.config.gpuAcceleration === "auto" || this._terminalConfigurationService.config.gpuAcceleration === "on";
423
+ }
424
+ _getTheme(isHovering) {
425
+ const theme = this._themeService.getColorTheme();
426
+ return {
427
+ ...this._xterm.getXtermTheme(),
428
+ background: isHovering ? theme.getColor(terminalStickyScrollHoverBackground)?.toString() ?? this._xtermColorProvider.getBackgroundColor(theme)?.toString() : theme.getColor(terminalStickyScrollBackground)?.toString() ?? this._xtermColorProvider.getBackgroundColor(theme)?.toString(),
429
+ selectionBackground: undefined,
430
+ selectionInactiveBackground: undefined
431
+ };
432
+ }
433
+ _isIgnoredCommand(command) {
434
+ if (!command.command) {
435
+ return false;
436
+ }
437
+ const trimmedCommand = command.command.trim().toLowerCase();
438
+ return ( this._ignoredCommands.some(cmd => cmd.toLowerCase() === trimmedCommand));
439
+ }
440
+ };
441
+ TerminalStickyScrollOverlay.__decorator = ( __decorate([debounce(100)], TerminalStickyScrollOverlay.prototype, "_show", null));
442
+ TerminalStickyScrollOverlay.__decorator = ( __decorate([throttle(0)], TerminalStickyScrollOverlay.prototype, "_syncOptions", null));
443
+ TerminalStickyScrollOverlay.__decorator = ( __decorate(
444
+ [throttle(0)],
445
+ TerminalStickyScrollOverlay.prototype,
446
+ "_refreshGpuAcceleration",
447
+ null
448
+ ));
449
+ TerminalStickyScrollOverlay = ( __decorate([( __param(5, IConfigurationService)), ( __param(6, IContextKeyService)), ( __param(7, IContextMenuService)), ( __param(8, IKeybindingService)), ( __param(9, IMenuService)), ( __param(10, ITerminalConfigurationService)), ( __param(11, IThemeService))], TerminalStickyScrollOverlay));
450
+ function lineStartsWith(line, text) {
451
+ if (!line) {
452
+ return false;
453
+ }
454
+ for (let i = 0; i < text.length; i++) {
455
+ if (line.getCell(i)?.getChars() !== text[i]) {
456
+ return false;
457
+ }
458
+ }
459
+ return true;
460
+ }
461
+
462
+ export { TerminalStickyScrollOverlay };
@@ -1 +0,0 @@
1
- export declare function convertHtmlToMarkdown(html: string): string;