diff options
Diffstat (limited to 'termui')
-rw-r--r-- | termui/bug_table.go | 17 | ||||
-rw-r--r-- | termui/input_popup.go | 3 | ||||
-rw-r--r-- | termui/label_select.go | 9 | ||||
-rw-r--r-- | termui/msg_popup.go | 5 | ||||
-rw-r--r-- | termui/show_bug.go | 15 |
5 files changed, 27 insertions, 22 deletions
diff --git a/termui/bug_table.go b/termui/bug_table.go index 94185a29..f3f8b2f3 100644 --- a/termui/bug_table.go +++ b/termui/bug_table.go @@ -2,6 +2,7 @@ package termui import ( "bytes" + "errors" "fmt" "strings" @@ -69,7 +70,7 @@ func (bt *bugTable) layout(g *gocui.Gui) error { v, err := g.SetView(bugTableHeaderView, -1, -1, maxX, 1, 0) if err != nil { - if !gocui.IsUnknownView(err) { + if !errors.Is(err, gocui.ErrUnknownView) { return err } @@ -82,7 +83,7 @@ func (bt *bugTable) layout(g *gocui.Gui) error { v, err = g.SetView(bugTableView, -1, 0, maxX, maxY-3, 0) if err != nil { - if !gocui.IsUnknownView(err) { + if !errors.Is(err, gocui.ErrUnknownView) { return err } @@ -108,7 +109,7 @@ func (bt *bugTable) layout(g *gocui.Gui) error { v, err = g.SetView(bugTableFooterView, -1, maxY-4, maxX, maxY, 0) if err != nil { - if !gocui.IsUnknownView(err) { + if !errors.Is(err, gocui.ErrUnknownView) { return err } @@ -121,7 +122,7 @@ func (bt *bugTable) layout(g *gocui.Gui) error { v, err = g.SetView(bugTableInstructionView, -1, maxY-2, maxX, maxY, 0) if err != nil { - if !gocui.IsUnknownView(err) { + if !errors.Is(err, gocui.ErrUnknownView) { return err } @@ -221,16 +222,16 @@ func (bt *bugTable) keybindings(g *gocui.Gui) error { } func (bt *bugTable) disable(g *gocui.Gui) error { - if err := g.DeleteView(bugTableView); err != nil && !gocui.IsUnknownView(err) { + if err := g.DeleteView(bugTableView); err != nil && !errors.Is(err, gocui.ErrUnknownView) { return err } - if err := g.DeleteView(bugTableHeaderView); err != nil && !gocui.IsUnknownView(err) { + if err := g.DeleteView(bugTableHeaderView); err != nil && !errors.Is(err, gocui.ErrUnknownView) { return err } - if err := g.DeleteView(bugTableFooterView); err != nil && !gocui.IsUnknownView(err) { + if err := g.DeleteView(bugTableFooterView); err != nil && !errors.Is(err, gocui.ErrUnknownView) { return err } - if err := g.DeleteView(bugTableInstructionView); err != nil && !gocui.IsUnknownView(err) { + if err := g.DeleteView(bugTableInstructionView); err != nil && !errors.Is(err, gocui.ErrUnknownView) { return err } return nil diff --git a/termui/input_popup.go b/termui/input_popup.go index 3ff9b5bf..a60b1c04 100644 --- a/termui/input_popup.go +++ b/termui/input_popup.go @@ -1,6 +1,7 @@ package termui import ( + "errors" "io/ioutil" "github.com/awesome-gocui/gocui" @@ -48,7 +49,7 @@ func (ip *inputPopup) layout(g *gocui.Gui) error { v, err := g.SetView(inputPopupView, x0, y0, x0+width, y0+height, 0) if err != nil { - if !gocui.IsUnknownView(err) { + if !errors.Is(err, gocui.ErrUnknownView) { return err } diff --git a/termui/label_select.go b/termui/label_select.go index dfba20a6..d5ea5bd3 100644 --- a/termui/label_select.go +++ b/termui/label_select.go @@ -1,6 +1,7 @@ package termui import ( + "errors" "fmt" "strings" @@ -114,7 +115,7 @@ func (ls *labelSelect) layout(g *gocui.Gui) error { v, err := g.SetView(labelSelectView, x0, 0, x0+width, maxY-2, 0) if err != nil { - if !gocui.IsUnknownView(err) { + if !errors.Is(err, gocui.ErrUnknownView) { return err } @@ -124,7 +125,7 @@ func (ls *labelSelect) layout(g *gocui.Gui) error { for i, label := range ls.labels { viewname := fmt.Sprintf("labeledit%d", i) v, err := g.SetView(viewname, x0+2, y0, x0+width+2, y0+2, 0) - if err != nil && !gocui.IsUnknownView(err) { + if err != nil && !errors.Is(err, gocui.ErrUnknownView) { return err } ls.childViews = append(ls.childViews, viewname) @@ -146,7 +147,7 @@ func (ls *labelSelect) layout(g *gocui.Gui) error { v, err = g.SetView(labelSelectInstructionsView, -1, maxY-2, maxX, maxY, 0) ls.childViews = append(ls.childViews, labelSelectInstructionsView) if err != nil { - if !gocui.IsUnknownView(err) { + if !errors.Is(err, gocui.ErrUnknownView) { return err } v.Frame = false @@ -165,7 +166,7 @@ func (ls *labelSelect) layout(g *gocui.Gui) error { func (ls *labelSelect) disable(g *gocui.Gui) error { for _, view := range ls.childViews { - if err := g.DeleteView(view); err != nil && !gocui.IsUnknownView(err) { + if err := g.DeleteView(view); err != nil && !errors.Is(err, gocui.ErrUnknownView) { return err } } diff --git a/termui/msg_popup.go b/termui/msg_popup.go index d0e31634..c8db2df4 100644 --- a/termui/msg_popup.go +++ b/termui/msg_popup.go @@ -1,9 +1,10 @@ package termui import ( + "errors" "fmt" - "github.com/MichaelMure/go-term-text" + text "github.com/MichaelMure/go-term-text" "github.com/awesome-gocui/gocui" ) @@ -52,7 +53,7 @@ func (ep *msgPopup) layout(g *gocui.Gui) error { v, err := g.SetView(msgPopupView, x0, y0, x0+width, y0+height, 0) if err != nil { - if !gocui.IsUnknownView(err) { + if !errors.Is(err, gocui.ErrUnknownView) { return err } diff --git a/termui/show_bug.go b/termui/show_bug.go index 0710fa34..528d1fa5 100644 --- a/termui/show_bug.go +++ b/termui/show_bug.go @@ -2,10 +2,11 @@ package termui import ( "bytes" + "errors" "fmt" "strings" - "github.com/MichaelMure/go-term-text" + text "github.com/MichaelMure/go-term-text" "github.com/awesome-gocui/gocui" "github.com/MichaelMure/git-bug/bug" @@ -61,7 +62,7 @@ func (sb *showBug) layout(g *gocui.Gui) error { v, err := g.SetView(showBugView, 0, 0, maxX*2/3, maxY-2, 0) if err != nil { - if !gocui.IsUnknownView(err) { + if !errors.Is(err, gocui.ErrUnknownView) { return err } @@ -78,7 +79,7 @@ func (sb *showBug) layout(g *gocui.Gui) error { v, err = g.SetView(showBugSidebarView, maxX*2/3+1, 0, maxX-1, maxY-2, 0) if err != nil { - if !gocui.IsUnknownView(err) { + if !errors.Is(err, gocui.ErrUnknownView) { return err } @@ -95,7 +96,7 @@ func (sb *showBug) layout(g *gocui.Gui) error { v, err = g.SetView(showBugInstructionView, -1, maxY-2, maxX, maxY, 0) if err != nil { - if !gocui.IsUnknownView(err) { + if !errors.Is(err, gocui.ErrUnknownView) { return err } @@ -199,7 +200,7 @@ func (sb *showBug) keybindings(g *gocui.Gui) error { func (sb *showBug) disable(g *gocui.Gui) error { for _, view := range sb.childViews { - if err := g.DeleteView(view); err != nil && !gocui.IsUnknownView(err) { + if err := g.DeleteView(view); err != nil && !errors.Is(err, gocui.ErrUnknownView) { return err } } @@ -384,7 +385,7 @@ func emptyMessagePlaceholder() string { func (sb *showBug) createOpView(g *gocui.Gui, name string, x0 int, y0 int, maxX int, height int, selectable bool) (*gocui.View, error) { v, err := g.SetView(name, x0, y0, maxX, y0+height+1, 0) - if err != nil && !gocui.IsUnknownView(err) { + if err != nil && !errors.Is(err, gocui.ErrUnknownView) { return nil, err } @@ -404,7 +405,7 @@ func (sb *showBug) createOpView(g *gocui.Gui, name string, x0 int, y0 int, maxX func (sb *showBug) createSideView(g *gocui.Gui, name string, x0 int, y0 int, maxX int, height int) (*gocui.View, error) { v, err := g.SetView(name, x0, y0, maxX, y0+height+1, 0) - if err != nil && !gocui.IsUnknownView(err) { + if err != nil && !errors.Is(err, gocui.ErrUnknownView) { return nil, err } |