@lethevimlet/sshift 1.4.3 → 1.4.4

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.4.3",
3
+ "version": "1.4.4",
4
4
  "description": "Web-based SSH + SFTP terminal client with tabs and bookmarks",
5
5
  "main": "src/server/index.js",
6
6
  "bin": {
@@ -995,34 +995,13 @@ sendChunkedInput(sessionId, data, chunkSize = 2048) {
995
995
  session.terminal.refresh(0, session.terminal.rows - 1);
996
996
  }
997
997
 
998
- // Snap cell width to an integer number of device pixels by adjusting
999
- // letterSpacing. When the CSS cell width × devicePixelRatio is fractional,
1000
- // adjacent cells alternate between N and N+1 device pixels, leaving 1px
1001
- // vertical seams in block/box-drawing characters. Adding a tiny
1002
- // letterSpacing pad rounds the device-pixel width up to a whole number,
1003
- // eliminating seams regardless of zoom level or DPR.
998
+ // Disabled: letterSpacing snapping produced visible gaps between all
999
+ // characters without reliably fixing block-character seams. Kept for
1000
+ // future re-evaluation — the math is correct but xterm.js customGlyphs
1001
+ // does not fill the letterSpacing portion of block characters.
1002
+ // See v1.4.2–v1.4.3 commit messages for details.
1004
1003
  _snapCellWidth(session) {
1005
- if (!session || !session.terminal || !session.fitAddon) return;
1006
- const term = session.terminal;
1007
- const core = term._core;
1008
- if (!core?._renderService?.dimensions?.css?.cell) return;
1009
-
1010
- const cellCssW = core._renderService.dimensions.css.cell.width;
1011
- if (!cellCssW || cellCssW <= 0) return;
1012
-
1013
- const dpr = window.devicePixelRatio || 1;
1014
- const deviceW = cellCssW * dpr;
1015
- const fraction = deviceW - Math.floor(deviceW);
1016
-
1017
- if (fraction > 0.01) {
1018
- // Pad up to the next whole device pixel, converted back to CSS px.
1019
- const padCss = (1 - fraction) / dpr;
1020
- // Clamp to avoid excessive spacing — 0.5 CSS px is generous.
1021
- const clampedPad = Math.min(padCss, 0.5);
1022
- term.options.letterSpacing = clampedPad;
1023
- } else {
1024
- term.options.letterSpacing = 0;
1025
- }
1004
+ // No-op: disabled. customGlyphs: true is the primary seam mitigation.
1026
1005
  }
1027
1006
 
1028
1007
  // Initialize (or re-initialize) the WebGL renderer addon for a session.
@@ -1113,7 +1092,6 @@ sendChunkedInput(sessionId, data, chunkSize = 2048) {
1113
1092
  if (session.webglAddon) {
1114
1093
  try { session.webglAddon.clearTextureAtlas(); } catch (_) {}
1115
1094
  }
1116
- this._snapCellWidth(session);
1117
1095
  if (session.terminal) {
1118
1096
  session.terminal.refresh(0, session.terminal.rows - 1);
1119
1097
  }
@@ -1166,9 +1144,7 @@ sendChunkedInput(sessionId, data, chunkSize = 2048) {
1166
1144
  // Watch for devicePixelRatio changes (zoom, monitor move, DPI switch).
1167
1145
  // When DPR changes the WebGL glyph atlas is built for the old pixel ratio
1168
1146
  // and every glyph becomes mis-scaled; clearing the atlas forces a rebuild.
1169
- // We also refit and re-snap letterSpacing so cells remain integer-width
1170
- // in device pixels at the new DPR, eliminating seams on fractional-DPR
1171
- // displays.
1147
+ // We also refit terminals so they recalculate at the new DPR.
1172
1148
  _setupDPRListener() {
1173
1149
  let currentDPR = window.devicePixelRatio;
1174
1150
  const query = matchMedia(`(resolution: ${currentDPR}dppx)`);
@@ -1179,7 +1155,6 @@ sendChunkedInput(sessionId, data, chunkSize = 2048) {
1179
1155
  currentDPR = newDPR;
1180
1156
  this.sessions.forEach(session => {
1181
1157
  this._resetWebGLAtlas(session);
1182
- this._snapCellWidth(session);
1183
1158
  if (session.fitAddon && session.terminal && session.isController) {
1184
1159
  const wrapper = document.getElementById(`terminal-wrapper-${session.id}`);
1185
1160
  if (wrapper && wrapper.classList.contains('active')) {
@@ -1264,21 +1239,11 @@ sendChunkedInput(sessionId, data, chunkSize = 2048) {
1264
1239
  }
1265
1240
  }
1266
1241
 
1267
- // Snap cell width to an integer number of device pixels so block/box
1268
- // drawing characters tile without 1px seams on fractional-DPR displays.
1269
- // This MUST be followed by a refit because letterSpacing changes the
1270
- // cell width, which changes how many columns fit in the container.
1271
- const letterSpacingBefore = terminal.options.letterSpacing || 0;
1272
- this._snapCellWidth(session);
1273
- const letterSpacingAfter = terminal.options.letterSpacing || 0;
1274
-
1275
- // If letterSpacing changed, refit so xterm recalculates column count
1276
- // with the new (snapped) cell width.
1277
- if (letterSpacingAfter !== letterSpacingBefore) {
1278
- try {
1279
- session.fitAddon.fit();
1280
- } catch (_) {}
1281
- }
1242
+ // NOTE: subpixel seam mitigation is handled by customGlyphs: true in
1243
+ // the Terminal options and by the DPR listener in _setupDPRListener.
1244
+ // letterSpacing snapping was tried but produced visible gaps between
1245
+ // all characters without reliably fixing block-character seams, so it
1246
+ // is disabled for now.
1282
1247
 
1283
1248
  console.log('[SSHIFT] Terminal fitted, cols:', terminal.cols, 'rows:', terminal.rows);
1284
1249