Skip to content

Commit

Permalink
Merge pull request #64 from jesseduffield/reduce-error-handling
Browse files Browse the repository at this point in the history
Reduce error handling
  • Loading branch information
stefanhaller authored Sep 6, 2024
2 parents 0fc91d5 + a642862 commit bfab49c
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 97 deletions.
16 changes: 5 additions & 11 deletions gui.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,8 @@ func (g *Gui) SetView(name string, x0, y0, x1, y1 int, overlaps byte) (*View, er
newViewCursorX, newOriginX := updatedCursorAndOrigin(0, v.InnerWidth(), cursorX)
newViewCursorY, newOriginY := updatedCursorAndOrigin(0, v.InnerHeight(), cursorY)

_ = v.SetCursor(newViewCursorX, newViewCursorY)
_ = v.SetOrigin(newOriginX, newOriginY)
v.SetCursor(newViewCursorX, newViewCursorY)
v.SetOrigin(newOriginX, newOriginY)
}
}

Expand Down Expand Up @@ -1204,9 +1204,7 @@ func (g *Gui) ForceRedrawViews(views ...*View) error {
}

for _, v := range views {
if err := v.draw(); err != nil {
return err
}
v.draw()
}

Screen.Show()
Expand Down Expand Up @@ -1252,9 +1250,7 @@ func (g *Gui) draw(v *View) error {
Screen.HideCursor()
}

if err := v.draw(); err != nil {
return err
}
v.draw()

if v.Frame {
var fgColor, bgColor, frameColor Attribute
Expand Down Expand Up @@ -1360,9 +1356,7 @@ func (g *Gui) onKey(ev *GocuiEvent) error {
}
}
if !IsMouseScrollKey(ev.Key) {
if err := v.SetCursor(newCx, newCy); err != nil {
return err
}
v.SetCursor(newCx, newCy)
if v.Editable {
v.TextArea.SetCursor2D(newX, newY)

Expand Down
Loading

0 comments on commit bfab49c

Please sign in to comment.