1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-01-20 05:19:24 +02:00

support clicking through to commit files panel

This commit is contained in:
Jesse Duffield 2019-11-10 22:28:41 +11:00
parent de5bcb8b9c
commit e174e5254d

View File

@ -24,11 +24,24 @@ func (gui *Gui) getSelectedCommit(g *gocui.Gui) *commands.Commit {
}
func (gui *Gui) handleCommitsClick(g *gocui.Gui, v *gocui.View) error {
itemCount := len(gui.State.Commits)
handleSelect := gui.handleCommitSelect
selectedLine := &gui.State.Panels.Commits.SelectedLine
if gui.popupPanelFocused() {
return nil
}
return gui.handleClick(v, itemCount, selectedLine, handleSelect)
prevSelectedLineIdx := gui.State.Panels.Commits.SelectedLine
newSelectedLineIdx := v.SelectedLineIdx()
if newSelectedLineIdx > len(gui.State.Commits)-1 {
return gui.handleCommitSelect(gui.g, v)
}
gui.State.Panels.Commits.SelectedLine = newSelectedLineIdx
if prevSelectedLineIdx == newSelectedLineIdx && gui.currentViewName() == v.Name() {
return gui.handleSwitchToCommitFilesPanel(gui.g, v)
} else {
return gui.handleCommitSelect(gui.g, v)
}
}
func (gui *Gui) handleCommitSelect(g *gocui.Gui, v *gocui.View) error {