headerText returns the (styled) title, subtitle, and help lines shared by render and panelSize so their layout math can't drift apart.
()
| 667 | // headerText returns the (styled) title, subtitle, and help lines shared by |
| 668 | // render and panelSize so their layout math can't drift apart. |
| 669 | func (m *agentPickerModel) headerText() (title, subtitle, help string) { |
| 670 | title = styles.HighlightWhiteStyle.Render("Choose an agent to run") |
| 671 | subtitleText := "Pick the agent you want to start a session with, or double-click a card." |
| 672 | if n := m.visibleCount(); n < len(m.choices) { |
| 673 | // Pad the indices to the total's width so the subtitle — and thus the |
| 674 | // centred panel geometry mouse hit-testing relies on — keeps a |
| 675 | // constant width while scrolling. |
| 676 | d := len(strconv.Itoa(len(m.choices))) |
| 677 | subtitleText = fmt.Sprintf("Pick an agent (%*d–%*d of %d, scroll with ↑↓), or double-click a card.", |
| 678 | d, m.offset+1, d, m.offset+n, len(m.choices)) |
| 679 | } |
| 680 | subtitle = styles.MutedStyle.Render(subtitleText) |
| 681 | help = styles.MutedStyle.Render( |
| 682 | strings.Join([]string{ |
| 683 | "↑↓ move", |
| 684 | "double-click select", |
| 685 | agentPickerKeys.Choose.Help().Key + " " + agentPickerKeys.Choose.Help().Desc, |
| 686 | agentPickerKeys.Details.Help().Key + " " + agentPickerKeys.Details.Help().Desc, |
| 687 | agentPickerKeys.Lean.Help().Key + " " + agentPickerKeys.Lean.Help().Desc, |
| 688 | agentPickerKeys.Quit.Help().Key + " " + agentPickerKeys.Quit.Help().Desc, |
| 689 | }, " "), |
| 690 | ) |
| 691 | return title, subtitle, help |
| 692 | } |
| 693 | |
| 694 | func (m *agentPickerModel) render() string { |
| 695 | title, subtitle, help := m.headerText() |
no test coverage detected