diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index 5f2fd55bfd9..06228e759cb 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -959,3 +959,12 @@ func (gui *Gui) onWorker(f func(gocui.Task) error) { func (gui *Gui) getWindowDimensions(informationStr string, appStatus string) map[string]boxlayout.Dimensions { return gui.helpers.WindowArrangement.GetWindowDimensions(informationStr, appStatus) } + +func (gui *Gui) afterLayout(f func() error) { + select { + case gui.afterLayoutFuncs <- f: + default: + // hopefully this never happens + gui.c.Log.Error("afterLayoutFuncs channel is full, skipping function") + } +} diff --git a/pkg/gui/gui_common.go b/pkg/gui/gui_common.go index a75aa3658fc..434f4b38bfd 100644 --- a/pkg/gui/gui_common.go +++ b/pkg/gui/gui_common.go @@ -189,12 +189,7 @@ func (self *guiCommon) GetInitialKeybindingsWithCustomCommands() ([]*types.Bindi } func (self *guiCommon) AfterLayout(f func() error) { - select { - case self.gui.afterLayoutFuncs <- f: - default: - // hopefully this never happens - self.gui.c.Log.Error("afterLayoutFuncs channel is full, skipping function") - } + self.gui.afterLayout(f) } func (self *guiCommon) RunningIntegrationTest() bool { diff --git a/pkg/gui/main_panels.go b/pkg/gui/main_panels.go index bf30331cd92..49d278399f1 100644 --- a/pkg/gui/main_panels.go +++ b/pkg/gui/main_panels.go @@ -20,7 +20,10 @@ func (gui *Gui) runTaskForView(view *gocui.View, task types.UpdateTask) error { return gui.newCmdTask(view, v.Cmd, v.Prefix) case *types.RunPtyTask: - return gui.newPtyTask(view, v.Cmd, v.Prefix) + gui.afterLayout(func() error { + return gui.newPtyTask(view, v.Cmd, v.Prefix) + }) + return nil } return nil