GetCategories returns the shortcut categories for the current view.
()
| 43 | |
| 44 | // GetCategories returns the shortcut categories for the current view. |
| 45 | func (h *HelpOverlay) GetCategories() []ShortcutCategory { |
| 46 | // Common categories |
| 47 | loopControl := ShortcutCategory{ |
| 48 | Name: "Loop Control", |
| 49 | Shortcuts: []Shortcut{ |
| 50 | {Key: "s", Description: "Start loop"}, |
| 51 | {Key: "p", Description: "Pause (after iteration)"}, |
| 52 | {Key: "x", Description: "Stop immediately"}, |
| 53 | {Key: "+/-", Description: "Adjust max iterations"}, |
| 54 | }, |
| 55 | } |
| 56 | |
| 57 | views := ShortcutCategory{ |
| 58 | Name: "Views", |
| 59 | Shortcuts: []Shortcut{ |
| 60 | {Key: "t", Description: "Toggle log view"}, |
| 61 | {Key: "d", Description: "Toggle diff view"}, |
| 62 | {Key: "?", Description: "Help overlay"}, |
| 63 | }, |
| 64 | } |
| 65 | |
| 66 | prdControl := ShortcutCategory{ |
| 67 | Name: "PRD Control", |
| 68 | Shortcuts: []Shortcut{ |
| 69 | {Key: "1-9", Description: "Switch to PRD"}, |
| 70 | {Key: "e", Description: "Edit current PRD"}, |
| 71 | {Key: "n", Description: "Create new PRD"}, |
| 72 | {Key: "l", Description: "List/manage PRDs"}, |
| 73 | }, |
| 74 | } |
| 75 | |
| 76 | general := ShortcutCategory{ |
| 77 | Name: "General", |
| 78 | Shortcuts: []Shortcut{ |
| 79 | {Key: "q", Description: "Quit"}, |
| 80 | {Key: "Ctrl+C", Description: "Quit"}, |
| 81 | {Key: "Esc", Description: "Close overlay/modal"}, |
| 82 | }, |
| 83 | } |
| 84 | |
| 85 | // View-specific categories |
| 86 | switch h.viewMode { |
| 87 | case ViewLog, ViewDiff: |
| 88 | scrolling := ShortcutCategory{ |
| 89 | Name: "Scrolling", |
| 90 | Shortcuts: []Shortcut{ |
| 91 | {Key: "j / ↓", Description: "Scroll down"}, |
| 92 | {Key: "k / ↑", Description: "Scroll up"}, |
| 93 | {Key: "Ctrl+D / PgDn", Description: "Page down"}, |
| 94 | {Key: "Ctrl+U / PgUp", Description: "Page up"}, |
| 95 | {Key: "g", Description: "Go to top"}, |
| 96 | {Key: "G", Description: "Go to bottom"}, |
| 97 | }, |
| 98 | } |
| 99 | return []ShortcutCategory{loopControl, prdControl, views, scrolling, general} |
| 100 | |
| 101 | case ViewPicker: |
| 102 | navigation := ShortcutCategory{ |