diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2021-04-05 00:31:52 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2021-04-06 19:34:32 +1000 |
commit | 39ae122304868a4de60659291e9220b4bab2dde1 (patch) | |
tree | 41a86ece1287aed985015a3c17949af52735945e /pkg/gui/tasks_adapter.go | |
parent | c34c6926d5e1f5a49b90b7a8979bbb0919f00f38 (diff) |
more refactoring
Diffstat (limited to 'pkg/gui/tasks_adapter.go')
-rw-r--r-- | pkg/gui/tasks_adapter.go | 30 |
1 files changed, 5 insertions, 25 deletions
diff --git a/pkg/gui/tasks_adapter.go b/pkg/gui/tasks_adapter.go index 8df7acd3e..bc2fb8a24 100644 --- a/pkg/gui/tasks_adapter.go +++ b/pkg/gui/tasks_adapter.go @@ -8,17 +8,12 @@ import ( "github.com/jesseduffield/lazygit/pkg/tasks" ) -func (gui *Gui) newCmdTask(viewName string, cmd *exec.Cmd, prefix string) error { +func (gui *Gui) newCmdTask(view *gocui.View, cmd *exec.Cmd, prefix string) error { gui.Log.WithField( "command", strings.Join(cmd.Args, " "), ).Debug("RunCommand") - view, err := gui.g.View(viewName) - if err != nil { - return nil // swallowing for now - } - _, height := view.Size() _, oy := view.Origin() @@ -41,12 +36,7 @@ func (gui *Gui) newCmdTask(viewName string, cmd *exec.Cmd, prefix string) error return nil } -func (gui *Gui) newTask(viewName string, f func(chan struct{}) error) error { - view, err := gui.g.View(viewName) - if err != nil { - return nil // swallowing for now - } - +func (gui *Gui) newTask(view *gocui.View, f func(chan struct{}) error) error { manager := gui.getManager(view) if err := manager.NewTask(f); err != nil { @@ -56,16 +46,11 @@ func (gui *Gui) newTask(viewName string, f func(chan struct{}) error) error { return nil } -func (gui *Gui) newStringTask(viewName string, str string) error { - view, err := gui.g.View(viewName) - if err != nil { - return nil // swallowing for now - } - +func (gui *Gui) newStringTask(view *gocui.View, str string) error { manager := gui.getManager(view) f := func(stop chan struct{}) error { - gui.renderString(viewName, str) + gui.renderString(view, str) return nil } @@ -76,12 +61,7 @@ func (gui *Gui) newStringTask(viewName string, str string) error { return nil } -func (gui *Gui) newStringTaskWithoutScroll(viewName string, str string) error { - view, err := gui.g.View(viewName) - if err != nil { - return nil // swallowing for now - } - +func (gui *Gui) newStringTaskWithoutScroll(view *gocui.View, str string) error { manager := gui.getManager(view) f := func(stop chan struct{}) error { |