This fixes a bug where we would show `cmd-e` instead of `cmd-f` for
`Edit -> Find` because both bindings would have the `buffer_search::Deploy`
action and we were mistakenly selecting the former.
We do so by replacing `EventHandler::capture` with a new `::capture_all` method.
After switching to mouse regions as part of zed-industries/zed#1081, overriding
`dispatch_event` on `EventHandler` wasn't enough anymore because mouse interactions
take place on a privileged code path that runs *before* dispatching any event.
With this change, `EventHandler` will now push a mouse region that intercepts all
mouse interactions, as well as pushing a cursor region that resets the cursor style
to `Arrow`.
One interesting change as part of this is that we've removed the ability to see which
event we are capturing: we were not using this capability anyway and `capture_all` provides
a simpler interface, so I went with that. In the future, we can opt into capturing specific
events or mouse interactions if there's a code path that needs that.
Now you simply specify a text, an action and a style and GPUI will
take of rendering it properly. This is simpler compared to always
providing a custom element and should make tooltip more consistent
across the UI.
These will fire whenever the left/right mouse button is pressed down outside a specific region. I'll use these to cancel the context menu in the next commit.
We now always have a RenderContext when rendering MouseEventHandlers or scrollable Flex columns/rows.
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
If for some reason the handle got dropped and we call it, we'll deal with it somewhat gracefully.
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
In some cases, we need to render during layout. Previously, we were rendering with a LayoutContext in some cases, but this commit adds the ability to retrieve a render context with a given handle and we use that feature in UniformList.
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>