(msg tea.Msg)
| 684 | } |
| 685 | |
| 686 | func (m *appModel) update(msg tea.Msg) (tea.Model, tea.Cmd) { |
| 687 | // In lean mode, silently drop messages for features that don't exist. |
| 688 | if m.leanMode { |
| 689 | switch msg.(type) { |
| 690 | case messages.SpawnSessionMsg, messages.SwitchTabMsg, |
| 691 | messages.CloseTabMsg, messages.ReorderTabMsg, |
| 692 | messages.ToggleSidebarMsg: |
| 693 | return m, nil |
| 694 | } |
| 695 | } |
| 696 | |
| 697 | switch msg := msg.(type) { |
| 698 | // --- Routing & Animation --- |
| 699 | |
| 700 | case messages.RoutedMsg: |
| 701 | return m.handleRoutedMsg(msg) |
| 702 | |
| 703 | case animation.TickMsg: |
| 704 | // Drop the tick (and let the chain die) while we're blurred. |
| 705 | // animation.StartTick re-arms the chain on the next FocusMsg so |
| 706 | // spinners resume immediately when the user comes back. |
| 707 | if m.tickPaused { |
| 708 | return m, nil |
| 709 | } |
| 710 | cmds := []tea.Cmd{m.updateChatCmd(msg)} |
| 711 | // Update working spinner |
| 712 | if m.chatPage.IsWorking() { |
| 713 | model, cmd := m.workingSpinner.Update(msg) |
| 714 | m.workingSpinner = model.(spinner.Spinner) |
| 715 | cmds = append(cmds, cmd) |
| 716 | } |
| 717 | // Track frame for window-title spinner (tmux activity detection) |
| 718 | m.animFrame = msg.Frame |
| 719 | // Forward frame to tab bar for running indicator animation |
| 720 | m.tabBar.SetAnimFrame(msg.Frame) |
| 721 | if animation.HasActive() { |
| 722 | cmds = append(cmds, animation.StartTick()) |
| 723 | } |
| 724 | return m, tea.Batch(cmds...) |
| 725 | |
| 726 | // --- Tab management --- |
| 727 | |
| 728 | case messages.TabsUpdatedMsg: |
| 729 | prevHeight := m.tabBar.Height() |
| 730 | m.tabBar.SetTabs(msg.Tabs, msg.ActiveIdx) |
| 731 | m.statusBar.SetShowNewTab(m.tabBar.Height() == 0) |
| 732 | if m.tabBar.Height() != prevHeight { |
| 733 | cmd := m.resizeAll() |
| 734 | return m, cmd |
| 735 | } |
| 736 | return m, nil |
| 737 | |
| 738 | case messages.SpawnSessionMsg: |
| 739 | return m.handleSpawnSession(msg.WorkingDir) |
| 740 | |
| 741 | case messages.SwitchTabMsg: |
| 742 | return m.handleSwitchTab(msg.SessionID) |
| 743 |
no test coverage detected