@lethevimlet/sshift 1.7.7 → 1.7.8
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/js/app.js +34 -9
- package/src/webapp/js/mobile-terminal.js +16 -15
package/package.json
CHANGED
package/src/webapp/js/app.js
CHANGED
|
@@ -4436,7 +4436,21 @@ const wheelHandler = (e) => {
|
|
|
4436
4436
|
this.socket.emit('ssh-data', { sessionId: this.activeSessionId, data: keySequence });
|
|
4437
4437
|
console.log('[SSHIFT] Sent mobile key:', keyName, 'sequence:', keySequence);
|
|
4438
4438
|
}
|
|
4439
|
-
|
|
4439
|
+
|
|
4440
|
+
// Keys-bar keys change the remote line/cursor in ways the hidden
|
|
4441
|
+
// textarea cannot model (Tab completes a word, arrows move the
|
|
4442
|
+
// cursor mid-line, Ctrl+C/U/D abort or clear the line, Esc aborts).
|
|
4443
|
+
// The textarea diff assumes the remote cursor sits at the END of
|
|
4444
|
+
// the sent baseline — that model is dead now. Reset the field and
|
|
4445
|
+
// baseline so typing continues from a clean slate: new input
|
|
4446
|
+
// appends at the remote cursor position, exactly like a real
|
|
4447
|
+
// keyboard. _resetInputTracking is composition-guarded, so an
|
|
4448
|
+
// in-flight Gboard composition is not corrupted mid-word (the
|
|
4449
|
+
// reset is deferred to compositionend).
|
|
4450
|
+
if (this.isMobile && session.mobileHandler && session.mobileHandler.hiddenTextarea) {
|
|
4451
|
+
session.mobileHandler._resetInputTracking();
|
|
4452
|
+
}
|
|
4453
|
+
|
|
4440
4454
|
// Focus terminal after sending key
|
|
4441
4455
|
if (this.isMobile && session.mobileHandler && session.mobileHandler.hiddenTextarea) {
|
|
4442
4456
|
session.mobileHandler._focusHiddenTextarea();
|
|
@@ -4774,6 +4788,11 @@ const wheelHandler = (e) => {
|
|
|
4774
4788
|
if (data.noTerminalState) {
|
|
4775
4789
|
console.log('[SSHIFT] No terminal state on server, clearing syncing flag');
|
|
4776
4790
|
session.syncing = false;
|
|
4791
|
+
// No serialized state is coming — the data buffered during the
|
|
4792
|
+
// sync window is the ONLY output this client has received.
|
|
4793
|
+
// Drain it or it stays stuck (permanently missing rows in
|
|
4794
|
+
// line-diff TUI screens — the stale/black-line bug).
|
|
4795
|
+
this._drainSyncBuffer(session);
|
|
4777
4796
|
}
|
|
4778
4797
|
|
|
4779
4798
|
// Handle controller status
|
|
@@ -9606,17 +9625,23 @@ if (keepaliveCountMaxInput && this.sshKeepaliveCountMax) {
|
|
|
9606
9625
|
// into the normal write path and schedule a flush. Called when a sync
|
|
9607
9626
|
// completes (or is aborted) so no live output is lost.
|
|
9608
9627
|
_drainSyncBuffer(session) {
|
|
9609
|
-
if (!session
|
|
9628
|
+
if (!session) return;
|
|
9610
9629
|
const buffered = session.syncBuffer || [];
|
|
9611
9630
|
session.syncBuffer = [];
|
|
9612
|
-
if (buffered.length
|
|
9631
|
+
if (buffered.length === 0) return;
|
|
9632
|
+
if (!session.terminal) {
|
|
9633
|
+
// Terminal not created yet — keep the data in the regular write
|
|
9634
|
+
// buffer; its terminal-not-ready retry path flushes it once the
|
|
9635
|
+
// terminal exists. Never discard live output.
|
|
9613
9636
|
session.writeChunks.push(...buffered);
|
|
9614
|
-
|
|
9615
|
-
|
|
9616
|
-
|
|
9617
|
-
|
|
9618
|
-
|
|
9619
|
-
|
|
9637
|
+
return;
|
|
9638
|
+
}
|
|
9639
|
+
session.writeChunks.push(...buffered);
|
|
9640
|
+
if (!session.writeRAF) {
|
|
9641
|
+
const sessionId = session.id;
|
|
9642
|
+
session.writeRAF = requestAnimationFrame(() => {
|
|
9643
|
+
this._flushWriteChunks(sessionId);
|
|
9644
|
+
});
|
|
9620
9645
|
}
|
|
9621
9646
|
}
|
|
9622
9647
|
|
|
@@ -1561,23 +1561,24 @@ class MobileTerminalHandler {
|
|
|
1561
1561
|
// Do NOT clear the textarea on refocus. The diff baseline
|
|
1562
1562
|
// (_sentValue) tracks exactly what was sent to the terminal, so
|
|
1563
1563
|
// stale-looking content is NOT stale: textarea, baseline and the
|
|
1564
|
-
// remote prompt line all agree
|
|
1565
|
-
//
|
|
1564
|
+
// remote prompt line all agree. Clearing here (v1.7.0 behaviour)
|
|
1565
|
+
// is a programmatic assignment INVISIBLE to Gboard, desyncing its
|
|
1566
|
+
// field model — the "hel" + autocomplete → "helhel" bug. Keeping
|
|
1567
|
+
// the text lets the IME operate on the real pending line so
|
|
1568
|
+
// suggestion taps send only the true delta.
|
|
1566
1569
|
//
|
|
1567
|
-
//
|
|
1568
|
-
//
|
|
1569
|
-
//
|
|
1570
|
-
//
|
|
1571
|
-
//
|
|
1572
|
-
//
|
|
1573
|
-
//
|
|
1574
|
-
//
|
|
1575
|
-
//
|
|
1576
|
-
|
|
1577
|
-
// Genuine context switches (session teardown, Enter/newline,
|
|
1578
|
-
// Tab key, selection start) still reset explicitly via
|
|
1579
|
-
// _resetInputTracking().
|
|
1570
|
+
// CRITICAL: the diff is append-at-end semantics (longest common
|
|
1571
|
+
// prefix from the END of the sent baseline). After a programmatic
|
|
1572
|
+
// focus() the caret typically lands at position 0 (NOT at the end
|
|
1573
|
+
// of the text), so the next keystroke would be inserted at the
|
|
1574
|
+
// START of the field — the diff then sees total divergence and
|
|
1575
|
+
// re-sends the ENTIRE field, retyping already-echoed words on
|
|
1576
|
+
// every keystroke after a tap (the "repeats words without
|
|
1577
|
+
// autocomplete" regression). Force the caret to the end so typing
|
|
1578
|
+
// appends, matching both the diff and the remote prompt cursor.
|
|
1579
|
+
const len = this.hiddenTextarea.value.length;
|
|
1580
1580
|
this.hiddenTextarea.focus();
|
|
1581
|
+
try { this.hiddenTextarea.setSelectionRange(len, len); } catch (_) {}
|
|
1581
1582
|
this._keyboardCollapsed = false;
|
|
1582
1583
|
}
|
|
1583
1584
|
}
|