@lethevimlet/sshift 1.5.0 → 1.5.2
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 +1 -1
- package/src/server/services/sftp-manager.js +15 -2
- package/src/webapp/css/style.css +42 -0
- package/src/webapp/js/app.js +211 -21
package/package.json
CHANGED
|
@@ -202,11 +202,24 @@ try {
|
|
|
202
202
|
return;
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
+
// Return the raw ssh2 Stats object so callers can use the
|
|
206
|
+
// standard `stats.isDirectory()` / `stats.isFile()` METHODS
|
|
207
|
+
// (not properties). The previous normalized return shape
|
|
208
|
+
// (`{ isDirectory: bool, isFile: bool }`) broke callers —
|
|
209
|
+
// notably `sftp-download` at src/server/endpoints/ws/sftp.js
|
|
210
|
+
// which calls `stats.isDirectory()` as a function and crashed
|
|
211
|
+
// with "stats.isDirectory is not a function" on every file
|
|
212
|
+
// download attempt. We add normalized properties as aliases
|
|
213
|
+
// so existing callers that read them as booleans still work.
|
|
205
214
|
resolve({
|
|
215
|
+
// Raw ssh2 Stats methods (primary API).
|
|
216
|
+
isDirectory: () => stats.isDirectory(),
|
|
217
|
+
isFile: () => stats.isFile(),
|
|
218
|
+
// Aliased scalar fields for callers that read these as values.
|
|
206
219
|
size: stats.size,
|
|
207
220
|
modifyTime: stats.mtime * 1000,
|
|
208
|
-
|
|
209
|
-
|
|
221
|
+
isDirectoryValue: stats.isDirectory(),
|
|
222
|
+
isFileValue: stats.isFile()
|
|
210
223
|
});
|
|
211
224
|
});
|
|
212
225
|
});
|
package/src/webapp/css/style.css
CHANGED
|
@@ -2360,6 +2360,7 @@ body.dragging-tabs .tabs-container {
|
|
|
2360
2360
|
pointer-events: auto !important;
|
|
2361
2361
|
transition: none !important;
|
|
2362
2362
|
background-color: var(--terminal-scrollbar-track, #151b23) !important;
|
|
2363
|
+
width: 8px !important;
|
|
2363
2364
|
}
|
|
2364
2365
|
|
|
2365
2366
|
.terminal-container .xterm-scrollable-element > .scrollbar.invisible {
|
|
@@ -2378,12 +2379,22 @@ body.dragging-tabs .tabs-container {
|
|
|
2378
2379
|
.terminal-container .xterm-scrollable-element > .scrollbar > .slider {
|
|
2379
2380
|
border-radius: 3px;
|
|
2380
2381
|
background-color: var(--terminal-scrollbar-thumb, #3d444d) !important;
|
|
2382
|
+
width: 8px !important;
|
|
2383
|
+
min-width: 8px !important;
|
|
2384
|
+
max-width: 8px !important;
|
|
2381
2385
|
}
|
|
2382
2386
|
|
|
2383
2387
|
.terminal-container .xterm-scrollable-element > .shadow {
|
|
2384
2388
|
display: none !important;
|
|
2385
2389
|
}
|
|
2386
2390
|
|
|
2391
|
+
/* Hide the overview ruler canvas — it creates a visible white strip
|
|
2392
|
+
when the terminal has no scrollback or on blur. The custom scrollbar
|
|
2393
|
+
already shows scroll position. */
|
|
2394
|
+
.terminal-container .xterm-decoration-overview-ruler {
|
|
2395
|
+
display: none !important;
|
|
2396
|
+
}
|
|
2397
|
+
|
|
2387
2398
|
/* Hide native viewport scrollbar (xterm v6 uses custom scrollbar) */
|
|
2388
2399
|
.terminal-container .xterm-viewport::-webkit-scrollbar {
|
|
2389
2400
|
width: 0;
|
|
@@ -3298,6 +3309,37 @@ body.dragging-tabs .tabs-container {
|
|
|
3298
3309
|
--header-height: 43px;
|
|
3299
3310
|
}
|
|
3300
3311
|
|
|
3312
|
+
/* Thinner xterm scrollbar on mobile */
|
|
3313
|
+
.terminal-container .xterm-scrollable-element > .scrollbar {
|
|
3314
|
+
width: 4px !important;
|
|
3315
|
+
min-width: 4px !important;
|
|
3316
|
+
max-width: 4px !important;
|
|
3317
|
+
}
|
|
3318
|
+
.terminal-container .xterm-scrollable-element > .scrollbar.vertical {
|
|
3319
|
+
width: 4px !important;
|
|
3320
|
+
min-width: 4px !important;
|
|
3321
|
+
max-width: 4px !important;
|
|
3322
|
+
}
|
|
3323
|
+
.terminal-container .xterm-scrollable-element > .scrollbar > .slider {
|
|
3324
|
+
width: 4px !important;
|
|
3325
|
+
min-width: 4px !important;
|
|
3326
|
+
max-width: 4px !important;
|
|
3327
|
+
border-radius: 2px !important;
|
|
3328
|
+
/* Match the track background so the scrollbar blend in and doesn't
|
|
3329
|
+
look like a white line against the dark terminal background. */
|
|
3330
|
+
background-color: var(--terminal-scrollbar-track, #151b23) !important;
|
|
3331
|
+
}
|
|
3332
|
+
/* Also hide the viewport scrollbar more aggressively on mobile */
|
|
3333
|
+
.terminal-container .xterm-viewport {
|
|
3334
|
+
scrollbar-width: none !important;
|
|
3335
|
+
-ms-overflow-style: none !important;
|
|
3336
|
+
}
|
|
3337
|
+
.terminal-container .xterm-viewport::-webkit-scrollbar {
|
|
3338
|
+
width: 0 !important;
|
|
3339
|
+
height: 0 !important;
|
|
3340
|
+
display: none !important;
|
|
3341
|
+
}
|
|
3342
|
+
|
|
3301
3343
|
.header {
|
|
3302
3344
|
padding: 0 6px;
|
|
3303
3345
|
}
|
package/src/webapp/js/app.js
CHANGED
|
@@ -756,7 +756,7 @@ class SSHIFTClient {
|
|
|
756
756
|
// Update active sessions:
|
|
757
757
|
// 1. Make the moved tab active in the target panel
|
|
758
758
|
this.switchTab(sessionId, targetPanelId);
|
|
759
|
-
|
|
759
|
+
|
|
760
760
|
// 2. Activate the first remaining tab in the source panel (if any)
|
|
761
761
|
if (sourceTabs.length > 0) {
|
|
762
762
|
const firstRemainingSessionId = sourceTabs[0].dataset.sessionId;
|
|
@@ -770,6 +770,38 @@ class SSHIFTClient {
|
|
|
770
770
|
|
|
771
771
|
// Update server panel map for mobile preservation
|
|
772
772
|
this._serverPanelMap.set(sessionId, targetPanelId);
|
|
773
|
+
|
|
774
|
+
// After moving the terminal wrapper to a new container, the
|
|
775
|
+
// terminal's internal canvas/renderer dimensions are still tied
|
|
776
|
+
// to the old panel's size. The WebGL atlas has glyphs rasterised
|
|
777
|
+
// for the old cell size. If we fit() immediately the browser
|
|
778
|
+
// hasn't committed the new layout yet, so fit() measures stale
|
|
779
|
+
// dimensions — producing the interlaced/alternating-black-band
|
|
780
|
+
// rendering bug. Fix: double-RAF to let the browser commit the
|
|
781
|
+
// new layout, then fit + clear atlas + force refresh.
|
|
782
|
+
// Also refit ALL terminals (the source panel's remaining tab may
|
|
783
|
+
// have changed container size too).
|
|
784
|
+
const session = this.sessions.get(sessionId);
|
|
785
|
+
if (session && session.terminal && session.fitAddon && session.isController) {
|
|
786
|
+
requestAnimationFrame(() => {
|
|
787
|
+
requestAnimationFrame(() => {
|
|
788
|
+
if (!session.terminal || !session.fitAddon || !session.isController) return;
|
|
789
|
+
// Re-measure char size (font may have loaded differently in
|
|
790
|
+
// the new container) then fit, clear atlas, and refresh.
|
|
791
|
+
const core = session.terminal._core;
|
|
792
|
+
if (core && core._charSizeService && typeof core._charSizeService.measure === 'function') {
|
|
793
|
+
try { core._charSizeService.measure(); } catch (_) {}
|
|
794
|
+
}
|
|
795
|
+
this._fitTerminal(session);
|
|
796
|
+
this._resetWebGLAtlas(session);
|
|
797
|
+
});
|
|
798
|
+
});
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
// Refit ALL visible terminals — the source panel's remaining tab
|
|
802
|
+
// may have a different container width now that the moved tab is
|
|
803
|
+
// gone. Use the existing staggered refit helper.
|
|
804
|
+
this.refitAllTerminals();
|
|
773
805
|
}
|
|
774
806
|
|
|
775
807
|
// Hide empty state for a specific panel
|
|
@@ -2928,20 +2960,59 @@ sendChunkedInput(sessionId, data, chunkSize = 2048) {
|
|
|
2928
2960
|
element.addEventListener('touchmove', (e) => {
|
|
2929
2961
|
if (e.touches.length === 1 && session.isScrolling) {
|
|
2930
2962
|
e.preventDefault();
|
|
2931
|
-
|
|
2963
|
+
|
|
2932
2964
|
const currentTouchY = e.touches[0].clientY;
|
|
2933
2965
|
const touchDiff = session.lastTouchY - currentTouchY;
|
|
2934
2966
|
session.lastTouchY = currentTouchY;
|
|
2935
2967
|
session.touchAccumulator += touchDiff;
|
|
2936
|
-
|
|
2968
|
+
|
|
2937
2969
|
const lineHeight = terminal._core?._renderService?.dimensions?.css?.cell?.height || 20;
|
|
2938
2970
|
const lineH = Math.max(lineHeight, 14);
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2971
|
+
|
|
2972
|
+
// When a TUI app has mouse tracking enabled (DECSET
|
|
2973
|
+
// 1000/1002/1003), scrolling should send mouse wheel
|
|
2974
|
+
// escape sequences directly to the PTY. Instead of
|
|
2975
|
+
// dispatching synthetic WheelEvents (which xterm's own
|
|
2976
|
+
// document-level touch handler can interfere with), we
|
|
2977
|
+
// generate the SGR mouse format ourselves and emit it via
|
|
2978
|
+
// ssh-data. SGR format: \x1b[<button;col;row;M
|
|
2979
|
+
// Wheel up = button 64, wheel down = button 65.
|
|
2980
|
+
const mouseProtocol = terminal._core?.coreMouseService?.activeProtocol;
|
|
2981
|
+
const tuiMouseActive = mouseProtocol && mouseProtocol !== 'NONE';
|
|
2982
|
+
|
|
2983
|
+
if (tuiMouseActive) {
|
|
2984
|
+
if (Math.abs(session.touchAccumulator) >= lineH) {
|
|
2985
|
+
// Compute the terminal cell under the touch point.
|
|
2986
|
+
const screenEl = terminal.element?.querySelector('.xterm-screen');
|
|
2987
|
+
if (screenEl) {
|
|
2988
|
+
const rect = screenEl.getBoundingClientRect();
|
|
2989
|
+
const cellW = terminal._core?._renderService?.dimensions?.css?.cell?.width || 8;
|
|
2990
|
+
const cellH = lineHeight;
|
|
2991
|
+
const touchX = e.touches[0].clientX - rect.left;
|
|
2992
|
+
const touchY = e.touches[0].clientY - rect.top;
|
|
2993
|
+
const col = Math.max(1, Math.min(terminal.cols, Math.floor(touchX / cellW) + 1));
|
|
2994
|
+
const row = Math.max(1, Math.min(terminal.rows, Math.floor(touchY / cellH) + 1));
|
|
2995
|
+
|
|
2996
|
+
const scrollLines = Math.trunc(Math.abs(session.touchAccumulator) / lineH);
|
|
2997
|
+
const direction = session.touchAccumulator > 0 ? 1 : -1; // 1 = scroll down, -1 = scroll up
|
|
2998
|
+
for (let i = 0; i < scrollLines; i++) {
|
|
2999
|
+
// button 64 = wheel up, 65 = wheel down
|
|
3000
|
+
const button = direction > 0 ? 65 : 64;
|
|
3001
|
+
const seq = `\x1b[<${button};${col};${row}M`;
|
|
3002
|
+
if (session.connected && session.isController) {
|
|
3003
|
+
this.socket.emit('ssh-data', { sessionId, data: seq });
|
|
3004
|
+
}
|
|
3005
|
+
}
|
|
3006
|
+
session.touchAccumulator = 0;
|
|
3007
|
+
}
|
|
3008
|
+
}
|
|
3009
|
+
} else {
|
|
3010
|
+
const linesToScroll = Math.trunc(Math.abs(session.touchAccumulator) / lineH);
|
|
3011
|
+
if (linesToScroll > 0) {
|
|
3012
|
+
const direction = session.touchAccumulator > 0 ? 1 : -1;
|
|
3013
|
+
terminal.scrollLines(direction * linesToScroll);
|
|
3014
|
+
session.touchAccumulator -= direction * linesToScroll * lineH;
|
|
3015
|
+
}
|
|
2945
3016
|
}
|
|
2946
3017
|
} else if (e.touches.length === 2 && session.isPinching) {
|
|
2947
3018
|
e.preventDefault();
|
|
@@ -3026,16 +3097,24 @@ sendChunkedInput(sessionId, data, chunkSize = 2048) {
|
|
|
3026
3097
|
|
|
3027
3098
|
const wheelHandler = (e) => {
|
|
3028
3099
|
if (e.deltaY === 0) return;
|
|
3029
|
-
|
|
3100
|
+
|
|
3030
3101
|
// If the event target is inside the custom scrollbar,
|
|
3031
3102
|
// let xterm's ScrollableElement handle it to avoid double-scroll
|
|
3032
3103
|
const target = e.target;
|
|
3033
3104
|
if (target && target.closest && target.closest('.xterm-scrollable-element')) {
|
|
3034
3105
|
return;
|
|
3035
3106
|
}
|
|
3036
|
-
|
|
3107
|
+
|
|
3108
|
+
// When a TUI app has mouse tracking enabled, let xterm's own
|
|
3109
|
+
// wheel handler process the event so it translates to mouse
|
|
3110
|
+
// tracking escape sequences sent to the PTY. Don't intercept.
|
|
3111
|
+
const mouseProtocol = terminal._core?.coreMouseService?.activeProtocol;
|
|
3112
|
+
if (mouseProtocol && mouseProtocol !== 'NONE') {
|
|
3113
|
+
return;
|
|
3114
|
+
}
|
|
3115
|
+
|
|
3037
3116
|
e.preventDefault();
|
|
3038
|
-
|
|
3117
|
+
|
|
3039
3118
|
let lines = 1;
|
|
3040
3119
|
if (e.deltaMode === 1) {
|
|
3041
3120
|
lines = Math.abs(e.deltaY);
|
|
@@ -3045,14 +3124,14 @@ const wheelHandler = (e) => {
|
|
|
3045
3124
|
} else {
|
|
3046
3125
|
lines = Math.abs(e.deltaY) * terminal.rows;
|
|
3047
3126
|
}
|
|
3048
|
-
|
|
3127
|
+
|
|
3049
3128
|
const fastScrollModifier = terminal.options.fastScrollModifier;
|
|
3050
3129
|
if (fastScrollModifier === 'alt' && e.altKey ||
|
|
3051
3130
|
fastScrollModifier === 'ctrl' && e.ctrlKey ||
|
|
3052
3131
|
fastScrollModifier === 'shift' && e.shiftKey) {
|
|
3053
3132
|
lines *= (terminal.options.fastScrollSensitivity || 5);
|
|
3054
3133
|
}
|
|
3055
|
-
|
|
3134
|
+
|
|
3056
3135
|
terminal.scrollLines((e.deltaY > 0 ? 1 : -1) * lines);
|
|
3057
3136
|
};
|
|
3058
3137
|
|
|
@@ -4107,10 +4186,22 @@ const wheelHandler = (e) => {
|
|
|
4107
4186
|
try {
|
|
4108
4187
|
// Set resyncing flag BEFORE calling resize to prevent resize feedback loop
|
|
4109
4188
|
session.isResyncing = true;
|
|
4110
|
-
|
|
4189
|
+
|
|
4111
4190
|
session.terminal.resize(data.cols, data.rows);
|
|
4112
4191
|
console.log('[SSHIFT] Terminal resized to match server dimensions:', data.cols, 'x', data.rows);
|
|
4113
|
-
|
|
4192
|
+
|
|
4193
|
+
// The serialized state was just written into a fresh
|
|
4194
|
+
// buffer + the terminal was just resized. The WebGL
|
|
4195
|
+
// renderer's glyph atlas still holds glyphs rasterised
|
|
4196
|
+
// at the pre-resize cell size — painting them now would
|
|
4197
|
+
// produce the "interlaced / every-other-row blank" bug
|
|
4198
|
+
// (visible after "Take Control" on a just-refreshed
|
|
4199
|
+
// browser tab; fixed when the user manually resizes the
|
|
4200
|
+
// window because that re-runs _fitTerminal → _resetWebGLAtlas).
|
|
4201
|
+
// Clear the atlas here so the renderer re-rasterises at
|
|
4202
|
+
// the post-sync cell dimensions.
|
|
4203
|
+
this._resetWebGLAtlas(session);
|
|
4204
|
+
|
|
4114
4205
|
// Clear the resyncing flag after a short delay
|
|
4115
4206
|
setTimeout(() => {
|
|
4116
4207
|
session.isResyncing = false;
|
|
@@ -4462,11 +4553,11 @@ const wheelHandler = (e) => {
|
|
|
4462
4553
|
}
|
|
4463
4554
|
} else if (data.advisory) {
|
|
4464
4555
|
// Advisory errors (rate-limit, invalid payload, bufferFull, etc.)
|
|
4465
|
-
// are
|
|
4466
|
-
//
|
|
4467
|
-
//
|
|
4556
|
+
// are operational warnings — log them but do NOT show a toast.
|
|
4557
|
+
// Showing toasts for every rate-limited sync or buffer-full event
|
|
4558
|
+
// is extremely annoying during normal usage like scrolling in a
|
|
4559
|
+
// TUI app.
|
|
4468
4560
|
console.warn('[SSHIFT] Advisory ssh-error (tab kept open):', data.message);
|
|
4469
|
-
this.showToast(data.message, 'warning');
|
|
4470
4561
|
} else {
|
|
4471
4562
|
this.showToast(data.message, 'error');
|
|
4472
4563
|
}
|
|
@@ -7322,7 +7413,7 @@ if (keepaliveCountMaxInput && this.sshKeepaliveCountMax) {
|
|
|
7322
7413
|
fastScrollModifier: 'alt',
|
|
7323
7414
|
fastScrollSensitivity: 5,
|
|
7324
7415
|
smoothScrollDuration: 80,
|
|
7325
|
-
overviewRuler: { width:
|
|
7416
|
+
overviewRuler: { width: 0 },
|
|
7326
7417
|
customGlyphs: true
|
|
7327
7418
|
});
|
|
7328
7419
|
|
|
@@ -7831,6 +7922,36 @@ if (keepaliveCountMaxInput && this.sshKeepaliveCountMax) {
|
|
|
7831
7922
|
}
|
|
7832
7923
|
});
|
|
7833
7924
|
|
|
7925
|
+
// Defensive activation: clear stuck `isResyncing` on user interaction.
|
|
7926
|
+
// Backgrounded / throttled browser tabs can leave `isResyncing` set
|
|
7927
|
+
// (setTimeout was deferred by the browser's power saver) which
|
|
7928
|
+
// suppresses onResize emits. After inactivity on a TUI app, mouse
|
|
7929
|
+
// clicks and scroll can stop working until the user refreshes.
|
|
7930
|
+
// Fix: on mouse/wheel interaction (desktop), clear the flag AND
|
|
7931
|
+
// re-focus the terminal so xterm's mouse-service fires.
|
|
7932
|
+
// On mobile touch, ONLY clear the flag — do NOT re-focus the
|
|
7933
|
+
// hidden textarea because that would pop the on-screen keyboard
|
|
7934
|
+
// on every scroll drag. The mobile handler manages keyboard
|
|
7935
|
+
// visibility separately.
|
|
7936
|
+
const clearResyncing = () => {
|
|
7937
|
+
if (!session) return;
|
|
7938
|
+
if (session.isResyncing) {
|
|
7939
|
+
session.isResyncing = false;
|
|
7940
|
+
}
|
|
7941
|
+
};
|
|
7942
|
+
const activateAndFocus = () => {
|
|
7943
|
+
clearResyncing();
|
|
7944
|
+
requestAnimationFrame(() => {
|
|
7945
|
+
if (session.terminal && !this.isMobile) {
|
|
7946
|
+
try { session.terminal.focus(); } catch (_) {}
|
|
7947
|
+
}
|
|
7948
|
+
});
|
|
7949
|
+
};
|
|
7950
|
+
container.addEventListener('mousedown', activateAndFocus, true);
|
|
7951
|
+
container.addEventListener('wheel', clearResyncing, true);
|
|
7952
|
+
// On mobile, only clear isResyncing on touchstart — do NOT focus.
|
|
7953
|
+
container.addEventListener('touchstart', clearResyncing, true);
|
|
7954
|
+
|
|
7834
7955
|
session.terminal = terminal;
|
|
7835
7956
|
session.fitAddon = fitAddon;
|
|
7836
7957
|
|
|
@@ -7885,11 +8006,75 @@ if (keepaliveCountMaxInput && this.sshKeepaliveCountMax) {
|
|
|
7885
8006
|
resizeObserver.observe(wrapper);
|
|
7886
8007
|
session.resizeObserver = resizeObserver;
|
|
7887
8008
|
|
|
8009
|
+
// Keep xterm's scrollbar dimensions + slider bg consistent.
|
|
8010
|
+
// xterm sets inline width: 14px and bg: rgb(73,77,83) on the
|
|
8011
|
+
// slider every time it re-renders; a MutationObserver catches
|
|
8012
|
+
// each change and overrides it back.
|
|
8013
|
+
{
|
|
8014
|
+
const targetW = this.isMobile ? '4px' : '8px';
|
|
8015
|
+
const fixScrollbar = () => {
|
|
8016
|
+
const sbs = wrapper.querySelectorAll('.xterm-scrollable-element > .scrollbar.vertical');
|
|
8017
|
+
sbs.forEach(sb => {
|
|
8018
|
+
if (sb.style.width !== targetW) {
|
|
8019
|
+
sb.style.width = targetW;
|
|
8020
|
+
sb.style.minWidth = targetW;
|
|
8021
|
+
sb.style.maxWidth = targetW;
|
|
8022
|
+
}
|
|
8023
|
+
const slider = sb.querySelector('.slider');
|
|
8024
|
+
if (slider) {
|
|
8025
|
+
if (slider.style.width !== targetW) {
|
|
8026
|
+
slider.style.width = targetW;
|
|
8027
|
+
slider.style.minWidth = targetW;
|
|
8028
|
+
slider.style.maxWidth = targetW;
|
|
8029
|
+
}
|
|
8030
|
+
// Override xterm's inline !important bg (lighter shade
|
|
8031
|
+
// that looks like a white line) with a dark thumb color.
|
|
8032
|
+
slider.style.setProperty('background-color', '#3d444d', 'important');
|
|
8033
|
+
}
|
|
8034
|
+
});
|
|
8035
|
+
};
|
|
8036
|
+
requestAnimationFrame(fixScrollbar);
|
|
8037
|
+
const mo = new MutationObserver(fixScrollbar);
|
|
8038
|
+
const scrollableEl = wrapper.querySelector('.xterm-scrollable-element');
|
|
8039
|
+
if (scrollableEl) {
|
|
8040
|
+
mo.observe(scrollableEl, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });
|
|
8041
|
+
}
|
|
8042
|
+
session._scrollbarObserver = mo;
|
|
8043
|
+
}
|
|
8044
|
+
|
|
7888
8045
|
// Setup mobile scroll behavior after terminal is ready
|
|
7889
8046
|
// Use requestAnimationFrame to ensure terminal.element is available
|
|
7890
8047
|
requestAnimationFrame(() => {
|
|
7891
8048
|
this.setupMobileScrollBehavior(sessionId);
|
|
7892
8049
|
this.setupWheelScroll(sessionId);
|
|
8050
|
+
|
|
8051
|
+
// Force thinner scrollbar on mobile. xterm v6 sets an inline
|
|
8052
|
+
// width: 14px on the vertical scrollbar AND its slider — override
|
|
8053
|
+
// both via inline style since CSS !important on the slider doesn't
|
|
8054
|
+
// always survive against xterm's re-renders.
|
|
8055
|
+
// On desktop, override the slider bg color which xterm sets inline
|
|
8056
|
+
// to rgb(73,77,83) — a lighter shade that looks like a white line
|
|
8057
|
+
// against the dark terminal background.
|
|
8058
|
+
const targetWidth = this.isMobile ? '4px' : '8px';
|
|
8059
|
+
{
|
|
8060
|
+
const scrollbars = wrapper.querySelectorAll('.xterm-scrollable-element > .scrollbar');
|
|
8061
|
+
scrollbars.forEach(sb => {
|
|
8062
|
+
if (sb.classList.contains('vertical')) {
|
|
8063
|
+
sb.style.width = targetWidth;
|
|
8064
|
+
sb.style.minWidth = targetWidth;
|
|
8065
|
+
sb.style.maxWidth = targetWidth;
|
|
8066
|
+
const slider = sb.querySelector('.slider');
|
|
8067
|
+
if (slider) {
|
|
8068
|
+
slider.style.width = targetWidth;
|
|
8069
|
+
slider.style.minWidth = targetWidth;
|
|
8070
|
+
slider.style.maxWidth = targetWidth;
|
|
8071
|
+
// Override xterm's inline !important bg with a dark shade
|
|
8072
|
+
// that's visible but doesn't look like a white line.
|
|
8073
|
+
slider.style.setProperty('background-color', '#3d444d', 'important');
|
|
8074
|
+
}
|
|
8075
|
+
}
|
|
8076
|
+
});
|
|
8077
|
+
}
|
|
7893
8078
|
});
|
|
7894
8079
|
|
|
7895
8080
|
console.log('[SSHIFT] Terminal initialized for session:', sessionId);
|
|
@@ -9156,6 +9341,11 @@ if (keepaliveCountMaxInput && this.sshKeepaliveCountMax) {
|
|
|
9156
9341
|
clearTimeout(session.resizeTimeout);
|
|
9157
9342
|
session.resizeTimeout = null;
|
|
9158
9343
|
}
|
|
9344
|
+
// Clean up scrollbar MutationObserver (mobile-only)
|
|
9345
|
+
if (session._scrollbarObserver) {
|
|
9346
|
+
session._scrollbarObserver.disconnect();
|
|
9347
|
+
session._scrollbarObserver = null;
|
|
9348
|
+
}
|
|
9159
9349
|
// Clean up write buffer RAF
|
|
9160
9350
|
if (session.writeRAF) {
|
|
9161
9351
|
cancelAnimationFrame(session.writeRAF);
|