toggleDebugFocus flips focus between the input box and the debug panel. On the first focus, picks the latest event as the selection so ↑/↓ has a starting point.
()
| 648 | // On the first focus, picks the latest event as the selection so ↑/↓ has a |
| 649 | // starting point. |
| 650 | func (m harness) toggleDebugFocus() tea.Model { |
| 651 | m.debugFocus = !m.debugFocus |
| 652 | if m.debugFocus { |
| 653 | m.input.Blur() |
| 654 | if m.debugSelected == 0 { |
| 655 | events := debug.Snapshot() |
| 656 | if len(events) > 0 { |
| 657 | m.debugSelected = events[len(events)-1].ID |
| 658 | } |
| 659 | } |
| 660 | } else { |
| 661 | m.input.Focus() |
| 662 | } |
| 663 | // Always back to list mode on a focus change — Tab is a "reset" so the |
| 664 | // user never gets stuck inside the modal after pressing it. |
| 665 | m.debugMode = debugList |
| 666 | m.layout() |
| 667 | m.refreshDebugContent() |
| 668 | return m |
| 669 | } |
| 670 | |
| 671 | // updateDebugFocus is the key handler used while the debug panel is focused. |
| 672 | // It owns ↑/↓ navigation, Enter to drill in, Esc to back out, and forwards |
no test coverage detected