@lethevimlet/sshift 1.7.1 → 1.7.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/webapp/css/style.css +35 -0
- package/src/webapp/index.html +36 -6
- package/src/webapp/js/app.js +77 -0
package/package.json
CHANGED
package/src/webapp/css/style.css
CHANGED
|
@@ -868,6 +868,7 @@ body {
|
|
|
868
868
|
align-items: center;
|
|
869
869
|
justify-content: space-between;
|
|
870
870
|
gap: 12px;
|
|
871
|
+
min-width: 0;
|
|
871
872
|
}
|
|
872
873
|
|
|
873
874
|
.terminal-color-options label {
|
|
@@ -876,6 +877,40 @@ body {
|
|
|
876
877
|
flex-shrink: 0;
|
|
877
878
|
}
|
|
878
879
|
|
|
880
|
+
/* Color picker + its restore-default button, kept together on the right */
|
|
881
|
+
.color-input-group {
|
|
882
|
+
display: flex;
|
|
883
|
+
align-items: center;
|
|
884
|
+
gap: 6px;
|
|
885
|
+
flex-shrink: 0;
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
.color-reset-btn {
|
|
889
|
+
display: inline-flex;
|
|
890
|
+
align-items: center;
|
|
891
|
+
justify-content: center;
|
|
892
|
+
width: 28px;
|
|
893
|
+
height: 28px;
|
|
894
|
+
flex-shrink: 0;
|
|
895
|
+
background: var(--bg-tertiary);
|
|
896
|
+
border: 1px solid var(--border-color);
|
|
897
|
+
border-radius: var(--radius-sm);
|
|
898
|
+
color: var(--text-secondary);
|
|
899
|
+
cursor: pointer;
|
|
900
|
+
font-size: 12px;
|
|
901
|
+
padding: 0;
|
|
902
|
+
transition: var(--transition-fast);
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
.color-reset-btn:hover {
|
|
906
|
+
color: var(--text-primary);
|
|
907
|
+
border-color: var(--accent-primary);
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
.color-reset-btn:active {
|
|
911
|
+
transform: scale(0.94);
|
|
912
|
+
}
|
|
913
|
+
|
|
879
914
|
.color-input {
|
|
880
915
|
width: 40px;
|
|
881
916
|
height: 28px;
|
package/src/webapp/index.html
CHANGED
|
@@ -125,15 +125,30 @@
|
|
|
125
125
|
<div class="terminal-color-options" id="terminalColorOptions">
|
|
126
126
|
<div class="terminal-color-option">
|
|
127
127
|
<label for="terminalBgColor">Background</label>
|
|
128
|
-
<
|
|
128
|
+
<div class="color-input-group">
|
|
129
|
+
<input type="color" id="terminalBgColor" class="color-input" value="#0d1117">
|
|
130
|
+
<button type="button" class="color-reset-btn" data-color-target="bg" title="Restore default background">
|
|
131
|
+
<i class="fas fa-rotate-left"></i>
|
|
132
|
+
</button>
|
|
133
|
+
</div>
|
|
129
134
|
</div>
|
|
130
135
|
<div class="terminal-color-option">
|
|
131
136
|
<label for="terminalFgColor">Foreground</label>
|
|
132
|
-
<
|
|
137
|
+
<div class="color-input-group">
|
|
138
|
+
<input type="color" id="terminalFgColor" class="color-input" value="#e6edf3">
|
|
139
|
+
<button type="button" class="color-reset-btn" data-color-target="fg" title="Restore default foreground">
|
|
140
|
+
<i class="fas fa-rotate-left"></i>
|
|
141
|
+
</button>
|
|
142
|
+
</div>
|
|
133
143
|
</div>
|
|
134
144
|
<div class="terminal-color-option">
|
|
135
145
|
<label for="terminalSelectionColor">Selection</label>
|
|
136
|
-
<
|
|
146
|
+
<div class="color-input-group">
|
|
147
|
+
<input type="color" id="terminalSelectionColor" class="color-input" value="#264f78">
|
|
148
|
+
<button type="button" class="color-reset-btn" data-color-target="selection" title="Restore default selection color">
|
|
149
|
+
<i class="fas fa-rotate-left"></i>
|
|
150
|
+
</button>
|
|
151
|
+
</div>
|
|
137
152
|
</div>
|
|
138
153
|
</div>
|
|
139
154
|
</div>
|
|
@@ -219,15 +234,30 @@
|
|
|
219
234
|
<div class="terminal-color-options" id="mobileTerminalColorOptions">
|
|
220
235
|
<div class="terminal-color-option">
|
|
221
236
|
<label for="mobileTerminalBgColor">Background</label>
|
|
222
|
-
<
|
|
237
|
+
<div class="color-input-group">
|
|
238
|
+
<input type="color" id="mobileTerminalBgColor" class="color-input" value="#0d1117">
|
|
239
|
+
<button type="button" class="color-reset-btn" data-color-target="bg" title="Restore default background">
|
|
240
|
+
<i class="fas fa-rotate-left"></i>
|
|
241
|
+
</button>
|
|
242
|
+
</div>
|
|
223
243
|
</div>
|
|
224
244
|
<div class="terminal-color-option">
|
|
225
245
|
<label for="mobileTerminalFgColor">Foreground</label>
|
|
226
|
-
<
|
|
246
|
+
<div class="color-input-group">
|
|
247
|
+
<input type="color" id="mobileTerminalFgColor" class="color-input" value="#e6edf3">
|
|
248
|
+
<button type="button" class="color-reset-btn" data-color-target="fg" title="Restore default foreground">
|
|
249
|
+
<i class="fas fa-rotate-left"></i>
|
|
250
|
+
</button>
|
|
251
|
+
</div>
|
|
227
252
|
</div>
|
|
228
253
|
<div class="terminal-color-option">
|
|
229
254
|
<label for="mobileTerminalSelectionColor">Selection</label>
|
|
230
|
-
<
|
|
255
|
+
<div class="color-input-group">
|
|
256
|
+
<input type="color" id="mobileTerminalSelectionColor" class="color-input" value="#264f78">
|
|
257
|
+
<button type="button" class="color-reset-btn" data-color-target="selection" title="Restore default selection color">
|
|
258
|
+
<i class="fas fa-rotate-left"></i>
|
|
259
|
+
</button>
|
|
260
|
+
</div>
|
|
231
261
|
</div>
|
|
232
262
|
</div>
|
|
233
263
|
</div>
|
package/src/webapp/js/app.js
CHANGED
|
@@ -1858,6 +1858,27 @@ sendChunkedInput(sessionId, data, chunkSize = 2048) {
|
|
|
1858
1858
|
this.updateTerminalThemes(currentTheme);
|
|
1859
1859
|
}
|
|
1860
1860
|
|
|
1861
|
+
// Restore a single terminal color to its per-theme default (the defaults
|
|
1862
|
+
// differ between the dark and light themes — see _terminalColorDefaults).
|
|
1863
|
+
// Used by the reset buttons next to each color picker in the terminal
|
|
1864
|
+
// colors dropdown (desktop) and mobile overflow submenu.
|
|
1865
|
+
resetTerminalColorToDefault(target) {
|
|
1866
|
+
const themeKey = (this.theme === 'dark' || this.theme === 'light') ? this.theme : 'dark';
|
|
1867
|
+
const defaults = this._terminalColorDefaults(themeKey);
|
|
1868
|
+
if (target === 'bg') {
|
|
1869
|
+
this.setTerminalBgColor(defaults.bg);
|
|
1870
|
+
} else if (target === 'fg') {
|
|
1871
|
+
this.setTerminalFgColor(defaults.fg);
|
|
1872
|
+
} else if (target === 'selection') {
|
|
1873
|
+
this.setTerminalSelectionColor(defaults.selection);
|
|
1874
|
+
} else {
|
|
1875
|
+
return;
|
|
1876
|
+
}
|
|
1877
|
+
// Sync both desktop and mobile pickers to the restored value.
|
|
1878
|
+
this.updateTerminalColorOverrideUI();
|
|
1879
|
+
console.log('[SSHIFT] Terminal color reset to default:', target, 'theme:', themeKey);
|
|
1880
|
+
}
|
|
1881
|
+
|
|
1861
1882
|
updateTerminalColorOverrideUI() {
|
|
1862
1883
|
// Desktop elements
|
|
1863
1884
|
const checkbox = document.getElementById('terminalColorOverride');
|
|
@@ -5546,6 +5567,18 @@ const wheelHandler = (e) => {
|
|
|
5546
5567
|
this.setTerminalSelectionColor(e.target.value);
|
|
5547
5568
|
});
|
|
5548
5569
|
}
|
|
5570
|
+
|
|
5571
|
+
// Per-picker "restore default" buttons (desktop dropdown + mobile
|
|
5572
|
+
// overflow submenu share the same class + data attribute). Defaults
|
|
5573
|
+
// are per theme (dark/light). stopPropagation keeps the dropdown/
|
|
5574
|
+
// submenu open so the user sees the picker snap back.
|
|
5575
|
+
document.querySelectorAll('.color-reset-btn').forEach(btn => {
|
|
5576
|
+
btn.addEventListener('click', (e) => {
|
|
5577
|
+
e.preventDefault();
|
|
5578
|
+
e.stopPropagation();
|
|
5579
|
+
this.resetTerminalColorToDefault(btn.dataset.colorTarget);
|
|
5580
|
+
});
|
|
5581
|
+
});
|
|
5549
5582
|
|
|
5550
5583
|
// Initialize terminal color override UI state
|
|
5551
5584
|
this.updateTerminalColorOverrideUI();
|
|
@@ -8036,6 +8069,7 @@ if (keepaliveCountMaxInput && this.sshKeepaliveCountMax) {
|
|
|
8036
8069
|
flushRemaining: null,
|
|
8037
8070
|
originalScrollback: null,
|
|
8038
8071
|
scrollbackRestoreTimer: null,
|
|
8072
|
+
settleRefreshTimer: null,
|
|
8039
8073
|
// Per-session buffer for OSC 52 / DCS sequences that arrive split
|
|
8040
8074
|
// across two write-chunk frames (see _handleOsc52).
|
|
8041
8075
|
pendingOsc52: null
|
|
@@ -9471,6 +9505,9 @@ if (keepaliveCountMaxInput && this.sshKeepaliveCountMax) {
|
|
|
9471
9505
|
if (session.terminal && session.originalScrollback) {
|
|
9472
9506
|
session.terminal.options.scrollback = session.originalScrollback;
|
|
9473
9507
|
session.originalScrollback = null;
|
|
9508
|
+
// The scrollback option change adjusts the buffer; repaint the
|
|
9509
|
+
// full viewport so no row is left showing pre-adjustment content.
|
|
9510
|
+
try { session.terminal.refresh(0, session.terminal.rows - 1); } catch (_) {}
|
|
9474
9511
|
}
|
|
9475
9512
|
session.scrollbackRestoreTimer = null;
|
|
9476
9513
|
}, 3000);
|
|
@@ -9497,6 +9534,40 @@ if (keepaliveCountMaxInput && this.sshKeepaliveCountMax) {
|
|
|
9497
9534
|
} else {
|
|
9498
9535
|
terminal.write(combined);
|
|
9499
9536
|
}
|
|
9537
|
+
|
|
9538
|
+
// Guarantee the screen converges to the buffer once this output burst
|
|
9539
|
+
// settles (see _scheduleSettleRefresh for the full rationale).
|
|
9540
|
+
this._scheduleSettleRefresh(session);
|
|
9541
|
+
}
|
|
9542
|
+
|
|
9543
|
+
// Full-viewport repaint shortly after an output burst settles.
|
|
9544
|
+
//
|
|
9545
|
+
// Under heavy output floods (TUI streaming + per-line scrollback trims
|
|
9546
|
+
// while throttled + 32KB/frame capped writes) the WebGL renderer can
|
|
9547
|
+
// miss dirty-row updates: some rows keep showing STALE content (old
|
|
9548
|
+
// backgrounds / leftover fragments) even though the terminal BUFFER is
|
|
9549
|
+
// correct. Line-diff TUI renderers (OpenCode, Bubble Tea apps, ...)
|
|
9550
|
+
// never rewrite lines they consider unchanged, so those stale rows then
|
|
9551
|
+
// persist indefinitely — visible as "interlaced black lines between
|
|
9552
|
+
// text lines" where the app's painted background alternates with the
|
|
9553
|
+
// terminal's default background. A font-size change or window resize
|
|
9554
|
+
// "fixed" it because both force a full re-render from the buffer.
|
|
9555
|
+
//
|
|
9556
|
+
// This debounced refresh(0, rows-1) after the LAST write of a burst
|
|
9557
|
+
// provides that same guarantee automatically: within ~350ms of any
|
|
9558
|
+
// burst ending, every row is re-rendered from the (correct) buffer.
|
|
9559
|
+
// Cost: one extra full-viewport render per burst — negligible.
|
|
9560
|
+
_scheduleSettleRefresh(session) {
|
|
9561
|
+
if (!session || !session.terminal) return;
|
|
9562
|
+
if (session.settleRefreshTimer) {
|
|
9563
|
+
clearTimeout(session.settleRefreshTimer);
|
|
9564
|
+
}
|
|
9565
|
+
session.settleRefreshTimer = setTimeout(() => {
|
|
9566
|
+
session.settleRefreshTimer = null;
|
|
9567
|
+
const term = session.terminal;
|
|
9568
|
+
if (!term) return;
|
|
9569
|
+
try { term.refresh(0, term.rows - 1); } catch (_) {}
|
|
9570
|
+
}, 350);
|
|
9500
9571
|
}
|
|
9501
9572
|
|
|
9502
9573
|
// SFTP Session Management
|
|
@@ -10399,6 +10470,11 @@ if (keepaliveCountMaxInput && this.sshKeepaliveCountMax) {
|
|
|
10399
10470
|
clearTimeout(session.scrollbackRestoreTimer);
|
|
10400
10471
|
session.scrollbackRestoreTimer = null;
|
|
10401
10472
|
}
|
|
10473
|
+
// Clean up settle-refresh timer
|
|
10474
|
+
if (session.settleRefreshTimer) {
|
|
10475
|
+
clearTimeout(session.settleRefreshTimer);
|
|
10476
|
+
session.settleRefreshTimer = null;
|
|
10477
|
+
}
|
|
10402
10478
|
// Restore scrollback if it was dynamically reduced
|
|
10403
10479
|
if (session.originalScrollback && session.terminal) {
|
|
10404
10480
|
session.terminal.options.scrollback = session.originalScrollback;
|
|
@@ -10498,6 +10574,7 @@ if (keepaliveCountMaxInput && this.sshKeepaliveCountMax) {
|
|
|
10498
10574
|
this.socket.emit('ssh-disconnect', { sessionId });
|
|
10499
10575
|
if (session.writeRAF) cancelAnimationFrame(session.writeRAF);
|
|
10500
10576
|
if (session.scrollbackRestoreTimer) clearTimeout(session.scrollbackRestoreTimer);
|
|
10577
|
+
if (session.settleRefreshTimer) clearTimeout(session.settleRefreshTimer);
|
|
10501
10578
|
if (session.originalScrollback && session.terminal) {
|
|
10502
10579
|
session.terminal.options.scrollback = session.originalScrollback;
|
|
10503
10580
|
}
|