diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2023-03-21 20:57:52 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2023-04-30 13:19:53 +1000 |
commit | 509e3efa70512ed34b90177eb17d6481664bb958 (patch) | |
tree | 663333126d6764706462271712583e4c8e93d786 /pkg/gui/editors.go | |
parent | 8edad826caf2fa48bfad33f9f8c4f3ba49a052da (diff) |
lots more refactoring
Diffstat (limited to 'pkg/gui/editors.go')
-rw-r--r-- | pkg/gui/editors.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/pkg/gui/editors.go b/pkg/gui/editors.go index 9e00f8351..4325a56f4 100644 --- a/pkg/gui/editors.go +++ b/pkg/gui/editors.go @@ -71,12 +71,12 @@ func (gui *Gui) commitMessageEditor(v *gocui.View, key gocui.Key, ch rune, mod g // This function is called again on refresh as part of the general resize popup call, // but we need to call it here so that when we go to render the text area it's not // considered out of bounds to add a newline, meaning we can avoid unnecessary scrolling. - err := gui.resizePopupPanel(v, v.TextArea.GetContent()) + err := gui.helpers.Confirmation.ResizePopupPanel(v, v.TextArea.GetContent()) if err != nil { gui.c.Log.Error(err) } v.RenderTextArea() - gui.RenderCommitLength() + gui.State.Contexts.CommitMessage.RenderCommitLength() return matched } @@ -86,11 +86,12 @@ func (gui *Gui) defaultEditor(v *gocui.View, key gocui.Key, ch rune, mod gocui.M v.RenderTextArea() - if gui.findSuggestions != nil { + suggestionsContext := gui.State.Contexts.Suggestions + if suggestionsContext.State.FindSuggestions != nil { input := v.TextArea.GetContent() - gui.suggestionsAsyncHandler.Do(func() func() { - suggestions := gui.findSuggestions(input) - return func() { gui.setSuggestions(suggestions) } + suggestionsContext.State.AsyncHandler.Do(func() func() { + suggestions := suggestionsContext.State.FindSuggestions(input) + return func() { suggestionsContext.SetSuggestions(suggestions) } }) } |