Skip to content

feat(tui): add section spacing setting to /custom layout dialog#3533

Merged
Sayt-0 merged 1 commit into
mainfrom
feat/tui-custom-section-spacing
Jul 8, 2026
Merged

feat(tui): add section spacing setting to /custom layout dialog#3533
Sayt-0 merged 1 commit into
mainfrom
feat/tui-custom-section-spacing

Conversation

@Sayt-0

@Sayt-0 Sayt-0 commented Jul 8, 2026

Copy link
Copy Markdown
Member

Summary

The /custom layout dialog gains a Section spacing selector controlling the vertical gap between the sidebar sections (blocks). The gap was previously hardcoded in the tab component (2 blank lines).

Value Blank lines between sections
Compact 1
Normal (default) 2 (identical to the previous rendering)
Relaxed 3
│  › Sidebar position                   ‹ Right ›  │
│    Section spacing                   ‹ Normal ›  │
│                                                  │
│  Sidebar sections                                │
│    [x] Token usage                               │
│    [x] Agents                                    │
│    [x] Tools                                     │
│    [x] Todos                                     │

Behavior

  • Cycles with left/right arrows and previews live behind the dialog, exactly like the position selector; Enter persists, Esc restores
  • Persisted as settings.layout.section_spacing in ~/.config/cagent/config.yaml; omitted when normal, and the whole layout entry is cleared when every setting is at its default
  • Empty or unknown persisted values fall back to normal, so existing configs can never break the layout
  • Spacing has no effect in the collapsed band (top/bottom) mode, which has no inter-block blank lines

Implementation

Piece Change
pkg/tui/messages/layout.go New SectionSpacing type with ParseSectionSpacing and BlankLines(), mirroring the SidebarPosition pattern
pkg/tui/components/tab/tab.go Sections now render flush: the trailing gap is no longer baked into the tab render
pkg/tui/components/sidebar/sidebar.go SetSectionGap on the model; renderSections inserts the configured blank lines between sections. appendSection returns the section start index so agent click zones stay anchored for any gap
pkg/tui/dialog/customize.go New selector row; cyclePosition/renderPositionRow generalized to cycleValue/renderSelectorRow, shared by both selectors
pkg/tui/handlers.go Normalization on apply/load, persistence with default omission
pkg/userconfig/userconfig.go New section_spacing field (omitempty)
docs/features/tui/index.md Documents the new setting and the config key

The tab header structure (title line + one padding line) is intentionally unchanged: it is load-bearing for click-zone offsets (tabHeaderLines, verticalStarY).

Testing

  • New tests: dialog spacing cycling and live preview, rendered gap at 1/2/3 blank lines, agent click zones with a non-default gap, ParseSectionSpacing/BlankLines mapping, user config round trip and default omission
  • go build ./..., golangci-lint run (0 issues), full pkg/tui/... and pkg/userconfig suites pass

The /custom dialog gains a Section spacing selector (Compact, Normal,
Relaxed) controlling the number of blank lines rendered between sidebar
sections (1, 2, or 3). The gap was previously hardcoded in the tab
component; it is now owned by the sidebar's renderSections, and the
setting is persisted as settings.layout.section_spacing in the user
config, omitted when set to the default.
@Sayt-0
Sayt-0 requested a review from a team as a code owner July 8, 2026 11:59
@aheritier aheritier added area/docs Documentation changes area/tui For features/issues/fixes related to the TUI kind/feat PR adds a new feature (maps to feat:). Use on PRs only. labels Jul 8, 2026
@Sayt-0
Sayt-0 merged commit 9331dd9 into main Jul 8, 2026
18 checks passed
@Sayt-0
Sayt-0 deleted the feat/tui-custom-section-spacing branch July 8, 2026 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/docs Documentation changes area/tui For features/issues/fixes related to the TUI kind/feat PR adds a new feature (maps to feat:). Use on PRs only.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants