Extract line number gutter width calculation and improve text selection

This commit is contained in:
Mohamed Boudra
2026-03-21 23:15:52 +07:00
parent ad1cb4c200
commit c80c3e0256
3 changed files with 16 additions and 4 deletions
@@ -1,3 +1,12 @@
/**
* Compute the pixel width for a line-number gutter based on the highest
* line number that will be displayed. Minimum width accommodates 2 digits.
*/
export function lineNumberGutterWidth(maxLineNumber: number): number {
const digits = Math.max(2, String(maxLineNumber).length);
return digits * 8 + 12;
}
export function getCodeInsets(theme: any) {
const padding =
typeof theme.spacing?.[3] === "number"