summaryrefslogtreecommitdiff
path: root/internal/hexaiaction/tui_delegate.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-09-08 12:02:40 +0300
committerPaul Buetow <paul@buetow.org>2025-09-08 12:02:40 +0300
commit75cf6abd55bfb60324fc47cf91eac08dbb8b87b4 (patch)
tree6ef90d8014fe4d9a757d3f7e95bf736b70e4c685 /internal/hexaiaction/tui_delegate.go
parent0dcf347c3fbc6e4ffb7e46294f5dd92dbbcd98ef (diff)
docs: move tmux documentation to its own file
Diffstat (limited to 'internal/hexaiaction/tui_delegate.go')
-rw-r--r--internal/hexaiaction/tui_delegate.go36
1 files changed, 18 insertions, 18 deletions
diff --git a/internal/hexaiaction/tui_delegate.go b/internal/hexaiaction/tui_delegate.go
index 0e5a68c..46d40cb 100644
--- a/internal/hexaiaction/tui_delegate.go
+++ b/internal/hexaiaction/tui_delegate.go
@@ -1,35 +1,35 @@
package hexaiaction
import (
- "fmt"
- "io"
+ "fmt"
+ "io"
- "github.com/charmbracelet/bubbles/list"
- tea "github.com/charmbracelet/bubbletea"
- "github.com/charmbracelet/lipgloss"
+ "github.com/charmbracelet/bubbles/list"
+ tea "github.com/charmbracelet/bubbletea"
+ "github.com/charmbracelet/lipgloss"
)
// oneLineDelegate renders a single compact line per item, no spacing.
type oneLineDelegate struct{}
var (
- hotStyle = lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("205"))
- cursorStyle = lipgloss.NewStyle().Bold(true)
+ hotStyle = lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("205"))
+ cursorStyle = lipgloss.NewStyle().Bold(true)
)
func (oneLineDelegate) Height() int { return 1 }
func (oneLineDelegate) Spacing() int { return 0 }
func (oneLineDelegate) Update(tea.Msg, *list.Model) tea.Cmd { return nil }
func (oneLineDelegate) Render(w io.Writer, m list.Model, index int, listItem list.Item) {
- title := listItem.FilterValue()
- hk := '?'
- if it, ok := listItem.(item); ok {
- hk = it.hotkey
- }
- hot := hotStyle.Render(fmt.Sprintf(" (%c)", hk))
- cursor := " "
- if index == m.Index() {
- cursor = cursorStyle.Render("> ")
- }
- fmt.Fprintf(w, "%s%s%s", cursor, title, hot)
+ title := listItem.FilterValue()
+ hk := '?'
+ if it, ok := listItem.(item); ok {
+ hk = it.hotkey
+ }
+ hot := hotStyle.Render(fmt.Sprintf(" (%c)", hk))
+ cursor := " "
+ if index == m.Index() {
+ cursor = cursorStyle.Render("> ")
+ }
+ fmt.Fprintf(w, "%s%s%s", cursor, title, hot)
}