From abe0640331e7ea6a26fe0db032da7499384bccfc Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Mon, 5 Aug 2024 11:50:36 -0700 Subject: [PATCH 1/5] Use main document to create viewport element See microsoft/vscode#224555 --- src/browser/Viewport.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/browser/Viewport.ts b/src/browser/Viewport.ts index 6a8e155f43..241f4df431 100644 --- a/src/browser/Viewport.ts +++ b/src/browser/Viewport.ts @@ -76,7 +76,7 @@ export class Viewport extends Disposable { element.appendChild(this._scrollableElement.getDomNode()); this._register(toDisposable(() => this._scrollableElement.getDomNode().remove())); - this._styleElement = coreBrowserService.window.document.createElement('style'); + this._styleElement = coreBrowserService.mainDocument.createElement('style'); screenElement.appendChild(this._styleElement); this._register(toDisposable(() => this._styleElement.remove())); this._register(Event.runAndSubscribe(themeService.onChangeColors, () => { From dd54ef13bcc17a184bd995b411f03791e33de4f8 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Thu, 8 Aug 2024 05:54:56 -0700 Subject: [PATCH 2/5] Update node-pty, use conpty.dll --- demo/server.js | 9 ++++++--- package.json | 2 +- yarn.lock | 20 ++++++++++---------- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/demo/server.js b/demo/server.js index 8a8c5d1139..748546d9b0 100644 --- a/demo/server.js +++ b/demo/server.js @@ -59,13 +59,16 @@ function startServer() { } const cols = parseInt(req.query.cols); const rows = parseInt(req.query.rows); - const term = pty.spawn(process.platform === 'win32' ? 'pwsh.exe' : 'bash', [], { + const isWindows = process.platform === 'win32'; + const term = pty.spawn(isWindows ? 'pwsh.exe' : 'bash', [], { name: 'xterm-256color', cols: cols ?? 80, rows: rows ?? 24, - cwd: process.platform === 'win32' ? undefined : env.PWD, + cwd: isWindows ? undefined : env.PWD, env, - encoding: USE_BINARY ? null : 'utf8' + encoding: USE_BINARY ? null : 'utf8', + useConpty: isWindows, + useConptyDll: isWindows, }); console.log('Created terminal with PID: ' + term.pid); diff --git a/package.json b/package.json index 479d9dc613..6b3f6910a3 100644 --- a/package.json +++ b/package.json @@ -95,7 +95,7 @@ "jsdom": "^18.0.1", "mocha": "^10.1.0", "mustache": "^4.2.0", - "node-pty": "1.1.0-beta5", + "node-pty": "1.1.0-beta19", "nyc": "^15.1.0", "source-map-loader": "^3.0.0", "source-map-support": "^0.5.20", diff --git a/yarn.lock b/yarn.lock index 5925b86dae..82f5dee877 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3190,11 +3190,6 @@ mustache@^4.2.0: resolved "https://registry.yarnpkg.com/mustache/-/mustache-4.2.0.tgz#e5892324d60a12ec9c2a73359edca52972bf6f64" integrity sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ== -nan@^2.17.0: - version "2.18.0" - resolved "https://registry.yarnpkg.com/nan/-/nan-2.18.0.tgz#26a6faae7ffbeb293a39660e88a76b82e30b7554" - integrity sha512-W7tfG7vMOGtD30sHoZSSc/JVYiyDPEyQVso/Zz+/uQd0B0L46gtC+pHha5FFMRpil6fm/AoEcRWyOVi4+E/f8w== - nanoid@3.3.3: version "3.3.3" resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.3.tgz#fd8e8b7aa761fe807dba2d1b98fb7241bb724a25" @@ -3220,6 +3215,11 @@ neo-async@^2.6.2: resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== +node-addon-api@^7.1.0: + version "7.1.1" + resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-7.1.1.tgz#1aba6693b0f255258a049d621329329322aad558" + integrity sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ== + node-preload@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/node-preload/-/node-preload-0.2.1.tgz#c03043bb327f417a18fee7ab7ee57b408a144301" @@ -3227,12 +3227,12 @@ node-preload@^0.2.1: dependencies: process-on-spawn "^1.0.0" -node-pty@1.1.0-beta5: - version "1.1.0-beta5" - resolved "https://registry.yarnpkg.com/node-pty/-/node-pty-1.1.0-beta5.tgz#364386b7058a93070234064f13164ec1ef914993" - integrity sha512-j3QdgFHnLY0JWxztrvM3g67RaQLOGvytv+C6mFu0PqD+JILlzqfwuoyqRqVxdZZjoOTUXPfSRj1qPVCaCH+eOw== +node-pty@1.1.0-beta19: + version "1.1.0-beta19" + resolved "https://registry.yarnpkg.com/node-pty/-/node-pty-1.1.0-beta19.tgz#a74dc04429903c5ac49ee81a15a24590da67d4f3" + integrity sha512-/p4Zu56EYDdXjjaLWzrIlFyrBnND11LQGP0/L6GEVGURfCNkAlHc3Twg/2I4NPxghimHXgvDlwp7Z2GtvDIh8A== dependencies: - nan "^2.17.0" + node-addon-api "^7.1.0" node-releases@^2.0.12: version "2.0.13" From fcad91a682d0602294f70b1df0f9bdc393562e99 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Thu, 15 Aug 2024 05:56:24 -0700 Subject: [PATCH 3/5] Remove xterm- prefix from addon mjs output Fixes #5128 --- bin/esbuild.mjs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/bin/esbuild.mjs b/bin/esbuild.mjs index 71bee9aa53..9ed69edab8 100644 --- a/bin/esbuild.mjs +++ b/bin/esbuild.mjs @@ -102,7 +102,7 @@ if (config.addon) { bundleConfig = { ...bundleConfig, entryPoints: [`addons/addon-${config.addon}/src/${getAddonEntryPoint(config.addon)}.ts`], - outfile: `addons/addon-${config.addon}/lib/xterm-addon-${config.addon}.mjs`, + outfile: `addons/addon-${config.addon}/lib/addon-${config.addon}.mjs`, }; outConfig = { ...outConfig, @@ -132,16 +132,16 @@ if (config.addon) { alias: { // Library ESM imports "@xterm/xterm": ".", - "@xterm/addon-attach": "./addons/addon-attach/lib/xterm-addon-attach.mjs", - "@xterm/addon-clipboard": "./addons/addon-clipboard/lib/xterm-addon-clipboard.mjs", - "@xterm/addon-fit": "./addons/addon-fit/lib/xterm-addon-fit.mjs", - "@xterm/addon-image": "./addons/addon-image/lib/xterm-addon-image.mjs", - "@xterm/addon-search": "./addons/addon-search/lib/xterm-addon-search.mjs", - "@xterm/addon-serialize": "./addons/addon-serialize/lib/xterm-addon-serialize.mjs", - "@xterm/addon-web-links": "./addons/addon-web-links/lib/xterm-addon-web-links.mjs", - "@xterm/addon-webgl": "./addons/addon-webgl/lib/xterm-addon-webgl.mjs", - "@xterm/addon-unicode11": "./addons/addon-unicode11/lib/xterm-addon-unicode11.mjs", - "@xterm/addon-unicode-graphemes": "./addons/addon-unicode-graphemes/lib/xterm-addon-unicode-graphemes.mjs", + "@xterm/addon-attach": "./addons/addon-attach/lib/addon-attach.mjs", + "@xterm/addon-clipboard": "./addons/addon-clipboard/lib/addon-clipboard.mjs", + "@xterm/addon-fit": "./addons/addon-fit/lib/addon-fit.mjs", + "@xterm/addon-image": "./addons/addon-image/lib/addon-image.mjs", + "@xterm/addon-search": "./addons/addon-search/lib/addon-search.mjs", + "@xterm/addon-serialize": "./addons/addon-serialize/lib/addon-serialize.mjs", + "@xterm/addon-web-links": "./addons/addon-web-links/lib/addon-web-links.mjs", + "@xterm/addon-webgl": "./addons/addon-webgl/lib/addon-webgl.mjs", + "@xterm/addon-unicode11": "./addons/addon-unicode11/lib/addon-unicode11.mjs", + "@xterm/addon-unicode-graphemes": "./addons/addon-unicode-graphemes/lib/addon-unicode-graphemes.mjs", // Non-bundled ESM imports // HACK: Ligatures imports fs which in the esbuild bundle resolves at runtime _on startup_ From a07d97a9d35cf3f6f57161f7fcc9adb841d9f647 Mon Sep 17 00:00:00 2001 From: Kyosuke Fujimoto Date: Wed, 28 Aug 2024 16:21:34 +0900 Subject: [PATCH 4/5] Add test for jpg without APP segment to IIPMetrics --- .../fixture/testimages/w3c_home_noexif.jpg | Bin 0 -> 2147 bytes addons/addon-image/src/IIPMetrics.test.ts | 1 + 2 files changed, 1 insertion(+) create mode 100644 addons/addon-image/fixture/testimages/w3c_home_noexif.jpg diff --git a/addons/addon-image/fixture/testimages/w3c_home_noexif.jpg b/addons/addon-image/fixture/testimages/w3c_home_noexif.jpg new file mode 100644 index 0000000000000000000000000000000000000000..a46c97ce668f3ace815465d0128252974e20a9de GIT binary patch literal 2147 zcmbW%do=8@z` z2IC}DO!5ew9wZu}Vu<3H%%sD_nBSSsx$B;_`s>{LU2E@u_IG{P{(SfPZs;{M1hxP) z5`{(~(P$JJgF!1{)v;J*Wvu2hHJrMRrmn7zrnWY5xha{bZ)~8gZMe$Nm}0ile5D?l zW=W%3no?I%zZHRDFc_>7mVm_)s6=fd^?wei8Q_(GC2&K)i~t-DL*QZ1BR~cKhJyVW z;6DL_BNX?=C@EuA6bW_e01iVS;79}tg+wZ{6BXwGiAQOySi2cb*uEEI6sc*&zErGa z>~y2#_1c8jvHwU1b9--#Zqw#ho7 zspK2&PuV|%CH-Hr|HA%u4FVhjrg%IA9?-!&1f&d-5(J8E+gMVIWC)xqk!y7((LZ{M zhvnE22#kh5V;vgG2zCRxcrt+bJh+P z<-3oj`bJdd_nJ3no(&7$kis3ucBtr@2d{;?qMVQs$yyFz-%ff+> z7^L~00@C{>Ow}=mrnP5paw#_s82F#qemv|$9RynMiCveJoAe>j5&<}1*y|b^_UG>3R{3O+O$6L1+auw5~ys7xQW211-qmKFWSyY3@tzA0g zz=8SE2N#jrl&q4~8T8y8-R?TVS7RHJ89&?s64i+W1IUBz$ zvxWeSH$2AVj6S?zXO>EPb0zs{ibSTm5+{;U+N8b^Ao7C z&2tE_G$Ak??KQG4mSiC<=1TK@U_Y~o`+g9HWQ}`oN}B0>!8pQoIXuSL+TXQc@I-^N zXg$>n0qZSuS0uaHGzZhNi4A_*;e~uSW}$Wg7b^eyg*P@rDHcvLwNR<-wYD~6iPI-| z1GuVJ>7O<<8(ss;onsSnE|gA%8%^0o7rwX@bGHzC-?-O=(M2M%9n=;#*XQr0JVmTM zQ$Z*BUP{AyEt-^nSmgJk%y2GxJ(-#2@-pAPTLM2)`Q*n0`t++}UjB%3-Nsxw#qRmi z^S8afd_AX815UF~X0~S}Fa$d0XFanZy4qw0OTBRhE9U4(*N9lPqzp@rP3-x*FE2X=v^wsUia7Gc zYEQ+maumaAz*h`wvKw96kkMoqr_9rck;JAvlT;YFMO!33socD0+4Pwho-0#r+pt=Y zuYTlIo>hgrue)RB_)NOp8kvcsieO!HT{ zueK*!W+vI08%xC{PL0x(u_cd3gRknNULLS|&&>Q(irjWew6nV&Q z4u7%VbaRB-$=GmX*klf+dQb|1W}BQzRP_ZW4T-;K5;?VVin|G@vIBiOdbj7+q?FPW zznN~Qsy#10kd~?JxSG}4(8N-ed7uB{38U{5>`Qx=DTmDmo_X(n5e@Ly;vRReiIwOx zq&=fc)@^c7-*{Ur%6?;;ms4sdI=JhN6%S^Jt5zwvjku0}aFQY6v_%~3pC0T?=aX3x z1z#Bq!ONS8$DcXdZ<7?YWf=8DL=|boId!~>S04)Y- Date: Wed, 28 Aug 2024 16:22:21 +0900 Subject: [PATCH 5/5] Fix IIPMetrics jpg detection --- addons/addon-image/src/IIPMetrics.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/addons/addon-image/src/IIPMetrics.ts b/addons/addon-image/src/IIPMetrics.ts index 03770c4388..d5470466f9 100644 --- a/addons/addon-image/src/IIPMetrics.ts +++ b/addons/addon-image/src/IIPMetrics.ts @@ -32,13 +32,8 @@ export function imageType(d: Uint8Array): IMetrics { height: d[20] << 24 | d[21] << 16 | d[22] << 8 | d[23] }; } - // JPEG: FF D8 FF E0 xx xx JFIF or FF D8 FF E1 xx xx Exif 00 00 - if ((d32[0] === 0xE0FFD8FF || d32[0] === 0xE1FFD8FF) - && ( - (d[6] === 0x4a && d[7] === 0x46 && d[8] === 0x49 && d[9] === 0x46) - || (d[6] === 0x45 && d[7] === 0x78 && d[8] === 0x69 && d[9] === 0x66) - ) - ) { + // JPEG: FF D8 FF + if (d[0] === 0xFF && d[1] === 0xD8 && d[2] === 0xFF) { const [width, height] = jpgSize(d); return { mime: 'image/jpeg', width, height }; }