mouseSelect maps a left-click Y coordinate onto the debug panel and, if it lands on an event row, focuses the panel and selects that event.
(msg tea.MouseMsg)
| 777 | // mouseSelect maps a left-click Y coordinate onto the debug panel and, if it |
| 778 | // lands on an event row, focuses the panel and selects that event. |
| 779 | func (m harness) mouseSelect(msg tea.MouseMsg) tea.Model { |
| 780 | // Compute the y-range of the debug panel inside the alt-screen. |
| 781 | debugTop := m.viewport.Height + 1 // +1 for the panel's top border row |
| 782 | debugBottom := debugTop + (debugPanelHeight - 2) // -2 for top+bottom border |
| 783 | if msg.Y < debugTop || msg.Y >= debugBottom { |
| 784 | return m |
| 785 | } |
| 786 | row := msg.Y - debugTop + m.debugView.YOffset |
| 787 | events := debug.Snapshot() |
| 788 | if row < 0 || row >= len(events) { |
| 789 | return m |
| 790 | } |
| 791 | if !m.debugFocus { |
| 792 | m.input.Blur() |
| 793 | m.debugFocus = true |
| 794 | } |
| 795 | m.debugSelected = events[row].ID |
| 796 | // One click selects; pressing Enter (or another click in v2) drills in. |
| 797 | m.debugMode = debugList |
| 798 | m.refreshDebugContent() |
| 799 | return m |
| 800 | } |
| 801 | |
| 802 | // formatDebugEvent renders one event as a single line, color-coded by level |
| 803 | // and source. The leading `#<id>` is what the user passes to /debug show. |
no test coverage detected