From 4b0432423d9bb28b4de448b7c1a16cad17e1150f Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Tue, 8 Aug 2023 21:50:10 +1000 Subject: [PATCH] Reset origin when clearing view --- .../controllers/workspace_reset_controller.go | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/pkg/gui/controllers/workspace_reset_controller.go b/pkg/gui/controllers/workspace_reset_controller.go index 6b78c6ac9..5f3a9c6b9 100644 --- a/pkg/gui/controllers/workspace_reset_controller.go +++ b/pkg/gui/controllers/workspace_reset_controller.go @@ -38,7 +38,9 @@ func (self *FilesController) createResetMenu() error { self.animateExplosion() } - return self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC, Scope: []types.RefreshableView{types.FILES}}) + return self.c.Refresh( + types.RefreshOptions{Mode: types.ASYNC, Scope: []types.RefreshableView{types.FILES}}, + ) }, Key: 'x', Tooltip: self.c.Tr.NukeDescription, @@ -54,7 +56,9 @@ func (self *FilesController) createResetMenu() error { return self.c.Error(err) } - return self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC, Scope: []types.RefreshableView{types.FILES}}) + return self.c.Refresh( + types.RefreshOptions{Mode: types.ASYNC, Scope: []types.RefreshableView{types.FILES}}, + ) }, Key: 'u', }, @@ -69,7 +73,9 @@ func (self *FilesController) createResetMenu() error { return self.c.Error(err) } - return self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC, Scope: []types.RefreshableView{types.FILES}}) + return self.c.Refresh( + types.RefreshOptions{Mode: types.ASYNC, Scope: []types.RefreshableView{types.FILES}}, + ) }, Key: 'c', }, @@ -91,7 +97,9 @@ func (self *FilesController) createResetMenu() error { return self.c.Error(err) } - return self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC, Scope: []types.RefreshableView{types.FILES}}) + return self.c.Refresh( + types.RefreshOptions{Mode: types.ASYNC, Scope: []types.RefreshableView{types.FILES}}, + ) }, Key: 'S', }, @@ -106,7 +114,9 @@ func (self *FilesController) createResetMenu() error { return self.c.Error(err) } - return self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC, Scope: []types.RefreshableView{types.FILES}}) + return self.c.Refresh( + types.RefreshOptions{Mode: types.ASYNC, Scope: []types.RefreshableView{types.FILES}}, + ) }, Key: 's', }, @@ -121,7 +131,9 @@ func (self *FilesController) createResetMenu() error { return self.c.Error(err) } - return self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC, Scope: []types.RefreshableView{types.FILES}}) + return self.c.Refresh( + types.RefreshOptions{Mode: types.ASYNC, Scope: []types.RefreshableView{types.FILES}}, + ) }, Key: 'm', }, @@ -136,7 +148,9 @@ func (self *FilesController) createResetMenu() error { return self.c.Error(err) } - return self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC, Scope: []types.RefreshableView{types.FILES}}) + return self.c.Refresh( + types.RefreshOptions{Mode: types.ASYNC, Scope: []types.RefreshableView{types.FILES}}, + ) }, Key: 'h', }, @@ -173,6 +187,7 @@ func (self *FilesController) Explode(v *gocui.View, onDone func()) { style := styles[(i*len(styles)/max)%len(styles)] coloredImage := style.Sprint(image) self.c.OnUIThread(func() error { + _ = v.SetOrigin(0, 0) v.SetContent(coloredImage) return nil })