@lethevimlet/sshift 1.4.3 → 1.4.5

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.5",
4
4
  "description": "Web-based SSH + SFTP terminal client with tabs and bookmarks",
5
5
  "main": "src/server/index.js",
6
6
  "bin": {
@@ -996,11 +996,14 @@ sendChunkedInput(sessionId, data, chunkSize = 2048) {
996
996
  }
997
997
 
998
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.
999
+ // letterSpacing. When cellWidth × DPR is fractional, adjacent cells
1000
+ // land on sub-pixel boundaries, causing 1px vertical seams in block
1001
+ // characters. Adding a tiny letterSpacing rounds the device-pixel cell
1002
+ // width up to a whole number, eliminating seams.
1003
+ //
1004
+ // Only applies when the needed padding is <= 0.15 CSS px — larger
1005
+ // padding is visually noticeable as extra character spacing, so we
1006
+ // skip it and accept the occasional 1px seam instead.
1004
1007
  _snapCellWidth(session) {
1005
1008
  if (!session || !session.terminal || !session.fitAddon) return;
1006
1009
  const term = session.terminal;
@@ -1014,12 +1017,15 @@ sendChunkedInput(sessionId, data, chunkSize = 2048) {
1014
1017
  const deviceW = cellCssW * dpr;
1015
1018
  const fraction = deviceW - Math.floor(deviceW);
1016
1019
 
1017
- if (fraction > 0.01) {
1018
- // Pad up to the next whole device pixel, converted back to CSS px.
1020
+ if (fraction > 0.01 && fraction < 0.99) {
1019
1021
  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;
1022
+ // Only snap if the padding needed is tiny (imperceptible).
1023
+ // Larger padding creates visible gaps between characters.
1024
+ if (padCss <= 0.15) {
1025
+ term.options.letterSpacing = padCss;
1026
+ } else {
1027
+ term.options.letterSpacing = 0;
1028
+ }
1023
1029
  } else {
1024
1030
  term.options.letterSpacing = 0;
1025
1031
  }
@@ -1166,9 +1172,7 @@ sendChunkedInput(sessionId, data, chunkSize = 2048) {
1166
1172
  // Watch for devicePixelRatio changes (zoom, monitor move, DPI switch).
1167
1173
  // When DPR changes the WebGL glyph atlas is built for the old pixel ratio
1168
1174
  // 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.
1175
+ // We also refit terminals so they recalculate at the new DPR.
1172
1176
  _setupDPRListener() {
1173
1177
  let currentDPR = window.devicePixelRatio;
1174
1178
  const query = matchMedia(`(resolution: ${currentDPR}dppx)`);