diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2022-01-16 14:46:53 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2022-03-17 19:13:40 +1100 |
commit | 1dd7307fde033dae5fececac15810a99e26c3d91 (patch) | |
tree | 4e851c9e3229a6fe3b4191f6311d05d7a9142960 /pkg/gui/extras_panel.go | |
parent | a90b6efded49abcfa2516db794d7875b0396f558 (diff) |
start moving commit panel handlers into controller
more
and more
move rebase commit refreshing into existing abstraction
and more
and more
WIP
and more
handling clicks
properly fix merge conflicts
update cheatsheet
lots more preparation to start moving things into controllers
WIP
better typing
expand on remotes controller
moving more code into controllers
Diffstat (limited to 'pkg/gui/extras_panel.go')
-rw-r--r-- | pkg/gui/extras_panel.go | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/pkg/gui/extras_panel.go b/pkg/gui/extras_panel.go index bd65dea87..fd2998cb3 100644 --- a/pkg/gui/extras_panel.go +++ b/pkg/gui/extras_panel.go @@ -8,11 +8,11 @@ import ( ) func (gui *Gui) handleCreateExtrasMenuPanel() error { - return gui.PopupHandler.Menu(popup.CreateMenuOptions{ - Title: gui.Tr.CommandLog, + return gui.c.Menu(popup.CreateMenuOptions{ + Title: gui.c.Tr.CommandLog, Items: []*popup.MenuItem{ { - DisplayString: gui.Tr.ToggleShowCommandLog, + DisplayString: gui.c.Tr.ToggleShowCommandLog, OnPress: func() error { currentContext := gui.currentStaticContext() if gui.ShowExtrasWindow && currentContext.GetKey() == COMMAND_LOG_CONTEXT_KEY { @@ -22,13 +22,13 @@ func (gui *Gui) handleCreateExtrasMenuPanel() error { } show := !gui.ShowExtrasWindow gui.ShowExtrasWindow = show - gui.Config.GetAppState().HideCommandLog = !show - _ = gui.Config.SaveAppState() + gui.c.GetAppState().HideCommandLog = !show + _ = gui.c.SaveAppState() return nil }, }, { - DisplayString: gui.Tr.FocusCommandLog, + DisplayString: gui.c.Tr.FocusCommandLog, OnPress: gui.handleFocusCommandLog, }, }, @@ -37,8 +37,9 @@ func (gui *Gui) handleCreateExtrasMenuPanel() error { func (gui *Gui) handleFocusCommandLog() error { gui.ShowExtrasWindow = true + // TODO: is this necessary? Can't I just call 'return from context'? gui.State.Contexts.CommandLog.SetParentContext(gui.currentSideContext()) - return gui.pushContext(gui.State.Contexts.CommandLog) + return gui.c.PushContext(gui.State.Contexts.CommandLog) } func (gui *Gui) scrollUpExtra() error { @@ -58,7 +59,7 @@ func (gui *Gui) scrollDownExtra() error { } func (gui *Gui) getCmdWriter() io.Writer { - return &prefixWriter{writer: gui.Views.Extras, prefix: style.FgMagenta.Sprintf("\n\n%s\n", gui.Tr.GitOutput)} + return &prefixWriter{writer: gui.Views.Extras, prefix: style.FgMagenta.Sprintf("\n\n%s\n", gui.c.Tr.GitOutput)} } // Ensures that the first write is preceded by writing a prefix. |