Skip to content

Commit 162623d

Browse files
committed
feat(tui): add content_padding option to control horizontal content margins
Add a new content_padding option to tui.json that lets users configure the horizontal padding of the main content area. This replaces the hardcoded paddingLeft/paddingRight=2 on the session container and the corresponding contentWidth calculation. Users can set this in tui.json: { "content_padding": 0 } The value is an integer from 0-20 (default: 2, preserving current behavior). Closes anomalyco#25142
1 parent 63f3e84 commit 162623d

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

‎packages/opencode/src/cli/cmd/tui/config/tui-schema.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ const KeymapLeaderTimeout = Schema.Int.check(Schema.isGreaterThan(0)).annotate({
3333
description: "Leader key timeout in milliseconds",
3434
})
3535

36+
export const ContentPadding = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0), Schema.isLessThanOrEqualTo(20)).annotate({
37+
description: "Horizontal padding (in columns) for the main content area (default: 2)",
38+
})
39+
3640
const TuiAttentionSounds = Schema.Struct({
3741
default: Schema.optional(Schema.String),
3842
question: Schema.optional(Schema.String),
@@ -75,4 +79,5 @@ export const TuiInfo = Schema.Struct({
7579
scroll_acceleration: Schema.optional(ScrollAcceleration),
7680
diff_style: Schema.optional(DiffStyle),
7781
mouse: Schema.optional(Schema.Boolean).annotate({ description: "Enable or disable mouse capture (default: true)" }),
82+
content_padding: Schema.optional(ContentPadding),
7883
})

‎packages/opencode/src/cli/cmd/tui/routes/session/index.tsx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,8 @@ export function Session() {
234234
return false
235235
})
236236
const showTimestamps = createMemo(() => timestamps() === "show")
237-
const contentWidth = createMemo(() => dimensions().width - (sidebarVisible() ? 42 : 0) - 4)
237+
const contentPadding = tuiConfig.content_padding ?? 2
238+
const contentWidth = createMemo(() => dimensions().width - (sidebarVisible() ? 42 : 0) - contentPadding * 2)
238239
const providers = createMemo(() => Model.index(sync.data.provider))
239240

240241
const scrollAcceleration = createMemo(() => getScrollAcceleration(tuiConfig))
@@ -1105,7 +1106,7 @@ export function Session() {
11051106
}}
11061107
>
11071108
<box flexDirection="row" flexGrow={1} minHeight={0}>
1108-
<box flexGrow={1} minHeight={0} paddingBottom={1} paddingLeft={2} paddingRight={2} gap={1}>
1109+
<box flexGrow={1} minHeight={0} paddingBottom={1} paddingLeft={contentPadding} paddingRight={contentPadding} gap={1}>
11091110
<Show when={session()}>
11101111
<scrollbox
11111112
ref={(r) => (scroll = r)}

0 commit comments

Comments
 (0)