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 <cursoragent@cursor.com>
This commit is contained in:
Daniel Imms
2026-06-01 15:05:43 +00:00
committed by Cursor Agent
co-authored by Cursor
parent ddf2b7d091
commit d4acf2fa45
+3 -3
View File
@@ -6,8 +6,8 @@
export function getCoordsRelativeToElement(window: Pick<Window, 'getComputedStyle'>, event: {clientX: number, clientY: number}, element: HTMLElement): [number, number] { export function getCoordsRelativeToElement(window: Pick<Window, 'getComputedStyle'>, event: {clientX: number, clientY: number}, element: HTMLElement): [number, number] {
const rect = element.getBoundingClientRect(); const rect = element.getBoundingClientRect();
const elementStyle = window.getComputedStyle(element); const elementStyle = window.getComputedStyle(element);
const leftPadding = parseInt(elementStyle.getPropertyValue('padding-left')); const leftPadding = parseInt(elementStyle.getPropertyValue('padding-left'), 10);
const topPadding = parseInt(elementStyle.getPropertyValue('padding-top')); const topPadding = parseInt(elementStyle.getPropertyValue('padding-top'), 10);
return [ return [
event.clientX - rect.left - leftPadding, event.clientX - rect.left - leftPadding,
event.clientY - rect.top - topPadding event.clientY - rect.top - topPadding
@@ -22,7 +22,7 @@ export function getCoordsRelativeToElement(window: Pick<Window, 'getComputedStyl
* @param event The mouse event. * @param event The mouse event.
* @param element The terminal's container element. * @param element The terminal's container element.
* @param colCount The number of columns in the terminal. * @param colCount The number of columns in the terminal.
* @param rowCount The number of rows n the terminal. * @param rowCount The number of rows in the terminal.
* @param hasValidCharSize Whether there is a valid character size available. * @param hasValidCharSize Whether there is a valid character size available.
* @param cssCellWidth The cell width device pixel render dimensions. * @param cssCellWidth The cell width device pixel render dimensions.
* @param cssCellHeight The cell height device pixel render dimensions. * @param cssCellHeight The cell height device pixel render dimensions.