File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package tui
2+
3+ import (
4+ "fmt"
5+
6+ "github.com/charmbracelet/lipgloss"
7+ )
8+
9+ // columnWidths returns [modulesW, elementsW, previewW] given total terminal width.
10+ func columnWidths (totalW int ) (int , int , int ) {
11+ // Reserve 2 chars per border (left+right) × 3 columns = 6
12+ available := totalW - 6
13+ if available < 30 {
14+ available = 30
15+ }
16+ modulesW := available * 20 / 100
17+ elementsW := available * 30 / 100
18+ previewW := available - modulesW - elementsW
19+ return modulesW , elementsW , previewW
20+ }
21+
22+ // renderLayout assembles the three panels + status bar into the full screen.
23+ func renderLayout (
24+ totalW int ,
25+ modulesView , elementsView , previewView string ,
26+ statusLine string ,
27+ ) string {
28+ status := lipgloss .NewStyle ().
29+ Background (lipgloss .Color ("236" )).
30+ Foreground (lipgloss .Color ("252" )).
31+ Width (totalW ).
32+ Render (statusLine )
33+
34+ cols := lipgloss .JoinHorizontal (lipgloss .Top , modulesView , elementsView , previewView )
35+
36+ return fmt .Sprintf ("%s\n %s" , cols , status )
37+ }
You can’t perform that action at this time.
0 commit comments