From 2e69b7385a37df55e0c2ef4d1c0054898bed05a1 Mon Sep 17 00:00:00 2001 From: Oliver <480930+rivo@users.noreply.github.com> Date: Fri, 16 Sep 2022 10:15:18 +0200 Subject: [PATCH] Fixed mouse handling bug for drop-downs. Removed 404s from readme. Fixed #761 --- README.md | 5 +---- dropdown.go | 7 +++++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 76002f6..7f71e25 100644 --- a/README.md +++ b/README.md @@ -54,10 +54,8 @@ For a presentation highlighting this package, compile and run the program found - [IRCCloud Terminal Client](https://github.com/termoose/irccloud) - [Window manager for `tview`](https://github.com/epiclabs-io/winman) -- [Password manager](https://github.com/7onetella/password) - [CLI bookmark manager](https://github.com/Endi1/drawer) - [A caving database interface written in Go](https://github.com/IdlePhysicist/cave-logger) -- [App for rental of electic bikes](https://github.com/MrDienns/bike-commerce) - [Interactive file browse and exec any command.](https://github.com/bannzai/itree) - [A simple CRM](https://github.com/broadcastle/crm) - [Terminal UI for todist](https://github.com/cyberdummy/todoista) @@ -82,7 +80,6 @@ For a presentation highlighting this package, compile and run the program found - [A simple Kanban board for your terminal](https://github.com/witchard/toukan) - [The personal information dashboard for your terminal. ](https://github.com/wtfutil/wtf) - [MySQL database to Golang struct](https://github.com/xxjwxc/gormt) -- [Cryptowatch Go SDK](https://github.com/y3sh/cw-sdk-go) - [Discord, TUI and SIXEL.](https://gitlab.com/diamondburned/6cord) - [A CLI Audio Player](https://www.github.com/dhulihan/grump) - [GLab, a GitLab CLI tool](https://gitlab.com/profclems/glab) @@ -104,7 +101,7 @@ For a presentation highlighting this package, compile and run the program found - [tvxwidgets: tview extra widgets](https://github.com/navidys/tvxwidgets) - [Domino card game on terminal](https://github.com/gusti-andika/card-domino.git) - [goaround: Query stackoverflow API and get results on terminal](https://github.com/glendsoza/goaround) -- [resto: 🔗 a CLI app can send pretty HTTP & API requests with TUI](https://github.com/abdfnx/resto) +- [resto: a CLI app can send pretty HTTP & API requests with TUI](https://github.com/abdfnx/resto) - [twad: a WAD launcher for the terminal](https://github.com/zmnpl/twad) - [pacseek: A TUI for searching and installing Arch Linux packages](https://github.com/moson-mo/pacseek) - [7GUIs demo](https://github.com/letientai299/7guis/tree/master/tui) diff --git a/dropdown.go b/dropdown.go index 6f86903..984d97b 100644 --- a/dropdown.go +++ b/dropdown.go @@ -547,7 +547,11 @@ func (d *DropDown) MouseHandler() func(action MouseAction, event *tcell.EventMou return d.InRect(x, y), nil // No, and it's not expanded either. Ignore. } - // Handle dragging. Clicks are implicitly handled by this logic. + // As long as the drop-down is open, we capture all mouse events. + if d.open { + capture = d + } + switch action { case MouseLeftDown: consumed = d.open || inRect @@ -564,7 +568,6 @@ func (d *DropDown) MouseHandler() func(action MouseAction, event *tcell.EventMou // dragging. Because we don't act upon it, it's not a problem. d.list.MouseHandler()(MouseLeftClick, event, setFocus) consumed = true - capture = d } case MouseLeftUp: if d.dragging {