@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 +1 -1
- package/src/webapp/js/app.js +17 -13
package/package.json
CHANGED
package/src/webapp/js/app.js
CHANGED
|
@@ -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
|
|
1000
|
-
//
|
|
1001
|
-
//
|
|
1002
|
-
//
|
|
1003
|
-
//
|
|
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
|
-
//
|
|
1021
|
-
|
|
1022
|
-
|
|
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
|
|
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)`);
|