Skip to content

Commit 1bd8a93

Browse files
committed
chore: update the xtermjs to v6
- updated the themes with new fields - added option to turn off the xtermjs scrollabr - fixed touch related stuff introduced in new version
1 parent fceb2e6 commit 1bd8a93

10 files changed

Lines changed: 304 additions & 141 deletions

‎bun.lock‎

Lines changed: 19 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package-lock.json‎

Lines changed: 43 additions & 61 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -152,14 +152,14 @@
152152
"@lezer/highlight": "^1.2.3",
153153
"@lezer/lr": "^1.4.7",
154154
"@ungap/custom-elements": "^1.3.0",
155-
"@xterm/addon-attach": "^0.11.0",
156-
"@xterm/addon-fit": "^0.10.0",
157-
"@xterm/addon-image": "^0.8.0",
158-
"@xterm/addon-search": "^0.15.0",
159-
"@xterm/addon-unicode11": "^0.8.0",
160-
"@xterm/addon-web-links": "^0.11.0",
161-
"@xterm/addon-webgl": "^0.18.0",
162-
"@xterm/xterm": "^5.5.0",
155+
"@xterm/addon-attach": "^0.12.0",
156+
"@xterm/addon-fit": "^0.11.0",
157+
"@xterm/addon-image": "^0.9.0",
158+
"@xterm/addon-search": "^0.16.0",
159+
"@xterm/addon-unicode11": "^0.9.0",
160+
"@xterm/addon-web-links": "^0.12.0",
161+
"@xterm/addon-webgl": "^0.19.0",
162+
"@xterm/xterm": "^6.0.0",
163163
"acorn": "^8.16.0",
164164
"autosize": "^6.0.1",
165165
"codemirror": "^6.0.2",

‎src/components/terminal/terminal.js‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,10 @@ export default class TerminalComponent {
557557
try {
558558
// Open first to ensure a stable renderer is attached
559559
this.terminal.open(container);
560+
this.updateBackgroundColor();
561+
this.updateScrollbarVisibility(
562+
getTerminalSettings().showScrollbar !== false,
563+
);
560564

561565
// Renderer selection: 'canvas' (default core), 'webgl', or 'auto'
562566
if (
@@ -983,6 +987,29 @@ export default class TerminalComponent {
983987
}
984988
this.options.theme = { ...this.options.theme, ...theme };
985989
this.terminal.options.theme = this.options.theme;
990+
this.updateBackgroundColor();
991+
}
992+
993+
/** Keep xterm's viewport chrome aligned with the active theme. */
994+
updateBackgroundColor() {
995+
const background = this.terminal?.options.theme?.background;
996+
if (!background) return;
997+
998+
if (this.container) this.container.style.background = background;
999+
if (this.terminal?.element) {
1000+
this.terminal.element.style.backgroundColor = background;
1001+
}
1002+
}
1003+
1004+
/**
1005+
* Toggle xterm.js 6's custom scrollbar without disabling scroll APIs.
1006+
* @param {boolean} visible Whether the scrollbar should be shown
1007+
*/
1008+
updateScrollbarVisibility(visible) {
1009+
this.terminal?.element?.classList.toggle(
1010+
"terminal-scrollbar-hidden",
1011+
visible === false,
1012+
);
9861013
}
9871014

9881015
/**

‎src/components/terminal/terminalDefaults.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export const DEFAULT_TERMINAL_SETTINGS = {
88
cursorStyle: "block",
99
cursorInactiveStyle: "outline",
1010
scrollback: 1000,
11+
showScrollbar: true,
1112
theme: "dark",
1213
tabStopWidth: 4,
1314
convertEol: true,

‎src/components/terminal/terminalManager.js‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1005,9 +1005,18 @@ class TerminalManager {
10051005
touch-action: none;
10061006
}
10071007
1008-
.terminal-content .xterm-viewport {
1008+
.terminal-content .xterm-viewport,
1009+
.terminal-content .xterm-scrollable-element {
1010+
background-color: transparent !important;
10091011
overscroll-behavior: none;
10101012
}
1013+
1014+
.terminal-content
1015+
.terminal-scrollbar-hidden
1016+
.xterm-scrollable-element
1017+
> .scrollbar.vertical {
1018+
display: none !important;
1019+
}
10111020
`;
10121021
}
10131022

0 commit comments

Comments
 (0)