1
0
mirror of https://github.com/rivo/tview.git synced 2025-04-24 13:48:56 +08:00

Don't focus text views in forms. Fixes #797

This commit is contained in:
Oliver 2023-02-08 22:13:50 +01:00
parent c1eadf1b0b
commit 7dfff1ce78

View File

@ -761,6 +761,12 @@ func (f *Form) MouseHandler() func(action MouseAction, event *tcell.EventMouse,
// Determine items to pass mouse events to.
for _, item := range f.items {
// Exclude TextView items from mouse-down events as they are
// read-only items and thus should not be focused.
if _, ok := item.(*TextView); ok && action == MouseLeftDown {
continue
}
consumed, capture = item.MouseHandler()(action, event, setFocus)
if consumed {
return