1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-01-20 05:19:24 +02:00

chore: remove UNKNOWN_VIEW_ERROR_MSG

This commit is contained in:
Ryooooooga 2023-02-10 21:23:48 +09:00
parent c713d19383
commit 984eb95cb7
No known key found for this signature in database
GPG Key ID: 07CF200DFCC20C25
5 changed files with 11 additions and 14 deletions

View File

@ -1,3 +0,0 @@
package gui
const UNKNOWN_VIEW_ERROR_MSG = "unknown view"

View File

@ -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()

View File

@ -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
}
}

View File

@ -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
}

View File

@ -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"