| 79 | } |
| 80 | |
| 81 | func (m LogModel) updateList(msg tea.KeyMsg) (tea.Model, tea.Cmd) { |
| 82 | switch msg.String() { |
| 83 | case "q", "ctrl+c": |
| 84 | return m, tea.Quit |
| 85 | case "j", "down": |
| 86 | if m.cursor < len(m.commits)-1 { |
| 87 | m.cursor++ |
| 88 | } |
| 89 | case "k", "up": |
| 90 | if m.cursor > 0 { |
| 91 | m.cursor-- |
| 92 | } |
| 93 | case "g": |
| 94 | m.cursor = 0 |
| 95 | case "G": |
| 96 | m.cursor = max(0, len(m.commits)-1) |
| 97 | case "enter": |
| 98 | if len(m.commits) > 0 { |
| 99 | return m, m.loadCommitDiff() |
| 100 | } |
| 101 | } |
| 102 | return m, nil |
| 103 | } |
| 104 | |
| 105 | func (m LogModel) updateDiff(msg tea.KeyMsg) (tea.Model, tea.Cmd) { |
| 106 | switch msg.String() { |