Commit Graph
73 Commits
Author SHA1 Message Date
Keith Simmons a477733bcb Address hover panic and add hint to install go when language server failed to install 2022-06-27 15:48:15 -07:00
Antonio Scandurra 01349e1d42 Fix panic when Text contained carriage returns 2022-06-23 10:21:21 +02:00
Max Brunsfeld 2c61bc2b1f Always use capital letters when rendering a keystroke 2022-06-16 17:48:10 -07:00
Antonio Scandurra 516bd13474 Add tooltip to follow collaborators 2022-06-15 17:08:39 +02:00
Antonio Scandurra 8a146e49ca Use a different fit mode for tooltips 2022-06-15 16:45:04 +02:00
Antonio Scandurra ea8b5016f7 Snap overlay's bottom/right edge to same window's edge on overflow 2022-06-09 13:48:02 +02:00
Antonio Scandurra a26af194e7 Use visible bounds to determine hit bounds for cursor/mouse regions 2022-06-08 10:17:22 +02:00
Keith Simmons a6c0ee472c Add vim bindings for hover
Allow scrolling in hover popover
2022-06-07 13:07:53 -07:00
Antonio Scandurra 74aa9c1320 Capture mouse events when rendering disconnected overlay
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.
2022-06-04 10:41:29 +02:00
Antonio Scandurra 701e2090cd Align context menu to fit within the window bounds 2022-06-02 09:47:06 +02:00
Antonio Scandurra cc028cca78 Simplify usage of tooltip
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.
2022-06-02 09:12:50 +02:00
Antonio Scandurra 0e1307fb23 📝 2022-06-01 10:18:10 +02:00
Antonio Scandurra 238827642a Align tooltip based on the available window space 2022-06-01 10:03:46 +02:00
Antonio Scandurra 982de971fa Introduce a new Tooltip element and a with_tooltip helper 2022-06-01 09:55:25 +02:00
Antonio Scandurra 94fc28b29d WIP: start on tooltips 2022-05-31 19:00:44 +02:00
Antonio Scandurra e067212ad4 Always re-render visible elements in List 2022-05-31 09:52:44 +02:00
Antonio Scandurra f832c0074f Fix memory leak in ListState 2022-05-30 18:29:51 +02:00
Antonio Scandurra 6c145b2abc Show keystrokes as uppercase 2022-05-30 12:23:03 +02:00
Antonio Scandurra e7ab61d125 Dismiss context menu when (right-)mousing down outside of it 2022-05-28 08:51:46 +02:00
Nathan Sobo 44c8ee5709 Add mouse down out handlers
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.
2022-05-27 12:56:44 -06:00
Nathan Sobo c3baf2748f Block hovering behind overlays 2022-05-27 11:54:51 -06:00
Antonio Scandurra 9099c40364 Merge branch 'mouse-events' into project-panel-context-menu 2022-05-27 12:07:00 +02:00
Antonio Scandurra 1d7fc12229 Add right-click support to MouseEventHandler 2022-05-27 10:47:54 +02:00
Nathan Sobo aedfd74d30 Use the hit bounds when painting mouse regions 2022-05-26 20:05:20 -06:00
Nathan SoboandMax Brunsfeld 893f15ddab Switch MouseEventHandler to use MouseRegions
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-05-26 20:00:01 -06:00
Nathan SoboandMax Brunsfeld bd62a68234 Eliminate ElementStateContext trait
We now always have a RenderContext when rendering MouseEventHandlers or scrollable Flex columns/rows.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-05-26 18:37:28 -06:00
Nathan SoboandMax Brunsfeld b6b16fc9c3 In UniformList, guard against misbehavior of append_items
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>
2022-05-26 18:30:28 -06:00
Nathan SoboandMax Brunsfeld 8dd82fdce1 Take a RenderContext in ListState's build item callback
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-05-26 18:23:44 -06:00
Nathan SoboandMax Brunsfeld 2ea085b178 Pass a RenderContext to UniformList
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>
2022-05-26 18:03:34 -06:00
Nathan SoboandAntonio Scandurra 0866f0ed55 Introduce CursorRegion struct
This will blend in with an upcoming MouseRegion struct that sits next to it in the scene.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-05-26 11:00:10 -06:00
Antonio Scandurra 580f1a4125 Style context menu 2022-05-26 10:40:53 +02:00
Antonio Scandurra a8483ba458 WIP 2022-05-26 09:59:25 +02:00
Antonio ScandurraandNathan Sobo 3b2f1644fb Constrain context menu to the width of the widest item
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-05-26 09:59:25 +02:00
Nathan Sobo b110fd5fb7 Render a context menu when right-clicking in project panel
It doesn't currently do anything, but I managed to get it rendering in an absolutely positioned way.
2022-05-26 09:59:25 +02:00
Max Brunsfeld ef0b584532 Remove AppState from workspace actions
This allows those actions to be bound to keystrokes in the keymap.
Also, remove the WorkspaceParams struct, simplify how Workspaces are
constructed.
2022-05-19 14:37:26 -07:00
Antonio ScandurraandNathan Sobo 933a1f2cd6 Show badge when there are pending contact requests
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-05-11 17:39:03 +02:00
Nathan SoboandAntonio Scandurra eef99f059d Make flex elements fill available space when they contain a float
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-05-10 06:14:30 -06:00
Antonio Scandurra 95d848fe1e Ensure flex_float works even when re-painting without layout
Previously, we were mutating the remaining space stored on the layout
state, which would cause re-paints to always have a `remaining_space`
of 0 and therefore not align `flex_float` elements to the right/bottom.
2022-05-06 10:20:03 +02:00
Antonio Scandurra 61346f734d WIP 2022-05-05 15:15:58 +02:00
Nathan SoboandAntonio Scandurra 92f040df00 Apply cursor styles during paint
This makes the editor's cursor an IBeam and properly deals with nested cursor styles.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-04-22 10:54:18 -06:00
Antonio Scandurra b396909035 Calculate hitbox based on visible bounds in {Mouse}EventHandler
This is in contrast to not dispatching the event altogether in `Flex` when
the event is not contained in the flex element bounds. That approach was
problematic because it didn't give an opportunity to `MouseEventHandler`s
to handle mouse move events when they didn't intersect with the element bounds,
causing elements to never clear their hover state, cursor style, etc.
2022-04-07 15:12:09 +02:00
Antonio Scandurra 73f2fd6b09 Pass visible bounds to Element::dispatch_event 2022-04-07 15:10:09 +02:00
Nathan Sobo 0214bec7f4 Don't dispatch events to flex children outside of parent flex's bounds 2022-04-06 10:59:03 -06:00
Antonio Scandurra 1453954ef4 Autoscroll to active tab when activating a new item 2022-04-06 09:08:44 +02:00
Nathan Sobo eb99588368 Remove stray dbg! expressions 2022-04-05 20:02:45 -06:00
Nathan Sobo ab3bbe1e17 Make the tabs scrollable when they overflow
This adds the ability to make a Flex element scrollable by passing a type tag and instance id, which we use to store the scroll position in an ElementStateHandle.

Still need to allow the element to auto-scroll.
2022-04-05 19:58:15 -06:00
Nathan Sobo 025d857be8 Make UniformListState an Rc<RefCell<>> instead of an Arc<Mutex<>>
We don't need to support multiple threads.
2022-04-05 18:40:25 -06:00
Antonio ScandurraandNathan Sobo 0453dd1101 Allow flex items to float to the end of the flex axis
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-30 16:46:14 +02:00
Antonio ScandurraandNathan Sobo 447f350123 Compute line-height as a multiple of font size
...instead of using the bounding box. This makes `PragmataPro` and other
fonts render more cleanly.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-15 16:35:06 +01:00
Antonio Scandurra 45ce503afd Start on implementing filtering support for Cursor::prev 2022-03-15 15:13:23 +01:00