xonecas.io
62159
Sy

symb / commit 1637dbe

feat: Simple text editting area

xonecas2026-02-11 1637dbe3f9c82626770eae54b8d67246c664efe8 parent 68aa040

10 files changed

AGENTS.md+3−1
@@ -12,4 +12,6 @@
1212 ## Project info
1313
1414 - Always use `docs/TUI_TESTING.md` when working on the TUI. Use golden tests.
15-- Always use ELM architecture.
15+- Always use [ELM](https://guide.elm-lang.org/architecture/) architecture.
16+- Go & Golintci
17+- Bubbletea, Bubbles and Lipgloss.
docs/DESIGN.md+3−3
@@ -18,7 +18,7 @@ A TUI from the future. We want feature parity with a GUI editor: mouse selection
1818 - Line numbers, syntax highlighting
1919 - LSP support
2020 - Git integration (show file git status)
21- - Simple editting support, no advanced usages or keybinds.
21+ - Simple editting support, no advanced usages or keybinds.
2222 - Code browsing mouse features: click to go to definition/references. Search for word under cursor.
2323
2424 - LLM Tools:
@@ -26,7 +26,7 @@ A TUI from the future. We want feature parity with a GUI editor: mouse selection
2626 - Grep, Read, Write: optimized for code changes (LSP and linting checks after each edit). These appear in agentic UI as a diff message (not actual diff). Clicking on it takes us to that edit in the editor tab.
2727 - Undo: Either perform an intelligent step back or use git to reset.
2828 - Subagent tool: Performs a single task based on prompt.
29- - Mutation tools create a new branch worktress for the sandboxed environment. Perform the mutation. Once the user approves the mutation or tells the agent to merge, a git merge happens.
29+ - Mutation tools create a new branch worktress for the sandboxed environment. Perform the mutation. Once the user approves the mutation or tells the agent to merge, a git merge happens.
3030
3131 - Features:
3232 - `<CTRL> + <f>`: Search files by filename or content (fuzzy matches, fast)
@@ -63,7 +63,7 @@ A TUI from the future. We want feature parity with a GUI editor: mouse selection
6363 │ 115 │ │ /bash cargo check │ │ // Input box, user can cycle history with arrows *up/down*
6464 │ 116 │ └────────────────────────────────┘ │ // - Input supports commands /Read /Grep /Write (call the same tools as the LLM sees)
6565 ├─────────────────────────────────────┴────────────────────────────────────┤
66-│ master* │ src/matrix/core.rs[+] ⣽ │ // Git branch, current file if any ending with an
66+│ master* │ src/matrix/core.rs[+] ⣽ │ // Git branch, current file if any. ending with an
6767 ╰──────────────────────────────────────────────────────────────────────────╯ // animated icon: fast animation when LLM is thinking, slow when idle.
6868 ```
6969
go.mod+8−4
@@ -3,15 +3,19 @@ module github.com/xonecas/smith
33 go 1.25.6
44
55 require (
6+ github.com/charmbracelet/bubbles v1.0.0
7+ github.com/charmbracelet/bubbletea v1.3.10
8+ github.com/charmbracelet/lipgloss v1.1.0
9+ github.com/charmbracelet/x/exp/golden v0.0.0-20260209194814-eeb2896ac759
10+)
11+
12+require (
13+ github.com/atotto/clipboard v0.1.4 // indirect
614 github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
715 github.com/aymanbagabas/go-udiff v0.3.1 // indirect
8- github.com/charmbracelet/bubbles v1.0.0 // indirect
9- github.com/charmbracelet/bubbletea v1.3.10 // indirect
1016 github.com/charmbracelet/colorprofile v0.4.1 // indirect
11- github.com/charmbracelet/lipgloss v1.1.0 // indirect
1217 github.com/charmbracelet/x/ansi v0.11.6 // indirect
1318 github.com/charmbracelet/x/cellbuf v0.0.15 // indirect
14- github.com/charmbracelet/x/exp/golden v0.0.0-20260209194814-eeb2896ac759 // indirect
1519 github.com/charmbracelet/x/term v0.2.2 // indirect
1620 github.com/clipperhouse/displaywidth v0.9.0 // indirect
1721 github.com/clipperhouse/stringish v0.1.1 // indirect
go.sum+6−15
@@ -1,3 +1,7 @@
1+github.com/MakeNowJust/heredoc v1.0.0 h1:cXCdzVdstXyiTqTvfqk9SDHpKNjxuom+DOlyEeQ4pzQ=
2+github.com/MakeNowJust/heredoc v1.0.0/go.mod h1:mG5amYoWBHf8vpLOuehzbGGw0EHxpZZ6lCpQ4fNJ8LE=
3+github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4=
4+github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI=
15 github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=
26 github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=
37 github.com/aymanbagabas/go-udiff v0.3.1 h1:LV+qyBQ2pqe0u42ZsUEtPiCaUoqgA9gYRDs3vj1nolY=
@@ -6,24 +10,16 @@ github.com/charmbracelet/bubbles v1.0.0 h1:12J8/ak/uCZEMQ6KU7pcfwceyjLlWsDLAxB5f
610 github.com/charmbracelet/bubbles v1.0.0/go.mod h1:9d/Zd5GdnauMI5ivUIVisuEm3ave1XwXtD1ckyV6r3E=
711 github.com/charmbracelet/bubbletea v1.3.10 h1:otUDHWMMzQSB0Pkc87rm691KZ3SWa4KUlvF9nRvCICw=
812 github.com/charmbracelet/bubbletea v1.3.10/go.mod h1:ORQfo0fk8U+po9VaNvnV95UPWA1BitP1E0N6xJPlHr4=
9-github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc h1:4pZI35227imm7yK2bGPcfpFEmuY1gc2YSTShr4iJBfs=
10-github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc/go.mod h1:X4/0JoqgTIPSFcRA/P6INZzIuyqdFY5rm8tb41s9okk=
1113 github.com/charmbracelet/colorprofile v0.4.1 h1:a1lO03qTrSIRaK8c3JRxJDZOvhvIeSco3ej+ngLk1kk=
1214 github.com/charmbracelet/colorprofile v0.4.1/go.mod h1:U1d9Dljmdf9DLegaJ0nGZNJvoXAhayhmidOdcBwAvKk=
1315 github.com/charmbracelet/lipgloss v1.1.0 h1:vYXsiLHVkK7fp74RkV7b2kq9+zDLoEU4MZoFqR/noCY=
1416 github.com/charmbracelet/lipgloss v1.1.0/go.mod h1:/6Q8FR2o+kj8rz4Dq0zQc3vYf7X+B0binUUBwA0aL30=
15-github.com/charmbracelet/x/ansi v0.10.1 h1:rL3Koar5XvX0pHGfovN03f5cxLbCF2YvLeyz7D2jVDQ=
16-github.com/charmbracelet/x/ansi v0.10.1/go.mod h1:3RQDQ6lDnROptfpWuUVIUG64bD2g2BgntdxH0Ya5TeE=
1717 github.com/charmbracelet/x/ansi v0.11.6 h1:GhV21SiDz/45W9AnV2R61xZMRri5NlLnl6CVF7ihZW8=
1818 github.com/charmbracelet/x/ansi v0.11.6/go.mod h1:2JNYLgQUsyqaiLovhU2Rv/pb8r6ydXKS3NIttu3VGZQ=
19-github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd h1:vy0GVL4jeHEwG5YOXDmi86oYw2yuYUGqz6a8sLwg0X8=
20-github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd/go.mod h1:xe0nKWGd3eJgtqZRaN9RjMtK7xUYchjzPr7q6kcvCCs=
2119 github.com/charmbracelet/x/cellbuf v0.0.15 h1:ur3pZy0o6z/R7EylET877CBxaiE1Sp1GMxoFPAIztPI=
2220 github.com/charmbracelet/x/cellbuf v0.0.15/go.mod h1:J1YVbR7MUuEGIFPCaaZ96KDl5NoS0DAWkskup+mOY+Q=
2321 github.com/charmbracelet/x/exp/golden v0.0.0-20260209194814-eeb2896ac759 h1:wQKrpioYyZbkqq2V5o9x7D2dDnqZeTgFshM7G2/vmu0=
2422 github.com/charmbracelet/x/exp/golden v0.0.0-20260209194814-eeb2896ac759/go.mod h1:V8n/g3qVKNxr2FR37Y+otCsMySvZr601T0C7coEP0bw=
25-github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ=
26-github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg=
2723 github.com/charmbracelet/x/term v0.2.2 h1:xVRT/S2ZcKdhhOuSP4t5cLi5o+JxklsoEObBSgfgZRk=
2824 github.com/charmbracelet/x/term v0.2.2/go.mod h1:kF8CY5RddLWrsgVwpw4kAa6TESp6EB5y3uxGLeCqzAI=
2925 github.com/clipperhouse/displaywidth v0.9.0 h1:Qb4KOhYwRiN3viMv1v/3cTBlz3AcAZX3+y9OLhMtAtA=
@@ -34,16 +30,12 @@ github.com/clipperhouse/uax29/v2 v2.5.0 h1:x7T0T4eTHDONxFJsL94uKNKPHrclyFI0lm7+w
3430 github.com/clipperhouse/uax29/v2 v2.5.0/go.mod h1:Wn1g7MK6OoeDT0vL+Q0SQLDz/KpfsVRgg6W7ihQeh4g=
3531 github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f h1:Y/CXytFA4m6baUTXGLOoWe4PQhGxaX0KpnayAqC48p4=
3632 github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f/go.mod h1:vw97MGsxSvLiUE2X8qFplwetxpGLQrlU1Q9AUEIzCaM=
37-github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
38-github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
3933 github.com/lucasb-eyer/go-colorful v1.3.0 h1:2/yBRLdWBZKrf7gB40FoiKfAWYQ0lqNcbuQwVHXptag=
4034 github.com/lucasb-eyer/go-colorful v1.3.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
4135 github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
4236 github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
4337 github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4=
4438 github.com/mattn/go-localereader v0.0.1/go.mod h1:8fBrzywKY7BI3czFoHkuzRoWE9C+EiG4R1k4Cjx5p88=
45-github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
46-github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
4739 github.com/mattn/go-runewidth v0.0.19 h1:v++JhqYnZuu5jSKrk9RbgF5v4CGUjqRfBm05byFGLdw=
4840 github.com/mattn/go-runewidth v0.0.19/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs=
4941 github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 h1:ZK8zHtRHOkbHy6Mmr5D264iyp3TiX5OmNcI5cIARiQI=
@@ -52,15 +44,14 @@ github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELU
5244 github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo=
5345 github.com/muesli/termenv v0.16.0 h1:S5AlUN9dENB57rsbnkPyfdGuWIlkmzJjbFf0Tf5FWUc=
5446 github.com/muesli/termenv v0.16.0/go.mod h1:ZRfOIKPFDYQoDFF4Olj7/QJbW60Ol/kL1pU3VfY/Cnk=
55-github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
5647 github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
5748 github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
5849 github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no=
5950 github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM=
51+golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI=
52+golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo=
6053 golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
6154 golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
62-golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k=
63-golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
6455 golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc=
6556 golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
6657 golang.org/x/text v0.3.8 h1:nAL+RVCQ9uMn3vJZbV+MRnydTJFPf8qqY42YiA6MrqY=
internal/tui/styles.go+4−3
@@ -3,6 +3,7 @@ package tui
33 import "github.com/charmbracelet/lipgloss"
44
55 var (
6- ColorMatrix = lipgloss.Color("#00FF00")
7- ColorBorder = lipgloss.Color("#2a2a2a")
8-)
6+ ColorMatrix = lipgloss.Color("#00AA00") // Matrix green
7+ ColorDarkGray = lipgloss.Color("#2a2a2a") // Dark gray
8+ ColorBorder = ColorDarkGray
9+)
internal/tui/testdata/TestLayout/120x40/ANSI.golden+36−36
@@ -1,40 +1,40 @@
11 ╭───────────────────────────────────────────────────────────┬──────────────────────────────────────────────────────────╮
2-│ │ │
3-│ │ │
4-│ │ │
5-│ │ │
6-│ │ │
7-│ │ │
8-│ │ │
9-│ │ │
10-│ │ │
11-│ │ │
12-│ │ │
13-│ │ │
14-│ │ │
15-│ │ │
16-│ │ │
17-│ │ │
18-│ │ │
19-│ │ │
20-│ │ │
21-│ │ │
22-│ │ │
23-│ │ │
24-│ │ │
25-│ │ │
26-│ │ │
27-│ │ │
28-│ │ │
29-│ │ │
30-│ │ │
31-│ │ │
32-│ │ │
33-│ │ │
34-│ │ │
35-│ │ │
36-│ │ │
37-│ │ │
2+│┃ 1 Start editing... │ │
3+│┃ │ │
4+│┃ │ │
5+│┃ │ │
6+│┃ │ │
7+│┃ │ │
8+│┃ │ │
9+│┃ │ │
10+│┃ │ │
11+│┃ │ │
12+│┃ │ │
13+│┃ │ │
14+│┃ │ │
15+│┃ │ │
16+│┃ │ │
17+│┃ │ │
18+│┃ │ │
19+│┃ │ │
20+│┃ │ │
21+│┃ │ │
22+│┃ │ │
23+│┃ │ │
24+│┃ │ │
25+│┃ │ │
26+│┃ │ │
27+│┃ │ │
28+│┃ │ │
29+│┃ │ │
30+│┃ │ │
31+│┃ │ │
32+│┃ │ │
33+│┃ │ │
34+│┃ │ │
35+│┃ │ │
36+│┃ │ │
37+│┃ │ │
3838 ├───────────────────────────────────────────────────────────┴──────────────────────────────────────────────────────────┤
3939 │ master* │ ⣾ │
4040 ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
internal/tui/testdata/TestLayout/120x40/Stripped.golden+36−36
@@ -1,40 +1,40 @@
11 ╭───────────────────────────────────────────────────────────┬──────────────────────────────────────────────────────────╮
2-│ │ │
3-│ │ │
4-│ │ │
5-│ │ │
6-│ │ │
7-│ │ │
8-│ │ │
9-│ │ │
10-│ │ │
11-│ │ │
12-│ │ │
13-│ │ │
14-│ │ │
15-│ │ │
16-│ │ │
17-│ │ │
18-│ │ │
19-│ │ │
20-│ │ │
21-│ │ │
22-│ │ │
23-│ │ │
24-│ │ │
25-│ │ │
26-│ │ │
27-│ │ │
28-│ │ │
29-│ │ │
30-│ │ │
31-│ │ │
32-│ │ │
33-│ │ │
34-│ │ │
35-│ │ │
36-│ │ │
37-│ │ │
2+│┃ 1 Start editing... │ │
3+│┃ │ │
4+│┃ │ │
5+│┃ │ │
6+│┃ │ │
7+│┃ │ │
8+│┃ │ │
9+│┃ │ │
10+│┃ │ │
11+│┃ │ │
12+│┃ │ │
13+│┃ │ │
14+│┃ │ │
15+│┃ │ │
16+│┃ │ │
17+│┃ │ │
18+│┃ │ │
19+│┃ │ │
20+│┃ │ │
21+│┃ │ │
22+│┃ │ │
23+│┃ │ │
24+│┃ │ │
25+│┃ │ │
26+│┃ │ │
27+│┃ │ │
28+│┃ │ │
29+│┃ │ │
30+│┃ │ │
31+│┃ │ │
32+│┃ │ │
33+│┃ │ │
34+│┃ │ │
35+│┃ │ │
36+│┃ │ │
37+│┃ │ │
3838 ├───────────────────────────────────────────────────────────┴──────────────────────────────────────────────────────────┤
3939 │ master* │ ⣾ │
4040 ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
internal/tui/testdata/TestLayout/80x24/ANSI.golden+20−20
@@ -1,24 +1,24 @@
11 ╭───────────────────────────────────────┬──────────────────────────────────────╮
2-│ │ │
3-│ │ │
4-│ │ │
5-│ │ │
6-│ │ │
7-│ │ │
8-│ │ │
9-│ │ │
10-│ │ │
11-│ │ │
12-│ │ │
13-│ │ │
14-│ │ │
15-│ │ │
16-│ │ │
17-│ │ │
18-│ │ │
19-│ │ │
20-│ │ │
21-│ │ │
2+│┃ 1 Start editing... │ │
3+│┃ │ │
4+│┃ │ │
5+│┃ │ │
6+│┃ │ │
7+│┃ │ │
8+│┃ │ │
9+│┃ │ │
10+│┃ │ │
11+│┃ │ │
12+│┃ │ │
13+│┃ │ │
14+│┃ │ │
15+│┃ │ │
16+│┃ │ │
17+│┃ │ │
18+│┃ │ │
19+│┃ │ │
20+│┃ │ │
21+│┃ │ │
2222 ├───────────────────────────────────────┴──────────────────────────────────────┤
2323 │ master* │ ⣾ │
2424 ╰──────────────────────────────────────────────────────────────────────────────╯
internal/tui/testdata/TestLayout/80x24/Stripped.golden+20−20
@@ -1,24 +1,24 @@
11 ╭───────────────────────────────────────┬──────────────────────────────────────╮
2-│ │ │
3-│ │ │
4-│ │ │
5-│ │ │
6-│ │ │
7-│ │ │
8-│ │ │
9-│ │ │
10-│ │ │
11-│ │ │
12-│ │ │
13-│ │ │
14-│ │ │
15-│ │ │
16-│ │ │
17-│ │ │
18-│ │ │
19-│ │ │
20-│ │ │
21-│ │ │
2+│┃ 1 Start editing... │ │
3+│┃ │ │
4+│┃ │ │
5+│┃ │ │
6+│┃ │ │
7+│┃ │ │
8+│┃ │ │
9+│┃ │ │
10+│┃ │ │
11+│┃ │ │
12+│┃ │ │
13+│┃ │ │
14+│┃ │ │
15+│┃ │ │
16+│┃ │ │
17+│┃ │ │
18+│┃ │ │
19+│┃ │ │
20+│┃ │ │
21+│┃ │ │
2222 ├───────────────────────────────────────┴──────────────────────────────────────┤
2323 │ master* │ ⣾ │
2424 ╰──────────────────────────────────────────────────────────────────────────────╯
internal/tui/tui.go+60−9
@@ -4,15 +4,17 @@ import (
44 "strings"
55
66 "github.com/charmbracelet/bubbles/spinner"
7+ "github.com/charmbracelet/bubbles/textarea"
78 tea "github.com/charmbracelet/bubbletea"
89 "github.com/charmbracelet/lipgloss"
910 )
1011
1112 // Model is the application model
1213 type Model struct {
13- width int
14- height int
15- spinner spinner.Model
14+ width int
15+ height int
16+ spinner spinner.Model
17+ textarea textarea.Model
1618 }
1719
1820 // New creates a new TUI model
@@ -20,35 +22,63 @@ func New() Model {
2022 s := spinner.New()
2123 s.Spinner = spinner.Dot
2224 s.Style = lipgloss.NewStyle().Foreground(ColorMatrix) // Matrix green
25+
26+ ta := textarea.New()
27+ ta.ShowLineNumbers = true
28+ ta.Prompt = ""
29+ ta.FocusedStyle.CursorLine = lipgloss.NewStyle().Background(lipgloss.NoColor{})
30+ ta.FocusedStyle.LineNumber = lipgloss.NewStyle().Foreground(ColorBorder)
31+ ta.Cursor.Style = lipgloss.NewStyle().Foreground(ColorMatrix)
32+ ta.Focus()
33+
2334 return Model{
24- spinner: s,
35+ spinner: s,
36+ textarea: ta,
2537 }
2638 }
2739
2840 // Init initializes the TUI (required by BubbleTea)
2941 func (m Model) Init() tea.Cmd {
30- return m.spinner.Tick
42+ return tea.Batch(m.spinner.Tick, textarea.Blink)
3143 }
3244
3345 // Update handles messages and updates state (required by BubbleTea)
3446 func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
35- var cmd tea.Cmd
47+ var cmds []tea.Cmd
3648
3749 switch msg := msg.(type) {
3850 case tea.KeyMsg:
3951 switch msg.String() {
40- case "ctrl+c", "q":
52+ case "ctrl+c":
4153 return m, tea.Quit
54+ case "esc":
55+ if m.textarea.Focused() {
56+ m.textarea.Blur()
57+ }
58+ return m, nil
4259 }
4360
4461 case tea.WindowSizeMsg:
4562 m.width = msg.Width
4663 m.height = msg.Height
64+
65+ // Update textarea size to fit left pane
66+ halfWidth := m.width / 2
67+ contentHeight := m.height - 4
68+ m.textarea.SetWidth(halfWidth - 3) // -3 for borders and padding
69+ m.textarea.SetHeight(contentHeight)
4770 }
4871
4972 // Update spinner
73+ var cmd tea.Cmd
5074 m.spinner, cmd = m.spinner.Update(msg)
51- return m, cmd
75+ cmds = append(cmds, cmd)
76+
77+ // Update textarea
78+ m.textarea, cmd = m.textarea.Update(msg)
79+ cmds = append(cmds, cmd)
80+
81+ return m, tea.Batch(cmds...)
5282 }
5383
5484 // View renders the UI (required by BubbleTea)
@@ -74,12 +104,33 @@ func (m Model) View() string {
74104 b.WriteString(borderStyle.Render("╮"))
75105 b.WriteString("\n")
76106
107+ // Render textarea in left pane
108+ textareaView := m.textarea.View()
109+ textareaLines := strings.Split(textareaView, "\n")
110+
77111 // Content rows
78112 for i := 0; i < contentHeight; i++ {
79113 b.WriteString(borderStyle.Render("│"))
80- b.WriteString(strings.Repeat(" ", halfWidth-1))
114+
115+ // Left pane: textarea
116+ if i < len(textareaLines) {
117+ line := textareaLines[i]
118+ lineWidth := lipgloss.Width(line)
119+ padding := halfWidth - 1 - lineWidth
120+ if padding < 0 {
121+ padding = 0
122+ }
123+ b.WriteString(line)
124+ b.WriteString(strings.Repeat(" ", padding))
125+ } else {
126+ b.WriteString(strings.Repeat(" ", halfWidth-1))
127+ }
128+
81129 b.WriteString(borderStyle.Render("│"))
130+
131+ // Right pane: empty for now
82132 b.WriteString(strings.Repeat(" ", m.width-halfWidth-2))
133+
83134 b.WriteString(borderStyle.Render("│"))
84135 b.WriteString("\n")
85136 }