@codingame/monaco-vscode-xterm-addons-common 37.6.0 → 38.0.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 +2 -2
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.js +17 -5
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollOverlay.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollOverlay.js +21 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-xterm-addons-common",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "38.0.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": "
|
|
18
|
+
"@codingame/monaco-vscode-api": "38.0.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",
|
|
@@ -40,6 +40,8 @@ export interface IXtermTerminalOptions {
|
|
|
40
40
|
xtermAddonImporter?: XtermAddonImporter;
|
|
41
41
|
/** Whether to disable the overview ruler. */
|
|
42
42
|
disableOverviewRuler?: boolean;
|
|
43
|
+
/** The rows of scrollback to keep, overriding the `terminal.integrated.scrollback` setting. */
|
|
44
|
+
scrollback?: number;
|
|
43
45
|
/**
|
|
44
46
|
* When true, skips registering listeners on global singleton services
|
|
45
47
|
* (configuration, theme, log level) to avoid accumulating listeners when
|
|
@@ -71,6 +73,7 @@ export declare class XtermTerminal extends Disposable implements IXtermTerminal,
|
|
|
71
73
|
private readonly _xtermColorProvider;
|
|
72
74
|
private readonly _capabilities;
|
|
73
75
|
private readonly _disableOverviewRuler;
|
|
76
|
+
private readonly _scrollback;
|
|
74
77
|
private static _suggestedRendererType;
|
|
75
78
|
private _attached?;
|
|
76
79
|
private _isPhysicalMouseWheel;
|
|
@@ -46,6 +46,7 @@ import { isNumber } from '@codingame/monaco-vscode-api/vscode/vs/base/common/typ
|
|
|
46
46
|
import { clamp } from '@codingame/monaco-vscode-api/vscode/vs/base/common/numbers';
|
|
47
47
|
import { LayoutSettings } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/layout/browser/layoutService';
|
|
48
48
|
import { ILifecycleService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/lifecycle/common/lifecycle.service';
|
|
49
|
+
import { updateTerminalFontRendering } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/xterm/terminalFontRendering';
|
|
49
50
|
|
|
50
51
|
var XtermTerminal_1;
|
|
51
52
|
var RenderConstants;
|
|
@@ -198,6 +199,7 @@ let XtermTerminal = class XtermTerminal extends Disposable {
|
|
|
198
199
|
this._xtermColorProvider = options.xtermColorProvider;
|
|
199
200
|
this._capabilities = options.capabilities;
|
|
200
201
|
this._disableOverviewRuler = options.disableOverviewRuler ?? false;
|
|
202
|
+
this._scrollback = options.scrollback;
|
|
201
203
|
const font = this._terminalConfigurationService.getFont(getActiveWindow(), undefined, true);
|
|
202
204
|
const config = this._terminalConfigurationService.config;
|
|
203
205
|
const editorOptions = this._configurationService.getValue("editor");
|
|
@@ -207,7 +209,7 @@ let XtermTerminal = class XtermTerminal extends Disposable {
|
|
|
207
209
|
rows: options.rows,
|
|
208
210
|
documentOverride: layoutService.mainContainer.ownerDocument,
|
|
209
211
|
altClickMovesCursor: config.altClickMovesCursor && editorOptions.multiCursorModifier === "alt",
|
|
210
|
-
scrollback: config.scrollback,
|
|
212
|
+
scrollback: this._scrollback ?? config.scrollback,
|
|
211
213
|
theme: this.getXtermTheme(),
|
|
212
214
|
drawBoldTextInBrightColors: config.drawBoldTextInBrightColors,
|
|
213
215
|
fontFamily: font.fontFamily,
|
|
@@ -480,6 +482,7 @@ let XtermTerminal = class XtermTerminal extends Disposable {
|
|
|
480
482
|
if (!this._attached) {
|
|
481
483
|
this.raw.open(container);
|
|
482
484
|
}
|
|
485
|
+
updateTerminalFontRendering(this.raw, this._terminalConfigurationService.config.fontRendering);
|
|
483
486
|
if (options.enableGpu) {
|
|
484
487
|
if (this._shouldLoadWebgl()) {
|
|
485
488
|
this._enableWebglRenderer();
|
|
@@ -556,7 +559,7 @@ let XtermTerminal = class XtermTerminal extends Disposable {
|
|
|
556
559
|
this._setCursorStyle(config.cursorStyle);
|
|
557
560
|
this._setCursorStyleInactive(config.cursorStyleInactive);
|
|
558
561
|
this._setCursorWidth(config.cursorWidth);
|
|
559
|
-
this.raw.options.scrollback = config.scrollback;
|
|
562
|
+
this.raw.options.scrollback = this._scrollback ?? config.scrollback;
|
|
560
563
|
this.raw.options.drawBoldTextInBrightColors = config.drawBoldTextInBrightColors;
|
|
561
564
|
this.raw.options.minimumContrastRatio = config.minimumContrastRatio;
|
|
562
565
|
this.raw.options.tabStopWidth = config.tabStopWidth;
|
|
@@ -572,6 +575,7 @@ let XtermTerminal = class XtermTerminal extends Disposable {
|
|
|
572
575
|
this.raw.options.ignoreBracketedPasteMode = config.ignoreBracketedPasteMode;
|
|
573
576
|
this.raw.options.rescaleOverlappingGlyphs = config.rescaleOverlappingGlyphs;
|
|
574
577
|
this.raw.options.allowTransparency = config.enableImages;
|
|
578
|
+
updateTerminalFontRendering(this.raw, config.fontRendering);
|
|
575
579
|
this.raw.options.vtExtensions = {
|
|
576
580
|
kittyKeyboard: config.enableKittyKeyboardProtocol,
|
|
577
581
|
win32InputMode: config.enableWin32InputMode
|
|
@@ -721,9 +725,17 @@ let XtermTerminal = class XtermTerminal extends Disposable {
|
|
|
721
725
|
this.markTracker.scrollToLine(line, position);
|
|
722
726
|
}
|
|
723
727
|
clearBuffer() {
|
|
728
|
+
const isNormalBuffer = this.raw.buffer.active.type === "normal";
|
|
729
|
+
if (isNormalBuffer) {
|
|
730
|
+
this._decorationAddon.clearDecorations();
|
|
731
|
+
this._capabilities.get(TerminalCapability.CommandDetection)?.clearCommands();
|
|
732
|
+
this._capabilities.get(TerminalCapability.PartialCommandDetection)?.clearCommands();
|
|
733
|
+
}
|
|
724
734
|
this.raw.clear();
|
|
725
|
-
|
|
726
|
-
|
|
735
|
+
if (isNormalBuffer) {
|
|
736
|
+
this._capabilities.get(TerminalCapability.CommandDetection)?.handlePromptStart();
|
|
737
|
+
this._capabilities.get(TerminalCapability.CommandDetection)?.handleCommandStart();
|
|
738
|
+
}
|
|
727
739
|
this._accessibilitySignalService.playSignal(AccessibilitySignal.clear);
|
|
728
740
|
}
|
|
729
741
|
reset() {
|
|
@@ -778,7 +790,7 @@ let XtermTerminal = class XtermTerminal extends Disposable {
|
|
|
778
790
|
await this._clipboardService.writeText(this.raw.getSelection());
|
|
779
791
|
}
|
|
780
792
|
} else {
|
|
781
|
-
this._notificationService.warn(( localize(
|
|
793
|
+
this._notificationService.warn(( localize(21824, "The terminal has no selection to copy")));
|
|
782
794
|
}
|
|
783
795
|
}
|
|
784
796
|
_setCursorBlink(blink) {
|
|
@@ -37,6 +37,7 @@ export declare class TerminalStickyScrollOverlay extends Disposable {
|
|
|
37
37
|
constructor(_instance: ITerminalInstance, _xterm: IXtermTerminal & {
|
|
38
38
|
raw: RawXtermTerminal;
|
|
39
39
|
}, _xtermColorProvider: IXtermColorProvider, _commandDetection: ICommandDetectionCapability, xtermCtor: Promise<typeof XTermTerminal>, configurationService: IConfigurationService, contextKeyService: IContextKeyService, _contextMenuService: IContextMenuService, _keybindingService: IKeybindingService, menuService: IMenuService, _terminalConfigurationService: ITerminalConfigurationService, _themeService: IThemeService);
|
|
40
|
+
layout(): void;
|
|
40
41
|
lockHide(): void;
|
|
41
42
|
unlockHide(): void;
|
|
42
43
|
private _setState;
|
|
@@ -23,6 +23,7 @@ import { terminalStrings } from '@codingame/monaco-vscode-api/vscode/vs/workbenc
|
|
|
23
23
|
import { TerminalStickyScrollSettingId } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminalContrib/stickyScroll/common/terminalStickyScrollConfiguration';
|
|
24
24
|
import { terminalStickyScrollHoverBackground, terminalStickyScrollBackground } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollColorRegistry';
|
|
25
25
|
import { XtermAddonImporter } from '../../../terminal/browser/xterm/xtermAddonImporter.js';
|
|
26
|
+
import { updateTerminalFontRendering } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/xterm/terminalFontRendering';
|
|
26
27
|
|
|
27
28
|
registerCss(stickyScroll, 1);
|
|
28
29
|
var OverlayState;
|
|
@@ -127,6 +128,11 @@ let TerminalStickyScrollOverlay = class TerminalStickyScrollOverlay extends Disp
|
|
|
127
128
|
});
|
|
128
129
|
});
|
|
129
130
|
}
|
|
131
|
+
layout() {
|
|
132
|
+
if (this._state === OverlayState.On) {
|
|
133
|
+
this._refresh();
|
|
134
|
+
}
|
|
135
|
+
}
|
|
130
136
|
lockHide() {
|
|
131
137
|
this._element?.classList.add("lock-hide");
|
|
132
138
|
}
|
|
@@ -172,6 +178,7 @@ let TerminalStickyScrollOverlay = class TerminalStickyScrollOverlay extends Disp
|
|
|
172
178
|
}
|
|
173
179
|
_setVisible(isVisible) {
|
|
174
180
|
if (isVisible) {
|
|
181
|
+
this._ensureElement();
|
|
175
182
|
this._pendingShowOperation = true;
|
|
176
183
|
this._show();
|
|
177
184
|
} else {
|
|
@@ -180,7 +187,6 @@ let TerminalStickyScrollOverlay = class TerminalStickyScrollOverlay extends Disp
|
|
|
180
187
|
}
|
|
181
188
|
_show() {
|
|
182
189
|
if (this._pendingShowOperation) {
|
|
183
|
-
this._ensureElement();
|
|
184
190
|
this._element?.classList.toggle(CssClasses.Visible, true);
|
|
185
191
|
}
|
|
186
192
|
this._pendingShowOperation = false;
|
|
@@ -274,10 +280,8 @@ let TerminalStickyScrollOverlay = class TerminalStickyScrollOverlay extends Disp
|
|
|
274
280
|
this._currentStickyCommand = command;
|
|
275
281
|
this._setVisible(true);
|
|
276
282
|
if (this._element) {
|
|
277
|
-
const
|
|
278
|
-
if (
|
|
279
|
-
const rowHeight = termBox.height / xterm.rows;
|
|
280
|
-
const overlayHeight = stickyScrollLineCount * rowHeight;
|
|
283
|
+
const rowHeight = xterm.dimensions?.css.cell.height;
|
|
284
|
+
if (rowHeight && xterm.element.offsetHeight > 0) {
|
|
281
285
|
let endMarkerOffset = 0;
|
|
282
286
|
if (!isPartialCommand && command.endMarker && command.endMarker.line !== -1) {
|
|
283
287
|
const lastLine = Math.min(command.endMarker.line, buffer.baseY + buffer.cursorY);
|
|
@@ -286,7 +290,7 @@ let TerminalStickyScrollOverlay = class TerminalStickyScrollOverlay extends Disp
|
|
|
286
290
|
endMarkerOffset = diff * rowHeight;
|
|
287
291
|
}
|
|
288
292
|
}
|
|
289
|
-
this._element.style.
|
|
293
|
+
this._element.style.top = `${xterm.element.offsetTop - endMarkerOffset}px`;
|
|
290
294
|
}
|
|
291
295
|
}
|
|
292
296
|
} else {
|
|
@@ -305,19 +309,19 @@ let TerminalStickyScrollOverlay = class TerminalStickyScrollOverlay extends Disp
|
|
|
305
309
|
this._element = $(".terminal-sticky-scroll", undefined, hoverOverlay);
|
|
306
310
|
this._xterm.raw.element.parentElement.append(this._element);
|
|
307
311
|
this._register(toDisposable(() => this._element?.remove()));
|
|
308
|
-
let hoverTitle = ( localize(
|
|
312
|
+
let hoverTitle = ( localize(22554, "Navigate to Command"));
|
|
309
313
|
const scrollToPreviousCommandKeybinding = this._keybindingService.lookupKeybinding(TerminalCommandId.ScrollToPreviousCommand);
|
|
310
314
|
if (scrollToPreviousCommandKeybinding) {
|
|
311
315
|
const label = scrollToPreviousCommandKeybinding.getLabel();
|
|
312
316
|
if (label) {
|
|
313
|
-
hoverTitle += "\n" + ( localize(
|
|
317
|
+
hoverTitle += "\n" + ( localize(22555, "{0} ({1})", terminalStrings.scrollToPreviousCommand.value, label));
|
|
314
318
|
}
|
|
315
319
|
}
|
|
316
320
|
const scrollToNextCommandKeybinding = this._keybindingService.lookupKeybinding(TerminalCommandId.ScrollToNextCommand);
|
|
317
321
|
if (scrollToNextCommandKeybinding) {
|
|
318
322
|
const label = scrollToNextCommandKeybinding.getLabel();
|
|
319
323
|
if (label) {
|
|
320
|
-
hoverTitle += "\n" + ( localize(
|
|
324
|
+
hoverTitle += "\n" + ( localize(22555, "{0} ({1})", terminalStrings.scrollToNextCommand.value, label));
|
|
321
325
|
}
|
|
322
326
|
}
|
|
323
327
|
hoverOverlay.title = hoverTitle;
|
|
@@ -326,6 +330,10 @@ let TerminalStickyScrollOverlay = class TerminalStickyScrollOverlay extends Disp
|
|
|
326
330
|
this._element.style.right = `${scrollBarWidth}px`;
|
|
327
331
|
}
|
|
328
332
|
this._stickyScrollOverlay.open(this._element);
|
|
333
|
+
updateTerminalFontRendering(
|
|
334
|
+
this._stickyScrollOverlay,
|
|
335
|
+
this._terminalConfigurationService.config.fontRendering
|
|
336
|
+
);
|
|
329
337
|
this._stickyScrollOverlay.attachCustomKeyEventHandler(event => {
|
|
330
338
|
if (event.key === "Tab") {
|
|
331
339
|
return false;
|
|
@@ -382,6 +390,10 @@ let TerminalStickyScrollOverlay = class TerminalStickyScrollOverlay extends Disp
|
|
|
382
390
|
}
|
|
383
391
|
this._stickyScrollOverlay.resize(this._xterm.raw.cols, this._stickyScrollOverlay.rows);
|
|
384
392
|
this._stickyScrollOverlay.options = this._getOptions();
|
|
393
|
+
updateTerminalFontRendering(
|
|
394
|
+
this._stickyScrollOverlay,
|
|
395
|
+
this._terminalConfigurationService.config.fontRendering
|
|
396
|
+
);
|
|
385
397
|
this._refreshGpuAcceleration();
|
|
386
398
|
}
|
|
387
399
|
_getOptions() {
|