mirror of
https://github.com/stablyai/orca.git
synced 2026-10-26 08:02:44 +00:00
* feat(ghostty): import adjust-cell-height and dual-value window paddings Two Ghostty config forms previously landed in unsupportedKeys: - adjust-cell-height percentages (e.g. "35%") now map to terminalLineHeight (1.35), the direct xterm equivalent. Pixel values are still rejected because they depend on the rendered cell height. - window-padding-x/y "top,bottom" / "left,right" pairs now import as the rounded average, preserving the total padding along the axis. parseStrictInt moves to numeric-config-values.ts alongside the new pair parser to keep mapper.ts under the max-lines budget. * fix(ghostty): tighten import edge cases Co-authored-by: Orca <help@stably.ai> * fix(settings): sentence-case account runtime copy Co-authored-by: Orca <help@stably.ai> --------- Co-authored-by: Jinwoo-H <jinwoo0825@gmail.com> Co-authored-by: Orca <help@stably.ai>
31 lines
1.0 KiB
TypeScript
31 lines
1.0 KiB
TypeScript
// Why: `Number("1e10")` succeeds and passes `Number.isInteger`, so a Ghostty
|
|
// config with `window-padding-x = 1e9` would sail through the mapper and land
|
|
// an absurd value in the store. Restrict to plain decimal integers.
|
|
const STRICT_INT_RE = /^-?\d+$/
|
|
export const parseStrictInt = (v: string): number | null => {
|
|
if (!STRICT_INT_RE.test(v)) {
|
|
return null
|
|
}
|
|
const num = Number(v)
|
|
return Number.isFinite(num) ? num : null
|
|
}
|
|
|
|
// Why: Ghostty accepts "top,bottom" / "left,right" pairs for window paddings,
|
|
// but Orca stores a single value per axis — average the pair so the total
|
|
// padding along the axis stays the same.
|
|
export const parsePaddingValue = (v: string): number | null => {
|
|
const parts = v.split(',')
|
|
if (parts.length > 2) {
|
|
return null
|
|
}
|
|
const nums: number[] = []
|
|
for (const part of parts) {
|
|
const num = parseStrictInt(part.trim())
|
|
if (num === null || num < 0 || num > 512) {
|
|
return null
|
|
}
|
|
nums.push(num)
|
|
}
|
|
return nums.reduce((sum, num) => sum + num, 0) / nums.length
|
|
}
|