forked from tslocum/cview
Do not handle right click on List when there is no context menu
This commit is contained in:
parent
41db607cc9
commit
cfce21cc90
|
@ -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
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…
Reference in New Issue