Browse Source

Do not handle right click on List when there is no context menu

merge-requests/3/head
Trevor Slocum 2 years ago
parent
commit
cfce21cc90
  1. 1
      CHANGELOG
  2. 13
      list.go

1
CHANGELOG

@ -2,6 +2,7 @@ v1.4.6 (WIP)
- Add List.GetOffset, List.SetOffset and List.SetSelectedTextAttributes
- Add Vim-style keybindings to List
- Fix List not updating selected item before calling selected handlers
- Do not handle right click on List when there is no context menu
v1.4.5 (2020-04-25)
- Add multithreading support

13
list.go

@ -1073,6 +1073,11 @@ func (l *List) MouseHandler() func(action MouseAction, event *tcell.EventMouse,
return
}
case MouseRightDown:
if l.ContextMenu.list == nil || len(l.ContextMenu.list.items) == 0 {
l.Unlock()
return
}
x, y := event.Position()
index := l.indexAtPoint(event.Position())
@ -1088,12 +1093,8 @@ func (l *List) MouseHandler() func(action MouseAction, event *tcell.EventMouse,
}
}
if l.ContextMenu.list != nil && len(l.ContextMenu.list.items) > 0 {
l.ContextMenu.drag = true
defer l.ContextMenu.show(l.currentItem, x, y, setFocus)
} else {
defer l.MouseHandler()(MouseLeftClick, event, setFocus)
}
defer l.ContextMenu.show(l.currentItem, x, y, setFocus)
l.ContextMenu.drag = true
consumed = true
case MouseMove:
if l.hover {

Loading…
Cancel
Save