mirror of
https://github.com/stablyai/orca.git
synced 2026-10-17 00:03:08 +00:00
* Migrate terminal scrollback setting from bytes to rows Transition terminal scrollback configuration from a byte-based (MB) limit to a row-based count to align with standard terminal emulator behavior. - Introduce a shared scrollback policy to handle normalization and safe migration of legacy byte presets to row equivalents. - Update persistence logic to automatically convert and clean up legacy settings on startup and write-back. - Refactor the advanced settings interface and localization strings to let users configure scrollback in terms of rows (up to 50k). - Live-apply row limit changes directly to mounted xterm instances without recreating panes or restarting PTY sessions. * Migrate terminal scrollback setting from bytes to rows Transition terminal scrollback configuration from a byte-based (MB) limit to a row-based count to align with standard terminal emulator behavior. - Introduce a shared scrollback policy to handle normalization and safe migration of legacy byte presets to row equivalents. - Update persistence logic to automatically convert and clean up legacy settings on startup and write-back. - Refactor the advanced settings interface and localization strings to let users configure scrollback in terms of rows (up to 50k). - Live-apply row limit changes directly to mounted xterm instances without recreating panes or restarting PTY sessions. * defer updating terminal scrollback rows until blur or Enter Avoid committing terminal scrollback row setting changes on every keystroke, which can trigger rapid updates with incomplete or invalid numbers. Instead, manage a local draft state and commit to settings only when the input is blurred or the user presses Enter.
49 lines
2.4 KiB
TypeScript
49 lines
2.4 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import {
|
|
DESKTOP_TERMINAL_SCROLLBACK_ROW_PRESETS,
|
|
DESKTOP_TERMINAL_SCROLLBACK_ROWS_DEFAULT,
|
|
DESKTOP_TERMINAL_SCROLLBACK_ROWS_MAX,
|
|
DESKTOP_TERMINAL_SCROLLBACK_ROWS_MIN,
|
|
legacyTerminalScrollbackBytesToRows,
|
|
normalizeDesktopTerminalScrollbackRows,
|
|
normalizeDesktopTerminalSnapshotRows
|
|
} from './terminal-scrollback-policy'
|
|
|
|
describe('terminal scrollback policy', () => {
|
|
it('exports the desktop row defaults and presets', () => {
|
|
expect(DESKTOP_TERMINAL_SCROLLBACK_ROWS_DEFAULT).toBe(5_000)
|
|
expect(DESKTOP_TERMINAL_SCROLLBACK_ROWS_MIN).toBe(1_000)
|
|
expect(DESKTOP_TERMINAL_SCROLLBACK_ROWS_MAX).toBe(50_000)
|
|
expect(DESKTOP_TERMINAL_SCROLLBACK_ROW_PRESETS).toEqual([5_000, 10_000, 25_000, 50_000])
|
|
})
|
|
|
|
it('normalizes persisted desktop rows without string coercion', () => {
|
|
expect(normalizeDesktopTerminalScrollbackRows(undefined)).toBe(5_000)
|
|
expect(normalizeDesktopTerminalScrollbackRows('25000')).toBe(5_000)
|
|
expect(normalizeDesktopTerminalScrollbackRows(Number.NaN)).toBe(5_000)
|
|
expect(normalizeDesktopTerminalScrollbackRows(500.9)).toBe(1_000)
|
|
expect(normalizeDesktopTerminalScrollbackRows(25_000.9)).toBe(25_000)
|
|
expect(normalizeDesktopTerminalScrollbackRows(100_000)).toBe(50_000)
|
|
})
|
|
|
|
it('normalizes snapshot rows while preserving visible-screen-only zero', () => {
|
|
expect(normalizeDesktopTerminalSnapshotRows(undefined)).toBeUndefined()
|
|
expect(normalizeDesktopTerminalSnapshotRows('0')).toBeUndefined()
|
|
expect(normalizeDesktopTerminalSnapshotRows(0)).toBe(0)
|
|
expect(normalizeDesktopTerminalSnapshotRows(-1)).toBe(0)
|
|
expect(normalizeDesktopTerminalSnapshotRows(25_000.9)).toBe(25_000)
|
|
expect(normalizeDesktopTerminalSnapshotRows(100_000)).toBe(50_000)
|
|
})
|
|
|
|
it('migrates legacy decimal MB buckets by intent, not byte-to-row math', () => {
|
|
expect(legacyTerminalScrollbackBytesToRows(undefined)).toBe(5_000)
|
|
expect(legacyTerminalScrollbackBytesToRows(0)).toBe(5_000)
|
|
expect(legacyTerminalScrollbackBytesToRows(1_000_000)).toBe(1_000)
|
|
expect(legacyTerminalScrollbackBytesToRows(10_000_000)).toBe(5_000)
|
|
expect(legacyTerminalScrollbackBytesToRows(25_000_000)).toBe(10_000)
|
|
expect(legacyTerminalScrollbackBytesToRows(50_000_000)).toBe(25_000)
|
|
expect(legacyTerminalScrollbackBytesToRows(100_000_000)).toBe(50_000)
|
|
expect(legacyTerminalScrollbackBytesToRows(250_000_000)).toBe(50_000)
|
|
})
|
|
})
|