diff --git a/pkg/gui/errors.go b/pkg/gui/errors.go deleted file mode 100644 index 108e4426f..000000000 --- a/pkg/gui/errors.go +++ /dev/null @@ -1,3 +0,0 @@ -package gui - -const UNKNOWN_VIEW_ERROR_MSG = "unknown view" diff --git a/pkg/gui/layout.go b/pkg/gui/layout.go index 5777524f5..0deb37d2e 100644 --- a/pkg/gui/layout.go +++ b/pkg/gui/layout.go @@ -85,7 +85,7 @@ func (gui *Gui) layout(g *gocui.Gui) error { } _, err := setViewFromDimensions(context.GetViewName(), context.GetWindowName()) - if err != nil && err.Error() != UNKNOWN_VIEW_ERROR_MSG { + if err != nil && !gocui.IsUnknownView(err) { return err } } @@ -98,7 +98,7 @@ func (gui *Gui) layout(g *gocui.Gui) error { for _, context := range gui.TransientContexts() { view, err := gui.g.View(context.GetViewName()) - if err != nil && err.Error() != UNKNOWN_VIEW_ERROR_MSG { + if err != nil && !gocui.IsUnknownView(err) { return err } view.Visible = gui.getViewNameForWindow(context.GetWindowName()) == context.GetViewName() diff --git a/pkg/gui/views.go b/pkg/gui/views.go index be9a2952b..5de617876 100644 --- a/pkg/gui/views.go +++ b/pkg/gui/views.go @@ -117,7 +117,7 @@ func (gui *Gui) createAllViews() error { var err error for _, mapping := range gui.orderedViewNameMappings() { *mapping.viewPtr, err = gui.prepareView(mapping.name) - if err != nil && err.Error() != UNKNOWN_VIEW_ERROR_MSG { + if err != nil && !gocui.IsUnknownView(err) { return err } } diff --git a/pkg/integration/clients/tui.go b/pkg/integration/clients/tui.go index b077a22c1..e6b3f53cf 100644 --- a/pkg/integration/clients/tui.go +++ b/pkg/integration/clients/tui.go @@ -298,7 +298,7 @@ func (self *app) layout(g *gocui.Gui) error { g.FgColor = gocui.ColorGreen listView, err := g.SetView("list", 0, 0, maxX-1, maxY-descriptionViewHeight-keybindingsViewHeight-editorViewHeight-1, 0) if err != nil { - if err.Error() != "unknown view" { + if !gocui.IsUnknownView(err) { return err } @@ -317,7 +317,7 @@ func (self *app) layout(g *gocui.Gui) error { descriptionView, err := g.SetViewBeneath("description", "list", descriptionViewHeight) if err != nil { - if err.Error() != "unknown view" { + if !gocui.IsUnknownView(err) { return err } descriptionView.Title = "Test description" @@ -327,7 +327,7 @@ func (self *app) layout(g *gocui.Gui) error { keybindingsView, err := g.SetViewBeneath("keybindings", "description", keybindingsViewHeight) if err != nil { - if err.Error() != "unknown view" { + if !gocui.IsUnknownView(err) { return err } keybindingsView.Title = "Keybindings" @@ -338,7 +338,7 @@ func (self *app) layout(g *gocui.Gui) error { editorView, err := g.SetViewBeneath("editor", "keybindings", editorViewHeight) if err != nil { - if err.Error() != "unknown view" { + if !gocui.IsUnknownView(err) { return err } diff --git a/pkg/integration/deprecated/cmd/tui/main.go b/pkg/integration/deprecated/cmd/tui/main.go index 136ed29fe..a36ac5585 100644 --- a/pkg/integration/deprecated/cmd/tui/main.go +++ b/pkg/integration/deprecated/cmd/tui/main.go @@ -344,7 +344,7 @@ func (app *App) layout(g *gocui.Gui) error { g.FgColor = gocui.ColorGreen listView, err := g.SetView("list", 0, 0, maxX-1, maxY-descriptionViewHeight-keybindingsViewHeight-editorViewHeight-1, 0) if err != nil { - if err.Error() != "unknown view" { + if !gocui.IsUnknownView(err) { return err } listView.Highlight = true @@ -361,7 +361,7 @@ func (app *App) layout(g *gocui.Gui) error { descriptionView, err := g.SetViewBeneath("description", "list", descriptionViewHeight) if err != nil { - if err.Error() != "unknown view" { + if !gocui.IsUnknownView(err) { return err } descriptionView.Title = "Test description" @@ -371,7 +371,7 @@ func (app *App) layout(g *gocui.Gui) error { keybindingsView, err := g.SetViewBeneath("keybindings", "description", keybindingsViewHeight) if err != nil { - if err.Error() != "unknown view" { + if !gocui.IsUnknownView(err) { return err } keybindingsView.Title = "Keybindings" @@ -382,7 +382,7 @@ func (app *App) layout(g *gocui.Gui) error { editorView, err := g.SetViewBeneath("editor", "keybindings", editorViewHeight) if err != nil { - if err.Error() != "unknown view" { + if !gocui.IsUnknownView(err) { return err } editorView.Title = "Enter Name"