Stabilize OpenCode terminal rendering before release (#4850)
This commit is contained in:
@@ -22,6 +22,11 @@ describe('getDefaultSettings', () => {
|
||||
expect(getDefaultSettings('/tmp').autoRenameBranchFromWorkDefaultedOn).toBe(true)
|
||||
})
|
||||
|
||||
it('uses a block terminal cursor by default for new settings', () => {
|
||||
expect(getDefaultSettings('/tmp').terminalCursorStyle).toBe('block')
|
||||
expect(getDefaultSettings('/tmp').terminalCursorStyleDefaultedToBlock).toBe(true)
|
||||
})
|
||||
|
||||
it('enables separate light terminal theme by default', () => {
|
||||
expect(getDefaultSettings('/tmp').terminalUseSeparateLightTheme).toBe(true)
|
||||
})
|
||||
|
||||
@@ -200,7 +200,8 @@ export function getDefaultSettings(homedir: string): GlobalSettings {
|
||||
// that lacks ligatures or if they've explicitly opted out. The resolver
|
||||
// is in shared/terminal-ligatures.ts.
|
||||
terminalLigatures: 'auto',
|
||||
terminalCursorStyle: 'bar',
|
||||
terminalCursorStyle: 'block',
|
||||
terminalCursorStyleDefaultedToBlock: true,
|
||||
terminalCursorBlink: true,
|
||||
terminalThemeDark: 'Ghostty Default Style Dark',
|
||||
terminalDividerColorDark: '#3f3f46',
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
import type { GlobalSettings } from './types'
|
||||
|
||||
type TerminalCursorStyleSettings = Pick<
|
||||
GlobalSettings,
|
||||
'terminalCursorStyle' | 'terminalCursorStyleDefaultedToBlock'
|
||||
>
|
||||
|
||||
export function normalizeTerminalCursorStyleDefault(
|
||||
settings: Partial<TerminalCursorStyleSettings> | undefined,
|
||||
options: { preserveExplicitValue?: boolean } = {}
|
||||
): TerminalCursorStyleSettings {
|
||||
const defaultedToBlock =
|
||||
settings?.terminalCursorStyleDefaultedToBlock === true || options.preserveExplicitValue === true
|
||||
|
||||
return {
|
||||
// Why: prior builds persisted the old bar default into profiles; migrate
|
||||
// those inherited values once while preserving later explicit choices.
|
||||
terminalCursorStyle: defaultedToBlock ? (settings?.terminalCursorStyle ?? 'block') : 'block',
|
||||
terminalCursorStyleDefaultedToBlock: true
|
||||
}
|
||||
}
|
||||
@@ -2008,6 +2008,8 @@ export type GlobalSettings = {
|
||||
* switches fonts, so "off" always stays off. */
|
||||
terminalLigatures: 'auto' | 'on' | 'off'
|
||||
terminalCursorStyle: 'bar' | 'block' | 'underline'
|
||||
/** One-shot migration guard for moving inherited cursor defaults to block. */
|
||||
terminalCursorStyleDefaultedToBlock?: boolean
|
||||
terminalCursorBlink: boolean
|
||||
terminalThemeDark: string
|
||||
terminalDividerColorDark: string
|
||||
|
||||
Reference in New Issue
Block a user