Skip to content

Commit 090abfc

Browse files
pablospedlvhdr
authored andcommitted
feat: make ctrl+d/ctrl+u global for diff scrolling
These shortcuts now scroll the diff viewer regardless of which panel is currently active.
1 parent cad6633 commit 090abfc

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

pkg/ui/mainModel.go

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,14 +181,21 @@ func (m mainModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
181181
}
182182

183183
// Route messages: key messages go only to active panel, other messages go to both.
184-
switch msg.(type) {
184+
// Exception: ctrl+d/ctrl+u always go to diffViewer for scrolling.
185+
switch msg := msg.(type) {
185186
case tea.KeyMsg:
186-
if m.activePanel == DiffViewerPanel {
187+
switch msg.String() {
188+
case "ctrl+d", "ctrl+u":
187189
m.diffViewer, cmd = m.diffViewer.Update(msg)
188190
cmds = append(cmds, cmd)
189-
} else {
190-
m.fileTree, cmd = m.fileTree.Update(msg)
191-
cmds = append(cmds, cmd)
191+
default:
192+
if m.activePanel == DiffViewerPanel {
193+
m.diffViewer, cmd = m.diffViewer.Update(msg)
194+
cmds = append(cmds, cmd)
195+
} else {
196+
m.fileTree, cmd = m.fileTree.Update(msg)
197+
cmds = append(cmds, cmd)
198+
}
192199
}
193200
default:
194201
m.diffViewer, cmd = m.diffViewer.Update(msg)

0 commit comments

Comments
 (0)