From d4acf2fa45ab2a5a9f1147b6fb2b36cd8656d871 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Sun, 31 May 2026 20:39:43 -0700 Subject: [PATCH 01/10] fix(browser): use radix 10 for padding parseInt in Mouse coords parseInt without a radix can mis-parse leading-zero padding values as octal. Match AccessibilityManager and document rowCount JSDoc typo. Co-authored-by: Cursor --- src/browser/input/Mouse.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/browser/input/Mouse.ts b/src/browser/input/Mouse.ts index c40a7cc78..5f73743fb 100644 --- a/src/browser/input/Mouse.ts +++ b/src/browser/input/Mouse.ts @@ -6,8 +6,8 @@ export function getCoordsRelativeToElement(window: Pick, event: {clientX: number, clientY: number}, element: HTMLElement): [number, number] { const rect = element.getBoundingClientRect(); const elementStyle = window.getComputedStyle(element); - const leftPadding = parseInt(elementStyle.getPropertyValue('padding-left')); - const topPadding = parseInt(elementStyle.getPropertyValue('padding-top')); + const leftPadding = parseInt(elementStyle.getPropertyValue('padding-left'), 10); + const topPadding = parseInt(elementStyle.getPropertyValue('padding-top'), 10); return [ event.clientX - rect.left - leftPadding, event.clientY - rect.top - topPadding @@ -22,7 +22,7 @@ export function getCoordsRelativeToElement(window: Pick Date: Sun, 31 May 2026 21:55:20 -0700 Subject: [PATCH 02/10] fix(common): pass radix 10 to parseInt in getSafariVersion Safari major version parsing used parseInt without an explicit radix. Other call sites in the repo use base 10; add the radix for consistency and to avoid octal interpretation of leading-zero strings. Co-authored-by: Cursor --- src/common/Platform.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/Platform.ts b/src/common/Platform.ts index 09ba097e6..9ccf8bda8 100644 --- a/src/common/Platform.ts +++ b/src/common/Platform.ts @@ -41,7 +41,7 @@ export function getSafariVersion(): number { if (majorVersion === null || majorVersion.length < 2) { return 0; } - return parseInt(majorVersion[1]); + return parseInt(majorVersion[1], 10); } // Find the users platform. We use this to interpret the meta key From f04679a42ef4dadd3ba919377550d98a11cce29e Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Sun, 31 May 2026 22:12:26 -0700 Subject: [PATCH 03/10] fix(common): pass radix 10 when parsing rgb() components in Color rgba/rgb CSS parsing used parseInt without a radix on captured digit groups. Add base 10 explicitly, matching getSafariVersion and other call sites in the codebase. Co-authored-by: Cursor --- src/common/Color.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/Color.ts b/src/common/Color.ts index aa3ca00ab..d416d670e 100644 --- a/src/common/Color.ts +++ b/src/common/Color.ts @@ -177,9 +177,9 @@ export namespace css { // Formats: rgb() or rgba() const rgbaMatch = css.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/); if (rgbaMatch) { - $r = parseInt(rgbaMatch[1]); - $g = parseInt(rgbaMatch[2]); - $b = parseInt(rgbaMatch[3]); + $r = parseInt(rgbaMatch[1], 10); + $g = parseInt(rgbaMatch[2], 10); + $b = parseInt(rgbaMatch[3], 10); $a = Math.round((rgbaMatch[5] === undefined ? 1 : parseFloat(rgbaMatch[5])) * 0xFF); return channels.toColor($r, $g, $b, $a); } From 878e3fc52d3cf2313b3d5775663e8286f431b38f Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Sun, 31 May 2026 22:32:13 -0700 Subject: [PATCH 04/10] fix(browser): pass radix 10 when parsing Chrome major version Wheel event DPR factoring parses Chrome/(\d+) with parseInt without a radix. Add base 10 explicitly, matching getSafariVersion and other version parsing in the codebase. Co-authored-by: Cursor --- src/browser/scrollable/mouseEvent.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/browser/scrollable/mouseEvent.ts b/src/browser/scrollable/mouseEvent.ts index 6be8963e2..f6fca88f1 100644 --- a/src/browser/scrollable/mouseEvent.ts +++ b/src/browser/scrollable/mouseEvent.ts @@ -217,7 +217,7 @@ export class StandardWheelEvent { let shouldFactorDPR: boolean = false; if (platform.isChrome) { const chromeVersionMatch = navigator.userAgent.match(/Chrome\/(\d+)/); - const chromeMajorVersion = chromeVersionMatch ? parseInt(chromeVersionMatch[1]) : 123; + const chromeMajorVersion = chromeVersionMatch ? parseInt(chromeVersionMatch[1], 10) : 123; shouldFactorDPR = chromeMajorVersion <= 122; } From b0f6aed4a1a7ff27609b15d77f683a8d4923b0b7 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Sun, 31 May 2026 23:03:46 -0700 Subject: [PATCH 05/10] fix(common): pass radix 10 when parsing OSC color indices InputHandler parsed palette indices from OSC color sequences with parseInt without a radix after validating digits-only slots. Use base 10 for set/report and restore color index parsing. Co-authored-by: Cursor --- src/common/InputHandler.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/InputHandler.ts b/src/common/InputHandler.ts index 9d725cd1b..0b12dd8e1 100644 --- a/src/common/InputHandler.ts +++ b/src/common/InputHandler.ts @@ -3065,7 +3065,7 @@ export class InputHandler extends Disposable implements IInputHandler { const idx = slots.shift() as string; const spec = slots.shift() as string; if (/^\d+$/.exec(idx)) { - const index = parseInt(idx); + const index = parseInt(idx, 10); if (isValidColorIndex(index)) { if (spec === '?') { event.push({ type: ColorRequestType.REPORT, index }); @@ -3228,7 +3228,7 @@ export class InputHandler extends Disposable implements IInputHandler { const slots = data.split(';'); for (let i = 0; i < slots.length; ++i) { if (/^\d+$/.exec(slots[i])) { - const index = parseInt(slots[i]); + const index = parseInt(slots[i], 10); if (isValidColorIndex(index)) { event.push({ type: ColorRequestType.RESTORE, index }); } From 99550840d24b8e43e0a6d2dfca73d7fe93b09b4f Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Sun, 31 May 2026 22:43:31 -0700 Subject: [PATCH 06/10] fix(fit): add radix and zero fallback for parent width parsing Align parent width parsing with the height fix: parseInt with radix 10 and || 0 inside Math.max so non-numeric CSS width does not yield NaN cols in proposeDimensions. Co-authored-by: Cursor --- addons/addon-fit/src/FitAddon.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/addon-fit/src/FitAddon.ts b/addons/addon-fit/src/FitAddon.ts index 3db988acd..fab52dfde 100644 --- a/addons/addon-fit/src/FitAddon.ts +++ b/addons/addon-fit/src/FitAddon.ts @@ -74,8 +74,8 @@ export class FitAddon implements ITerminalAddon, IFitApi { : (this._terminal.options.scrollbar?.width ?? ViewportConstants.DEFAULT_SCROLL_BAR_WIDTH)); const parentElementStyle = _getComputedStyle(this._terminal.element.parentElement); - const parentElementHeight = parseInt(parentElementStyle.getPropertyValue('height')); - const parentElementWidth = Math.max(0, parseInt(parentElementStyle.getPropertyValue('width'))); + const parentElementHeight = Math.max(0, parseInt(parentElementStyle.getPropertyValue('height'), 10) || 0); + const parentElementWidth = Math.max(0, parseInt(parentElementStyle.getPropertyValue('width'), 10) || 0); const elementStyle = _getComputedStyle(this._terminal.element); const elementPadding = { top: parseInt(elementStyle.getPropertyValue('padding-top')), From a2cd1ab29c6a72c25bb953c687f773280c2157ff Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Sun, 31 May 2026 22:46:40 -0700 Subject: [PATCH 07/10] fix(fit): parse terminal padding with radix 10 and zero fallback proposeDimensions summed padding-top/bottom/left/right via bare parseInt, so non-numeric padding values produced NaN and broke available width/height. Use radix 10 and || 0 on each side, consistent with parent element size parsing. Co-authored-by: Cursor --- addons/addon-fit/src/FitAddon.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/addon-fit/src/FitAddon.ts b/addons/addon-fit/src/FitAddon.ts index fab52dfde..75bbe9caa 100644 --- a/addons/addon-fit/src/FitAddon.ts +++ b/addons/addon-fit/src/FitAddon.ts @@ -78,10 +78,10 @@ export class FitAddon implements ITerminalAddon, IFitApi { const parentElementWidth = Math.max(0, parseInt(parentElementStyle.getPropertyValue('width'), 10) || 0); const elementStyle = _getComputedStyle(this._terminal.element); const elementPadding = { - top: parseInt(elementStyle.getPropertyValue('padding-top')), - bottom: parseInt(elementStyle.getPropertyValue('padding-bottom')), - right: parseInt(elementStyle.getPropertyValue('padding-right')), - left: parseInt(elementStyle.getPropertyValue('padding-left')) + top: parseInt(elementStyle.getPropertyValue('padding-top'), 10) || 0, + bottom: parseInt(elementStyle.getPropertyValue('padding-bottom'), 10) || 0, + right: parseInt(elementStyle.getPropertyValue('padding-right'), 10) || 0, + left: parseInt(elementStyle.getPropertyValue('padding-left'), 10) || 0 }; const elementPaddingVer = elementPadding.top + elementPadding.bottom; const elementPaddingHor = elementPadding.right + elementPadding.left; From f34d0a255c8944543e345ab8b9b9a9b0eed5855c Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Sun, 31 May 2026 22:50:32 -0700 Subject: [PATCH 08/10] fix(image): pass radix 10 in IIPHandler dimension parsing _dim() parsed percent, pixel, and cell dimension strings with parseInt without an explicit radix. Use base 10 for all three paths, consistent with other numeric parsing fixes in the repo. Co-authored-by: Cursor --- addons/addon-image/src/IIPHandler.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/addon-image/src/IIPHandler.ts b/addons/addon-image/src/IIPHandler.ts index 5e15c5277..56f5cdf35 100644 --- a/addons/addon-image/src/IIPHandler.ts +++ b/addons/addon-image/src/IIPHandler.ts @@ -222,8 +222,8 @@ export class IIPHandler implements IOscHandler, IResetHandler { private _dim(s: string, total: number, cdim: number): number { if (s === 'auto') return 0; - if (s.endsWith('%')) return parseInt(s.slice(0, -1)) * total / 100; - if (s.endsWith('px')) return parseInt(s.slice(0, -2)); - return parseInt(s) * cdim; + if (s.endsWith('%')) return parseInt(s.slice(0, -1), 10) * total / 100; + if (s.endsWith('px')) return parseInt(s.slice(0, -2), 10); + return parseInt(s, 10) * cdim; } } From a1a8d1abae74aa11988ec48385d88a3aa3eccdc1 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Sun, 31 May 2026 22:57:02 -0700 Subject: [PATCH 09/10] fix(image): pass radix 10 when parsing kitty graphics numeric keys KittyGraphicsTypes parsed numeric control values with parseInt without a radix. Use base 10 explicitly for format, id, dimensions, and offset fields. Co-authored-by: Cursor --- addons/addon-image/src/kitty/KittyGraphicsTypes.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/addon-image/src/kitty/KittyGraphicsTypes.ts b/addons/addon-image/src/kitty/KittyGraphicsTypes.ts index 448ebcc05..4288dd0a4 100644 --- a/addons/addon-image/src/kitty/KittyGraphicsTypes.ts +++ b/addons/addon-image/src/kitty/KittyGraphicsTypes.ts @@ -168,7 +168,7 @@ export function parseKittyCommand(data: string): IKittyCommand { cmd.deleteSelector = value; continue; } - const numValue = parseInt(value); + const numValue = parseInt(value, 10); switch (key) { case KittyKey.FORMAT: cmd.format = numValue; break; case KittyKey.ID: cmd.id = numValue; break; From d407bf561f5edde2955955a6067523b62043bea3 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Sun, 31 May 2026 23:00:26 -0700 Subject: [PATCH 10/10] fix(webgl): pass radix 10 for SVG arc flag parsing CustomGlyphRasterizer parsed large-arc and sweep flags with parseInt without a radix when drawing SVG arc paths. Use base 10 for 0/1 flags. Co-authored-by: Cursor --- addons/addon-webgl/src/customGlyphs/CustomGlyphRasterizer.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/addon-webgl/src/customGlyphs/CustomGlyphRasterizer.ts b/addons/addon-webgl/src/customGlyphs/CustomGlyphRasterizer.ts index 357d512d2..137cca7e3 100644 --- a/addons/addon-webgl/src/customGlyphs/CustomGlyphRasterizer.ts +++ b/addons/addon-webgl/src/customGlyphs/CustomGlyphRasterizer.ts @@ -221,8 +221,8 @@ function drawPathDefinitionCharacter( const rx = parseFloat(args[0]) * deviceCellWidth; const ry = parseFloat(args[1]) * deviceCellHeight; const xAxisRotation = parseFloat(args[2]) * Math.PI / 180; - const largeArcFlag = parseInt(args[3]); - const sweepFlag = parseInt(args[4]); + const largeArcFlag = parseInt(args[3], 10); + const sweepFlag = parseInt(args[4], 10); const x = xOffset + parseFloat(args[5]) * deviceCellWidth; const y = yOffset + parseFloat(args[6]) * deviceCellHeight; drawSvgArc(ctx, currentX, currentY, rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y);