1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-11-29 22:48:24 +02:00

allow focusing on command log view

This commit is contained in:
Jesse Duffield
2021-04-11 15:01:49 +10:00
parent cf78b86cb5
commit 393ce05860
9 changed files with 121 additions and 31 deletions

View File

@@ -5,6 +5,12 @@ func (gui *Gui) handleCreateExtrasMenuPanel() error {
{
displayString: gui.Tr.ToggleShowCommandLog,
onPress: func() error {
currentContext := gui.currentStaticContext()
if gui.ShowExtrasWindow && currentContext.GetKey() == COMMAND_LOG_CONTEXT_KEY {
if err := gui.returnFromContext(); err != nil {
return err
}
}
gui.ShowExtrasWindow = !gui.ShowExtrasWindow
return nil
},
@@ -12,12 +18,32 @@ func (gui *Gui) handleCreateExtrasMenuPanel() error {
{
displayString: gui.Tr.FocusCommandLog,
onPress: func() error {
gui.ShowExtrasWindow = true
gui.State.Contexts.CommandLog.SetParentContext(gui.currentSideContext())
return gui.pushContext(gui.State.Contexts.CommandLog)
return gui.handleFocusCommandLog()
},
},
}
return gui.createMenu(gui.Tr.DiffingMenuTitle, menuItems, createMenuOptions{showCancel: true})
return gui.createMenu(gui.Tr.CommandLog, menuItems, createMenuOptions{showCancel: true})
}
func (gui *Gui) handleFocusCommandLog() error {
gui.ShowExtrasWindow = true
gui.State.Contexts.CommandLog.SetParentContext(gui.currentSideContext())
return gui.pushContext(gui.State.Contexts.CommandLog)
}
func (gui *Gui) scrollUpExtra() error {
gui.Views.Extras.Autoscroll = false
return gui.scrollUpView(gui.Views.Extras)
}
func (gui *Gui) scrollDownExtra() error {
gui.Views.Extras.Autoscroll = false
if err := gui.scrollDownView(gui.Views.Extras); err != nil {
return err
}
return nil
}