diff --git a/gui.go b/gui.go index 6f7b35e8..f0864cf1 100644 --- a/gui.go +++ b/gui.go @@ -233,7 +233,11 @@ func (g *Gui) ViewByPosition(x, y int) (*View, error) { // traverse views in reverse order checking top views first for i := len(g.views); i > 0; i-- { v := g.views[i-1] - if x > v.x0 && x < v.x1 && y > v.y0 && y < v.y1 { + frameOffset := 0 + if v.Frame { + frameOffset = 1 + } + if x > v.x0-frameOffset && x < v.x1+frameOffset && y > v.y0-frameOffset && y < v.y1+frameOffset { return v, nil } } diff --git a/view.go b/view.go index 21742ab8..043231af 100644 --- a/view.go +++ b/view.go @@ -196,7 +196,7 @@ func (v *View) setRune(x, y int, ch rune, fgColor, bgColor Attribute) error { func (v *View) SetCursor(x, y int) error { maxX, maxY := v.Size() if x < 0 || x >= maxX || y < 0 || y >= maxY { - return errors.New("invalid point") + return nil } v.cx = x v.cy = y