mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-03-29 22:07:13 +02:00
ignore clicks on invisible views
This commit is contained in:
parent
121b9d0715
commit
4c73d070ac
11
vendor/github.com/jesseduffield/gocui/gui.go
generated
vendored
11
vendor/github.com/jesseduffield/gocui/gui.go
generated
vendored
@ -347,15 +347,20 @@ func (g *Gui) View(name string) (*View, error) {
|
||||
return nil, errors.Wrap(ErrUnknownView, 0)
|
||||
}
|
||||
|
||||
// ViewByPosition returns a pointer to a view matching the given position, or
|
||||
// VisibleViewByPosition returns a pointer to a view matching the given position, or
|
||||
// error ErrUnknownView if a view in that position does not exist.
|
||||
func (g *Gui) ViewByPosition(x, y int) (*View, error) {
|
||||
func (g *Gui) VisibleViewByPosition(x, y int) (*View, error) {
|
||||
g.Mutexes.ViewsMutex.Lock()
|
||||
defer g.Mutexes.ViewsMutex.Unlock()
|
||||
|
||||
// traverse views in reverse order checking top views first
|
||||
for i := len(g.views); i > 0; i-- {
|
||||
v := g.views[i-1]
|
||||
|
||||
if !v.Visible {
|
||||
continue
|
||||
}
|
||||
|
||||
frameOffset := 0
|
||||
if v.Frame {
|
||||
frameOffset = 1
|
||||
@ -1042,7 +1047,7 @@ func (g *Gui) onKey(ev *GocuiEvent) error {
|
||||
|
||||
case eventMouse:
|
||||
mx, my := ev.MouseX, ev.MouseY
|
||||
v, err := g.ViewByPosition(mx, my)
|
||||
v, err := g.VisibleViewByPosition(mx, my)
|
||||
if err != nil {
|
||||
break
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user