@codingame/monaco-vscode-xterm-common 37.2.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.
- package/package.json +3 -3
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalInstance.d.ts +3 -3
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalInstance.js +39 -39
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollContribution.js +3 -3
- package/vscode/src/vs/platform/terminal/common/capabilities/naiveCwdDetectionCapability.d.ts +0 -11
- package/vscode/src/vs/platform/terminal/common/capabilities/naiveCwdDetectionCapability.js +0 -26
- package/vscode/src/vs/platform/terminal/common/environmentVariable.d.ts +0 -86
- package/vscode/src/vs/platform/terminal/common/environmentVariable.js +0 -10
- package/vscode/src/vs/platform/terminal/common/environmentVariableCollection.d.ts +0 -17
- package/vscode/src/vs/platform/terminal/common/environmentVariableCollection.js +0 -218
- package/vscode/src/vs/platform/terminal/common/terminalRecorder.d.ts +0 -14
- package/vscode/src/vs/platform/terminal/common/terminalRecorder.js +0 -84
- package/vscode/src/vs/workbench/contrib/terminal/browser/agentHostOutputChannel.d.ts +0 -22
- package/vscode/src/vs/workbench/contrib/terminal/browser/agentHostOutputChannel.js +0 -48
- package/vscode/src/vs/workbench/contrib/terminal/browser/agentHostPty.d.ts +0 -129
- package/vscode/src/vs/workbench/contrib/terminal/browser/agentHostPty.js +0 -439
- package/vscode/src/vs/workbench/contrib/terminal/browser/agentHostTerminalService.d.ts +0 -77
- package/vscode/src/vs/workbench/contrib/terminal/browser/agentHostTerminalService.js +0 -345
- package/vscode/src/vs/workbench/contrib/terminal/browser/ahpTerminalCommandSource.d.ts +0 -111
- package/vscode/src/vs/workbench/contrib/terminal/browser/ahpTerminalCommandSource.js +0 -138
- package/vscode/src/vs/workbench/contrib/terminal/browser/environmentVariableInfo.d.ts +0 -28
- package/vscode/src/vs/workbench/contrib/terminal/browser/environmentVariableInfo.js +0 -119
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalActions.d.ts +0 -104
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalActions.js +0 -1643
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalContextMenu.d.ts +0 -19
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalContextMenu.js +0 -54
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalIconPicker.d.ts +0 -12
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalIconPicker.js +0 -78
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalProcessManager.d.ts +0 -144
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalProcessManager.js +0 -806
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalResizeDebouncer.d.ts +0 -17
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalResizeDebouncer.js +0 -83
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalStatusList.d.ts +0 -57
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalStatusList.js +0 -139
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalTabsList.d.ts +0 -45
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalTabsList.js +0 -804
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalTooltip.d.ts +0 -9
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalTooltip.js +0 -75
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/lineDataEventAddon.d.ts +0 -17
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/lineDataEventAddon.js +0 -61
- package/vscode/src/vs/workbench/contrib/terminal/common/basePty.d.ts +0 -38
- package/vscode/src/vs/workbench/contrib/terminal/common/basePty.js +0 -127
- package/vscode/src/vs/workbench/contrib/terminal/common/terminalEnvironment.d.ts +0 -38
- package/vscode/src/vs/workbench/contrib/terminal/common/terminalEnvironment.js +0 -321
- package/vscode/src/vs/workbench/contrib/terminal/common/terminalStorageKeys.d.ts +0 -12
- package/vscode/src/vs/workbench/contrib/terminal/common/terminalStorageKeys.js +0 -17
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/media/stickyScroll.css +0 -49
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollColorRegistry.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollColorRegistry.js +0 -25
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollOverlay.d.ts +0 -58
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollOverlay.js +0 -462
|
@@ -1,462 +0,0 @@
|
|
|
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(
|
|
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(17742, "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(17743, "{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(17743, "{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 };
|