@lethevimlet/sshift 1.7.8 → 1.7.9

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lethevimlet/sshift",
3
- "version": "1.7.8",
3
+ "version": "1.7.9",
4
4
  "description": "Web-based SSH + SFTP terminal client with tabs and bookmarks",
5
5
  "main": "src/server/index.js",
6
6
  "bin": {
@@ -4437,19 +4437,16 @@ const wheelHandler = (e) => {
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
- }
4440
+ // NOTE: do NOT reset the mobile handler's input tracking here.
4441
+ // v1.7.8 did (to drop the textarea's stale model of the remote line
4442
+ // after Tab/arrows/Ctrl+C) and it reintroduced the Gboard duplication
4443
+ // family, WORSE: the keys-bar taps don't blur the hidden textarea, so
4444
+ // the clear happened under a LIVE IME session — invisible to Gboard,
4445
+ // whose stale field model then re-inserted text ("characters go
4446
+ // crazy"). With an active composition the deferred reset even
4447
+ // discarded the in-flight word. The staleness after line-clearing
4448
+ // keys is minor and mostly invisible (typing still appends at the
4449
+ // remote cursor); the reset was far worse.
4453
4450
 
4454
4451
  // Focus terminal after sending key
4455
4452
  if (this.isMobile && session.mobileHandler && session.mobileHandler.hiddenTextarea) {
@@ -4864,6 +4861,14 @@ const wheelHandler = (e) => {
4864
4861
  session.flushRemaining = null;
4865
4862
  // Fresh buffer for live data arriving while the sync state is written
4866
4863
  session.syncBuffer = [];
4864
+ // A partial OSC 52 / DCS sequence stashed before the reset must
4865
+ // NOT survive into the post-sync stream: it was captured against
4866
+ // the pre-reset state, and _handleOsc52 would prepend it to the
4867
+ // next flush — the parser then eats real output into a bogus
4868
+ // clipboard sequence (garbled/missing characters right after
4869
+ // take-control / tab-switch syncs). It is already consumed
4870
+ // server-side (contained in the serialized state) — drop it.
4871
+ session.pendingOsc52 = null;
4867
4872
 
4868
4873
  // Clear the terminal completely before applying the serialized state
4869
4874
  // Use reset() to clear both the buffer and the scrollback
@@ -9812,24 +9817,43 @@ if (keepaliveCountMaxInput && this.sshKeepaliveCountMax) {
9812
9817
  clearTimeout(session.settleRefreshMaxTimer);
9813
9818
  session.settleRefreshMaxTimer = null;
9814
9819
  }
9815
- const term = session.terminal;
9816
- if (!term) return;
9817
- try { term.refresh(0, term.rows - 1); } catch (_) {}
9820
+ if (!session.terminal) return;
9821
+ // Use the full dimension recompute (the exact path a font-size
9822
+ // change triggers), NOT a plain refresh(): a plain refresh
9823
+ // repaints at the CURRENT renderer cell pitch — if a pitch desync
9824
+ // formed during the flood (the "alternating black bands between
9825
+ // text lines" bug: rows painted empty at a mismatched pitch),
9826
+ // repainting at the same broken pitch reproduces the bands.
9827
+ // Users report a font/window resize reliably heals the artefact;
9828
+ // this is the programmatic equivalent, applied automatically
9829
+ // ~350ms after every output burst settles.
9830
+ if (session.syncing) return; // sync completion does its own recompute
9831
+ this._forceRendererDimensionRecompute(session);
9818
9832
  }, 350);
9819
9833
 
9820
9834
  // Safety net for continuous floods: guarantee a full dimension-
9821
9835
  // recompute repaint at least every 2s while writes keep arriving,
9822
9836
  // otherwise the trailing refresh above is postponed indefinitely.
9823
9837
  if (!session.settleRefreshMaxTimer) {
9824
- session.settleRefreshMaxTimer = setTimeout(() => {
9838
+ const runMaxWait = () => {
9825
9839
  session.settleRefreshMaxTimer = null;
9826
9840
  if (!session.terminal) return;
9841
+ // Never run the dimension recompute mid-screen-sync: the
9842
+ // serialized state is still being parsed (terminal.reset() has
9843
+ // run but the write hasn't completed), so a full repaint now
9844
+ // paints a half-applied state and an atlas rebuild races the
9845
+ // sync completion's own recompute. Retry later.
9846
+ if (session.syncing) {
9847
+ session.settleRefreshMaxTimer = setTimeout(runMaxWait, 2000);
9848
+ return;
9849
+ }
9827
9850
  if (session.settleRefreshTimer) {
9828
9851
  clearTimeout(session.settleRefreshTimer);
9829
9852
  session.settleRefreshTimer = null;
9830
9853
  }
9831
9854
  this._forceRendererDimensionRecompute(session);
9832
- }, 2000);
9855
+ };
9856
+ session.settleRefreshMaxTimer = setTimeout(runMaxWait, 2000);
9833
9857
  }
9834
9858
  }
9835
9859