Jump to status options with their first-letter shortcuts.

o/w/d select OPEN/WIP/DONE in the status menu, with the hotkeys shown inline.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Skruecken
2026-10-19 10:38:28 +02:00
co-authored by Cursor
parent 6527d91b4f
commit aa8f89b43a
4 changed files with 38 additions and 5 deletions
+17 -4
View File
@@ -1,7 +1,9 @@
package views
import (
"fmt"
"strings"
"unicode"
"github.com/charmbracelet/lipgloss"
@@ -46,6 +48,18 @@ func (m *StatusMenu) MoveUp() {
}
}
// JumpToShortcut moves the cursor to the status whose label starts with r.
func (m *StatusMenu) JumpToShortcut(r rune) bool {
r = unicode.ToLower(r)
for i, st := range ticket.AllStatuses {
if st.Shortcut() == r {
m.Cursor = i
return true
}
}
return false
}
// Selected returns the currently highlighted status.
func (m StatusMenu) Selected() ticket.Status {
if m.Cursor < 0 || m.Cursor >= len(ticket.AllStatuses) {
@@ -59,13 +73,12 @@ func (m StatusMenu) View() string {
var lines []string
lines = append(lines, m.Styles.Title.Render("Set status"))
for i, st := range ticket.AllStatuses {
label := " " + st.Label()
entry := fmt.Sprintf("%c %s", st.Shortcut(), st.Label())
if i == m.Cursor {
label = m.Styles.Selected.Render("▸ " + st.Label())
lines = append(lines, m.Styles.Selected.Render("▸ "+entry))
} else {
label = m.Styles.Normal.Render(label)
lines = append(lines, m.Styles.Normal.Render(" "+entry))
}
lines = append(lines, label)
}
body := strings.Join(lines, "\n")
w := m.Width