summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2023-02-11 10:51:49 +1100
committerGitHub <noreply@github.com>2023-02-11 10:51:49 +1100
commit9f71ed6c41cc722982772e9f272d41b94eb49367 (patch)
tree20a3196fa24baab0183aa5c656c18b7bd44ffb07
parentc713d19383f21b1a9bc87a38b3606c44cdd398b6 (diff)
parent984eb95cb7571b009bd06e93a870836439f6a287 (diff)
Merge pull request #2432 from Ryooooooga/remove-unknown-view-error-msg
-rw-r--r--pkg/gui/errors.go3
-rw-r--r--pkg/gui/layout.go4
-rw-r--r--pkg/gui/views.go2
-rw-r--r--pkg/integration/clients/tui.go8
-rw-r--r--pkg/integration/deprecated/cmd/tui/main.go8
5 files changed, 11 insertions, 14 deletions
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"