on main help sign in
add anim to the messages
commit25e9651655f1e2e1226297a28ad47948b722e7ab authorKujtim Hoxha <kujtimii.h@gmail.com> dateThu 22 May 2025, 14:23 (1 year ago) parentabbbc05
8 files changed+257−70
internal/tui/components/anim/anim.go+10−8 internal/tui/components/chat/chat.go+21−17 internal/tui/components/chat/list.go+1−14 internal/tui/components/chat/list_v2.go+114−17 internal/tui/components/chat/messages/messages.go+41−2 internal/tui/components/chat/messages/tool.go+16−4 internal/tui/components/chat/sidebar.go+2−2 internal/tui/components/core/list/list.go+52−6
internal/tui/components/anim/anim.go+10−8
@@ -216,16 +216,18 @@ func (a anim) View() string {
216216 b.WriteRune(c.currentValue)
217217 }
218218
219− textStyle := styles.BaseStyle().
220− Foreground(t.Text())
221−
222− for _, c := range a.labelChars {
223− b.WriteString(
224− textStyle.Render(string(c.currentValue)),
225− )
219+ if len(a.label) > 1 {
220+ textStyle := styles.BaseStyle().
221+ Foreground(t.Text())
222+ for _, c := range a.labelChars {
223+ b.WriteString(
224+ textStyle.Render(string(c.currentValue)),
225+ )
226+ }
227+ return b.String() + textStyle.Render(a.ellipsis.View())
226228 }
227229
228− return b.String() + textStyle.Render(a.ellipsis.View())
230+ return b.String()
229231}
230232
231233func makeGradientRamp(length int) []color.Color {
internal/tui/components/chat/chat.go+21−17
@@ -5,7 +5,6 @@ import (
55 "sort"
66
77 "github.com/charmbracelet/lipgloss/v2"
8− "github.com/charmbracelet/x/ansi"
98 "github.com/opencode-ai/opencode/internal/config"
109 "github.com/opencode-ai/opencode/internal/message"
1110 "github.com/opencode-ai/opencode/internal/session"
@@ -25,26 +24,24 @@ type SessionClearedMsg struct{}
2524
2625type EditorFocusMsg bool
2726
28−func header(width int) string {
27+func header() string {
2928 return lipgloss.JoinVertical(
3029 lipgloss.Top,
31− logo(width),
32− repo(width),
30+ logo(),
31+ repo(),
3332 "",
34− cwd(width),
33+ cwd(),
3534 )
3635}
3736
38−func lspsConfigured(width int) string {
37+func lspsConfigured() string {
3938 cfg := config.Get()
4039 title := "LSP Configuration"
41− title = ansi.Truncate(title, width, "…")
4240
4341 t := theme.CurrentTheme()
4442 baseStyle := styles.BaseStyle()
4543
4644 lsps := baseStyle.
47− Width(width).
4845 Foreground(t.Primary()).
4946 Bold(true).
5047 Render(title)
@@ -64,7 +61,6 @@ func lspsConfigured(width int) string {
6461 Render(fmt.Sprintf("• %s", name))
6562
6663 cmd := lsp.Command
67− cmd = ansi.Truncate(cmd, width-lipgloss.Width(lspName)-3, "…")
6864
6965 lspPath := baseStyle.
7066 Foreground(t.TextMuted()).
@@ -72,7 +68,6 @@ func lspsConfigured(width int) string {
7268
7369 lspViews = append(lspViews,
7470 baseStyle.
75− Width(width).
7671 Render(
7772 lipgloss.JoinHorizontal(
7873 lipgloss.Left,
@@ -84,7 +79,6 @@ func lspsConfigured(width int) string {
8479 }
8580
8681 return baseStyle.
87− Width(width).
8882 Render(
8983 lipgloss.JoinVertical(
9084 lipgloss.Left,
@@ -97,7 +91,7 @@ func lspsConfigured(width int) string {
9791 )
9892}
9993
100−func logo(width int) string {
94+func logo() string {
10195 logo := fmt.Sprintf("%s %s", styles.OpenCodeIcon, "OpenCode")
10296 t := theme.CurrentTheme()
10397 baseStyle := styles.BaseStyle()
@@ -108,7 +102,6 @@ func logo(width int) string {
108102
109103 return baseStyle.
110104 Bold(true).
111− Width(width).
112105 Render(
113106 lipgloss.JoinHorizontal(
114107 lipgloss.Left,
@@ -119,22 +112,33 @@ func logo(width int) string {
119112 )
120113}
121114
122−func repo(width int) string {
115+func repo() string {
123116 repo := "https://github.com/opencode-ai/opencode"
124117 t := theme.CurrentTheme()
125118
126119 return styles.BaseStyle().
127120 Foreground(t.TextMuted()).
128− Width(width).
129121 Render(repo)
130122}
131123
132−func cwd(width int) string {
124+func cwd() string {
133125 cwd := fmt.Sprintf("cwd: %s", config.WorkingDirectory())
134126 t := theme.CurrentTheme()
135127
136128 return styles.BaseStyle().
137129 Foreground(t.TextMuted()).
138− Width(width).
139130 Render(cwd)
140131}
132+
133+func initialScreen() string {
134+ baseStyle := styles.BaseStyle()
135+
136+ return baseStyle.Render(
137+ lipgloss.JoinVertical(
138+ lipgloss.Top,
139+ header(),
140+ "",
141+ lspsConfigured(),
142+ ),
143+ )
144+}
internal/tui/components/chat/list.go+1−14
@@ -282,7 +282,7 @@ func (m *messagesCmp) View() string {
282282 Width(m.width).
283283 Height(m.height - 1).
284284 Render(
285− m.initialScreen(),
285+ initialScreen(),
286286 )
287287
288288 return baseStyle.
@@ -400,19 +400,6 @@ func (m *messagesCmp) help() string {
400400 Render(text)
401401}
402402
403−func (m *messagesCmp) initialScreen() string {
404− baseStyle := styles.BaseStyle()
405−
406− return baseStyle.Width(m.width).Render(
407− lipgloss.JoinVertical(
408− lipgloss.Top,
409− header(m.width),
410− "",
411− lspsConfigured(m.width),
412− ),
413− )
414−}
415−
416403func (m *messagesCmp) rerender() {
417404 for _, msg := range m.messages {
418405 delete(m.cachedContent, msg.ID)
internal/tui/components/chat/list_v2.go+114−17
@@ -8,6 +8,7 @@ import (
88 "github.com/charmbracelet/lipgloss/v2"
99 "github.com/opencode-ai/opencode/internal/app"
1010 "github.com/opencode-ai/opencode/internal/message"
11+ "github.com/opencode-ai/opencode/internal/pubsub"
1112 "github.com/opencode-ai/opencode/internal/session"
1213 "github.com/opencode-ai/opencode/internal/tui/components/chat/messages"
1314 "github.com/opencode-ai/opencode/internal/tui/components/core/list"
@@ -25,8 +26,9 @@ type messageListCmp struct {
2526 app *app.App
2627 width, height int
2728 session session.Session
28− messages []util.Model
2929 listCmp list.ListModel
30+
31+ lastUserMessageTime int64
3032}
3133
3234func NewMessagesListCmp(app *app.App) MessageListCmp {
@@ -54,6 +56,12 @@ func (m *messageListCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
5456 return m, cmd
5557 }
5658 return m, nil
59+ case SessionClearedMsg:
60+ m.session = session.Session{}
61+ return m, m.listCmp.SetItems([]util.Model{})
62+
63+ case pubsub.Event[message.Message]:
64+ return m, m.handleMessageEvent(msg)
5765 default:
5866 var cmds []tea.Cmd
5967 u, cmd := m.listCmp.Update(msg)
@@ -64,19 +72,91 @@ func (m *messageListCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
6472}
6573
6674func (m *messageListCmp) View() string {
75+ if len(m.listCmp.Items()) == 0 {
76+ return initialScreen()
77+ }
6778 return lipgloss.JoinVertical(lipgloss.Left, m.listCmp.View())
6879}
6980
70−// GetSize implements MessageListCmp.
71−func (m *messageListCmp) GetSize() (int, int) {
72− return m.width, m.height
81+func (m *messageListCmp) handleChildSession(event pubsub.Event[message.Message]) {
82+ // TODO: update the agent tool message with the changes
7383}
7484
75−// SetSize implements MessageListCmp.
76−func (m *messageListCmp) SetSize(width int, height int) tea.Cmd {
77− m.width = width
78− m.height = height - 1
79− return m.listCmp.SetSize(width, height-1)
85+func (m *messageListCmp) handleMessageEvent(event pubsub.Event[message.Message]) tea.Cmd {
86+ switch event.Type {
87+ case pubsub.CreatedEvent:
88+ if event.Payload.SessionID != m.session.ID {
89+ m.handleChildSession(event)
90+ }
91+ messageExists := false
92+ // more likely to be at the end of the list
93+ items := m.listCmp.Items()
94+ for i := len(items) - 1; i >= 0; i-- {
95+ msg := items[i].(messages.MessageCmp)
96+ if msg.GetMessage().ID == event.Payload.ID {
97+ messageExists = true
98+ break
99+ }
100+ }
101+ if messageExists {
102+ return nil
103+ }
104+ switch event.Payload.Role {
105+ case message.User:
106+ return m.handleNewUserMessage(event.Payload)
107+ case message.Assistant:
108+ return m.handleNewAssistantMessage(event.Payload)
109+ }
110+ // TODO: handle tools
111+ case pubsub.UpdatedEvent:
112+ return m.handleUpdateAssistantMessage(event.Payload)
113+ }
114+ return nil
115+}
116+
117+func (m *messageListCmp) handleNewUserMessage(msg message.Message) tea.Cmd {
118+ m.lastUserMessageTime = msg.CreatedAt
119+ return m.listCmp.AppendItem(messages.NewMessageCmp(msg))
120+}
121+
122+func (m *messageListCmp) handleUpdateAssistantMessage(msg message.Message) tea.Cmd {
123+ // Simple update the content
124+ items := m.listCmp.Items()
125+ lastItem := items[len(items)-1].(messages.MessageCmp)
126+ // TODO:handle tool calls
127+ if lastItem.GetMessage().ID != msg.ID {
128+ return nil
129+ }
130+ // for now just updet the last message
131+ if len(msg.ToolCalls()) == 0 || msg.Content().Text != "" || msg.IsThinking() {
132+ m.listCmp.UpdateItem(
133+ len(items)-1,
134+ messages.NewMessageCmp(
135+ msg,
136+ messages.WithLastUserMessageTime(time.Unix(m.lastUserMessageTime, 0)),
137+ ),
138+ )
139+ }
140+ return nil
141+}
142+
143+func (m *messageListCmp) handleNewAssistantMessage(msg message.Message) tea.Cmd {
144+ var cmds []tea.Cmd
145+ // Only add assistant messages if they don't have tool calls or there is some content
146+ if len(msg.ToolCalls()) == 0 || msg.Content().Text != "" || msg.IsThinking() {
147+ cmd := m.listCmp.AppendItem(
148+ messages.NewMessageCmp(
149+ msg,
150+ messages.WithLastUserMessageTime(time.Unix(m.lastUserMessageTime, 0)),
151+ ),
152+ )
153+ cmds = append(cmds, cmd)
154+ }
155+ for _, tc := range msg.ToolCalls() {
156+ cmd := m.listCmp.AppendItem(messages.NewToolCallCmp(tc))
157+ cmds = append(cmds, cmd)
158+ }
159+ return tea.Batch(cmds...)
80160}
81161
82162func (m *messageListCmp) SetSession(session session.Session) tea.Cmd {
@@ -88,8 +168,8 @@ func (m *messageListCmp) SetSession(session session.Session) tea.Cmd {
88168 if err != nil {
89169 return util.ReportError(err)
90170 }
91− m.messages = make([]util.Model, 0)
92− lastUserMessageTime := sessionMessages[0].CreatedAt
171+ uiMessages := make([]util.Model, 0)
172+ m.lastUserMessageTime = sessionMessages[0].CreatedAt
93173 toolResultMap := make(map[string]message.ToolResult)
94174 // first pass to get all tool results
95175 for _, msg := range sessionMessages {
@@ -100,12 +180,18 @@ func (m *messageListCmp) SetSession(session session.Session) tea.Cmd {
100180 for _, msg := range sessionMessages {
101181 switch msg.Role {
102182 case message.User:
103− lastUserMessageTime = msg.CreatedAt
104− m.messages = append(m.messages, messages.NewMessageCmp(msg))
183+ m.lastUserMessageTime = msg.CreatedAt
184+ uiMessages = append(uiMessages, messages.NewMessageCmp(msg))
105185 case message.Assistant:
106186 // Only add assistant messages if they don't have tool calls or there is some content
107187 if len(msg.ToolCalls()) == 0 || msg.Content().Text != "" || msg.IsThinking() {
108− m.messages = append(m.messages, messages.NewMessageCmp(msg, messages.WithLastUserMessageTime(time.Unix(lastUserMessageTime, 0))))
188+ uiMessages = append(
189+ uiMessages,
190+ messages.NewMessageCmp(
191+ msg,
192+ messages.WithLastUserMessageTime(time.Unix(m.lastUserMessageTime, 0)),
193+ ),
194+ )
109195 }
110196 for _, tc := range msg.ToolCalls() {
111197 options := []messages.ToolCallOption{}
@@ -115,10 +201,21 @@ func (m *messageListCmp) SetSession(session session.Session) tea.Cmd {
115201 if msg.FinishPart().Reason == message.FinishReasonCanceled {
116202 options = append(options, messages.WithToolCallCancelled())
117203 }
118− m.messages = append(m.messages, messages.NewToolCallCmp(tc, options...))
204+ uiMessages = append(uiMessages, messages.NewToolCallCmp(tc, options...))
119205 }
120206 }
121207 }
122− m.listCmp.SetItems(m.messages)
123− return nil
208+ return m.listCmp.SetItems(uiMessages)
209+}
210+
211+// GetSize implements MessageListCmp.
212+func (m *messageListCmp) GetSize() (int, int) {
213+ return m.width, m.height
214+}
215+
216+// SetSize implements MessageListCmp.
217+func (m *messageListCmp) SetSize(width int, height int) tea.Cmd {
218+ m.width = width
219+ m.height = height - 1
220+ return m.listCmp.SetSize(width, height-1)
124221}
internal/tui/components/chat/messages/messages.go+41−2
@@ -12,6 +12,7 @@ import (
1212 "github.com/opencode-ai/opencode/internal/llm/models"
1313
1414 "github.com/opencode-ai/opencode/internal/message"
15+ "github.com/opencode-ai/opencode/internal/tui/components/anim"
1516 "github.com/opencode-ai/opencode/internal/tui/layout"
1617 "github.com/opencode-ai/opencode/internal/tui/styles"
1718 "github.com/opencode-ai/opencode/internal/tui/theme"
@@ -22,6 +23,8 @@ type MessageCmp interface {
2223 util.Model
2324 layout.Sizeable
2425 layout.Focusable
26+ GetMessage() message.Message
27+ Spinning() bool
2528}
2629
2730type messageCmp struct {
@@ -30,9 +33,10 @@ type messageCmp struct {
3033
3134 // Used for agent and user messages
3235 message message.Message
36+ spinning bool
37+ anim util.Model
3338 lastUserMessageTime time.Time
3439}
35−
3640type MessageOption func(*messageCmp)
3741
3842func WithLastUserMessageTime(t time.Time) MessageOption {
@@ -44,6 +48,7 @@ func WithLastUserMessageTime(t time.Time) MessageOption {
4448func NewMessageCmp(msg message.Message, opts ...MessageOption) MessageCmp {
4549 m := &messageCmp{
4650 message: msg,
51+ anim: anim.New(15, ""),
4752 }
4853 for _, opt := range opts {
4954 opt(m)
@@ -52,14 +57,23 @@ func NewMessageCmp(msg message.Message, opts ...MessageOption) MessageCmp {
5257}
5358
5459func (m *messageCmp) Init() tea.Cmd {
60+ m.spinning = m.shouldSpin()
61+ if m.spinning {
62+ return m.anim.Init()
63+ }
5564 return nil
5665}
5766
5867func (m *messageCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
59− return m, nil
68+ u, cmd := m.anim.Update(msg)
69+ m.anim = u.(util.Model)
70+ return m, cmd
6071}
6172
6273func (m *messageCmp) View() string {
74+ if m.spinning {
75+ return m.style().PaddingLeft(1).Render(m.anim.View())
76+ }
6377 if m.message.ID != "" {
6478 // this is a user or assistant message
6579 switch m.message.Role {
@@ -72,6 +86,11 @@ func (m *messageCmp) View() string {
7286 return "Unknown Message"
7387}
7488
89+// GetMessage implements MessageCmp.
90+func (m *messageCmp) GetMessage() message.Message {
91+ return m.message
92+}
93+
7594func (m *messageCmp) textWidth() int {
7695 return m.width - 1 // take into account the border
7796}
@@ -184,6 +203,21 @@ func (m *messageCmp) markdownContent() string {
184203 return m.toMarkdown(content)
185204}
186205
206+func (m *messageCmp) shouldSpin() bool {
207+ if m.message.Role != message.Assistant {
208+ return false
209+ }
210+
211+ if m.message.IsFinished() {
212+ return false
213+ }
214+
215+ if m.message.Content().Text != "" {
216+ return false
217+ }
218+ return true
219+}
220+
187221// Blur implements MessageModel.
188222func (m *messageCmp) Blur() tea.Cmd {
189223 m.focused = false
@@ -209,3 +243,8 @@ func (m *messageCmp) SetSize(width int, height int) tea.Cmd {
209243 m.width = width
210244 return nil
211245}
246+
247+// Spinning implements MessageCmp.
248+func (m *messageCmp) Spinning() bool {
249+ return m.spinning
250+}
internal/tui/components/chat/messages/tool.go+16−4
@@ -19,6 +19,8 @@ type ToolCallCmp interface {
1919 util.Model
2020 layout.Sizeable
2121 layout.Focusable
22+ GetToolCall() message.ToolCall
23+ GetToolResult() message.ToolResult
2224}
2325
2426type toolCallCmp struct {
@@ -73,14 +75,24 @@ func (m *toolCallCmp) View() string {
7375 return box.PaddingLeft(1).Render(r.Render(m))
7476}
7577
76−func (v *toolCallCmp) renderPending() string {
77− return fmt.Sprintf("%s: %s", prettifyToolName(v.call.Name), toolAction(v.call.Name))
78+// GetToolCall implements ToolCallCmp.
79+func (m *toolCallCmp) GetToolCall() message.ToolCall {
80+ return m.call
7881}
7982
80−func (msg *toolCallCmp) style() lipgloss.Style {
83+// GetToolResult implements ToolCallCmp.
84+func (m *toolCallCmp) GetToolResult() message.ToolResult {
85+ return m.result
86+}
87+
88+func (m *toolCallCmp) renderPending() string {
89+ return fmt.Sprintf("%s: %s", prettifyToolName(m.call.Name), toolAction(m.call.Name))
90+}
91+
92+func (m *toolCallCmp) style() lipgloss.Style {
8193 t := theme.CurrentTheme()
8294 borderStyle := lipgloss.NormalBorder()
83− if msg.focused {
95+ if m.focused {
8496 borderStyle = lipgloss.DoubleBorder()
8597 }
8698 return styles.BaseStyle().
internal/tui/components/chat/sidebar.go+2−2
@@ -93,11 +93,11 @@ func (m *sidebarCmp) View() string {
9393 Render(
9494 lipgloss.JoinVertical(
9595 lipgloss.Top,
96− header(m.width),
96+ header(),
9797 " ",
9898 m.sessionSection(),
9999 " ",
100− lspsConfigured(m.width),
100+ lspsConfigured(),
101101 " ",
102102 m.modifiedFiles(),
103103 ),
internal/tui/components/core/list/list.go+52−6
@@ -9,6 +9,8 @@ import (
99 "github.com/charmbracelet/bubbles/v2/key"
1010 tea "github.com/charmbracelet/bubbletea/v2"
1111 "github.com/charmbracelet/lipgloss/v2"
12+ "github.com/opencode-ai/opencode/internal/logging"
13+ "github.com/opencode-ai/opencode/internal/tui/components/anim"
1214 "github.com/opencode-ai/opencode/internal/tui/layout"
1315 "github.com/opencode-ai/opencode/internal/tui/util"
1416)
@@ -17,11 +19,17 @@ type ListModel interface {
1719 util.Model
1820 layout.Sizeable
1921 SetItems([]util.Model) tea.Cmd
20− AppendItem(util.Model)
21− PrependItem(util.Model)
22+ AppendItem(util.Model) tea.Cmd
23+ PrependItem(util.Model) tea.Cmd
2224 DeleteItem(int)
2325 UpdateItem(int, util.Model)
2426 ResetView()
27+ Items() []util.Model
28+}
29+
30+type HasAnim interface {
31+ util.Model
32+ Spinning() bool
2533}
2634
2735type renderedItem struct {
@@ -107,6 +115,7 @@ func (m *model) Init() tea.Cmd {
107115
108116// Update implements List.
109117func (m *model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
118+ var cmds []tea.Cmd
110119 switch msg := msg.(type) {
111120 case tea.KeyMsg:
112121 switch {
@@ -151,11 +160,37 @@ func (m *model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
151160 m.goToBottom()
152161 return m, nil
153162 }
163+ case anim.ColorCycleMsg:
164+ logging.Info("ColorCycleMsg", "msg", msg)
165+ for inx, item := range m.items {
166+ if i, ok := item.(HasAnim); ok {
167+ if i.Spinning() {
168+ updated, cmd := i.Update(msg)
169+ cmds = append(cmds, cmd)
170+ m.UpdateItem(inx, updated.(util.Model))
171+ }
172+ }
173+ }
174+ return m, tea.Batch(cmds...)
175+ case anim.StepCharsMsg:
176+ logging.Info("ColorCycleMsg", "msg", msg)
177+ for inx, item := range m.items {
178+ if i, ok := item.(HasAnim); ok {
179+ if i.Spinning() {
180+ updated, cmd := i.Update(msg)
181+ cmds = append(cmds, cmd)
182+ m.UpdateItem(inx, updated.(util.Model))
183+ }
184+ }
185+ }
186+ return m, tea.Batch(cmds...)
154187 }
155188 if m.selectedItemInx > -1 {
156189 u, cmd := m.items[m.selectedItemInx].Update(msg)
190+ cmds = append(cmds, cmd)
157191 m.UpdateItem(m.selectedItemInx, u.(util.Model))
158− return m, cmd
192+ cmds = append(cmds, cmd)
193+ return m, tea.Batch(cmds...)
159194 }
160195
161196 return m, nil
@@ -172,6 +207,11 @@ func (m *model) View() string {
172207 return lipgloss.NewStyle().Padding(m.padding...).Height(m.height).Render(m.content)
173208}
174209
210+// Items implements ListModel.
211+func (m *model) Items() []util.Model {
212+ return m.items
213+}
214+
175215func (m *model) renderVisibleReverse() {
176216 start := 0
177217 cutoff := m.offset + m.listHeight()
@@ -464,7 +504,6 @@ func (m *model) rerenderItem(inx int) {
464504 }
465505 // TODO: if hight changed do something
466506 if cachedItem.height != len(rerenderedLines) && inx != len(m.items)-1 {
467− panic("not handled")
468507 }
469508 m.renderedItems.Store(inx, renderedItem{
470509 lines: rerenderedLines,
@@ -563,10 +602,12 @@ func (m *model) listHeight() int {
563602}
564603
565604// AppendItem implements List.
566−func (m *model) AppendItem(item util.Model) {
605+func (m *model) AppendItem(item util.Model) tea.Cmd {
606+ cmd := item.Init()
567607 m.items = append(m.items, item)
568608 m.goToBottom()
569609 m.needsRerender = true
610+ return cmd
570611}
571612
572613// DeleteItem implements List.
@@ -577,7 +618,8 @@ func (m *model) DeleteItem(i int) {
577618}
578619
579620// PrependItem implements List.
580−func (m *model) PrependItem(item util.Model) {
621+func (m *model) PrependItem(item util.Model) tea.Cmd {
622+ cmd := item.Init()
581623 m.items = append([]util.Model{item}, m.items...)
582624 // update the indices of the rendered items
583625 newRenderedItems := make(map[int]renderedItem)
@@ -594,6 +636,7 @@ func (m *model) PrependItem(item util.Model) {
594636 }
595637 m.goToTop()
596638 m.needsRerender = true
639+ return cmd
597640}
598641
599642func (m *model) setReverse(reverse bool) {
@@ -610,6 +653,9 @@ func (m *model) SetItems(items []util.Model) tea.Cmd {
610653 var cmds []tea.Cmd
611654 cmd := m.setItemsSize()
612655 cmds = append(cmds, cmd)
656+ for _, item := range m.items {
657+ cmds = append(cmds, item.Init())
658+ }
613659 if m.reverse {
614660 m.selectedItemInx = len(m.items) - 1
615661 cmd := m.focusSelected()