@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 +1 -1
- package/src/webapp/js/app.js +12 -47
package/package.json
CHANGED
package/src/webapp/js/app.js
CHANGED
|
@@ -995,34 +995,13 @@ sendChunkedInput(sessionId, data, chunkSize = 2048) {
|
|
|
995
995
|
session.terminal.refresh(0, session.terminal.rows - 1);
|
|
996
996
|
}
|
|
997
997
|
|
|
998
|
-
//
|
|
999
|
-
//
|
|
1000
|
-
//
|
|
1001
|
-
//
|
|
1002
|
-
//
|
|
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
|
-
|
|
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
|
|
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
|
-
//
|
|
1268
|
-
//
|
|
1269
|
-
//
|
|
1270
|
-
//
|
|
1271
|
-
|
|
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
|
|