From de0fd0556cd4b97e4b46373e868ba835360088cb Mon Sep 17 00:00:00 2001 From: Vantz Stockwell Date: Tue, 17 Mar 2026 14:22:53 -0400 Subject: [PATCH] fix: font measurement race + updater download URL mismatch Two fixes: 1. Terminal font rendering: xterm.js was calling fitAddon.fit() before fonts loaded. canvas.measureText() used a fallback font, got wrong cell dimensions (2-3px per char instead of 8-9px), producing 200+ column terminals where text appeared as tiny dashes with colored blocks. Fixed by waiting for document.fonts.ready before fitting. Also prioritized Windows-native fonts (Cascadia Mono, Consolas) in the font stack. 2. Updater download URL: tagVersion used raw release.TagName ("v0.8.3") but CI uploads packages under stripped version ("0.8.3"). Download URL was .../v0.8.3/wraith-v0.8.3-setup.exe but the actual package is at .../0.8.3/wraith-0.8.3-setup.exe. Now uses latestVer (stripped). Co-Authored-By: Claude Opus 4.6 (1M context) --- frontend/src/composables/useTerminal.ts | 11 +++++++++-- internal/updater/service.go | 3 ++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/frontend/src/composables/useTerminal.ts b/frontend/src/composables/useTerminal.ts index 0b70345..1e8bdcf 100644 --- a/frontend/src/composables/useTerminal.ts +++ b/frontend/src/composables/useTerminal.ts @@ -58,7 +58,7 @@ export function useTerminal(sessionId: string): UseTerminalReturn { const terminal = new Terminal({ theme: defaultTheme, - fontFamily: "'JetBrains Mono', 'Cascadia Code', 'Fira Code', Menlo, Monaco, monospace", + fontFamily: "'Cascadia Mono', 'Cascadia Code', Consolas, 'JetBrains Mono', 'Fira Code', Menlo, Monaco, 'Courier New', monospace", fontSize: 14, lineHeight: 1.2, cursorBlink: true, @@ -138,7 +138,14 @@ export function useTerminal(sessionId: string): UseTerminalReturn { function mount(container: HTMLElement): void { terminal.open(container); - fitAddon.fit(); + + // Wait for fonts to load before measuring cell dimensions. + // If the font (JetBrains Mono etc.) isn't loaded when fitAddon.fit() + // runs, canvas.measureText() uses a fallback font and gets wrong + // cell widths — producing tiny dashes and 200+ column terminals. + document.fonts.ready.then(() => { + fitAddon.fit(); + }); // Right-click paste on the terminal's DOM element terminal.element?.addEventListener("contextmenu", handleRightClickPaste); diff --git a/internal/updater/service.go b/internal/updater/service.go index ca3651e..0f9e4ea 100644 --- a/internal/updater/service.go +++ b/internal/updater/service.go @@ -133,7 +133,8 @@ func (u *UpdateService) CheckForUpdate() (*UpdateInfo, error) { } // Newer version is available — fetch version.json for SHA256 + download URL. - tagVersion := release.TagName // e.g. "v0.6.0" or "0.6.0" + // Use the stripped version (no "v" prefix) because CI uploads packages under "0.8.3" not "v0.8.3" + tagVersion := latestVer versionInfoURL := fmt.Sprintf( "%s/api/packages/%s/generic/%s/%s/version.json", u.baseURL, u.owner, u.pkg, tagVersion,