on main help sign in
fix(ui): change UI model receiver to pointer back
84bbd5bAyman Bagabas
internal/ui/model/ui.go+8−7
@@ -162,15 +162,16 @@ func New(com *common.Common) *UI {
162}
162}
163
163
164// Init initializes the UI model.
164// Init initializes the UI model.
165−func (m UI) Init() tea.Cmd {
165+func (m *UI) Init() tea.Cmd {
166+ var cmds []tea.Cmd
166 if m.QueryVersion {
167 if m.QueryVersion {
167− return tea.RequestTerminalVersion
168+ cmds = append(cmds, tea.RequestTerminalVersion)
168 }
169 }
169− return nil
170+ return tea.Batch(cmds...)
170}
171}
171
172
172// Update handles updates to the UI model.
173// Update handles updates to the UI model.
173−func (m UI) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
174+func (m *UI) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
174 var cmds []tea.Cmd
175 var cmds []tea.Cmd
175 switch msg := msg.(type) {
176 switch msg := msg.(type) {
176 case tea.EnvMsg:
177 case tea.EnvMsg:
@@ -395,7 +396,7 @@ func (m *UI) Cursor() *tea.Cursor {
395}
396}
396
397
397// View renders the UI model's view.
398// View renders the UI model's view.
398−func (m UI) View() tea.View {
399+func (m *UI) View() tea.View {
399 var v tea.View
400 var v tea.View
400 v.AltScreen = true
401 v.AltScreen = true
401 v.BackgroundColor = m.com.Styles.Background
402 v.BackgroundColor = m.com.Styles.Background
@@ -426,7 +427,7 @@ func (m UI) View() tea.View {
426}
427}
427
428
428// ShortHelp implements [help.KeyMap].
429// ShortHelp implements [help.KeyMap].
429−func (m UI) ShortHelp() []key.Binding {
430+func (m *UI) ShortHelp() []key.Binding {
430 var binds []key.Binding
431 var binds []key.Binding
431 k := &m.keyMap
432 k := &m.keyMap
432
433
@@ -473,7 +474,7 @@ func (m UI) ShortHelp() []key.Binding {
473}
474}
474
475
475// FullHelp implements [help.KeyMap].
476// FullHelp implements [help.KeyMap].
476−func (m UI) FullHelp() [][]key.Binding {
477+func (m *UI) FullHelp() [][]key.Binding {
477 var binds [][]key.Binding
478 var binds [][]key.Binding
478 k := &m.keyMap
479 k := &m.keyMap
479 help := k.Help
480 help := k.Help