Commit graph

481 commits

Author SHA1 Message Date
Nathan Sobo
5f8417249c
Return impl IntoElement in Render and RenderOnce traits (#3839)
- Returning `IntoElement` because it's more universal than `Element` and
allows us to easily return components.
- Using `impl IntoElement` in `RenderOnce` for consistency, which
requires `Component` to allocate an `AnyElement`. We use a bump
allocated arena anyway for these, and my benchmark doesn't show an
impact.


![frame-time-histogram](https://github.com/zed-industries/zed/assets/1789/d3889cca-9ebc-4d72-aa68-34a5be3bad3c)

In this histogram, frames-0 is this PR, frames-1 is main.

Release Notes:

- N/A
2024-01-03 10:37:26 -07:00
Piotr Osiewicz
b4a205b37c Pane: Fix flicker when opening/closing tabs
Tab bar was losing focus for one frame which led to it skipping rendering of tab controls & flickering. It also occured when opening new tabs.
2024-01-03 13:21:21 +01:00
Piotr Osiewicz
406edd279a Merge branch 'main' into refine-render-traits 2024-01-03 12:27:42 +01:00
Julia
14066c4f0e Add icon_tooltip for panel buttons rather than using persistent name 2024-01-02 17:56:19 -05:00
Nathan Sobo
68e7d99219 Return impl IntoElement from RenderOnce::render
This makes it a bit more approachable to implement.

This required converting the state of Component to AnyElement, which
costs an allocation. I'm hoping this will be ok performance-wise now
that AnyElements use bump allocation, but I need to benchmark still.
2024-01-02 10:27:09 -07:00
Nathan Sobo
1b5c8b2b4a Return impl IntoElement from Render::render trait 2024-01-02 10:09:05 -07:00
Nathan Sobo
47071605a1 Merge remote-tracking branch 'origin/main' into new-view-new-model-rename 2024-01-01 17:42:12 -07:00
Nathan Sobo
db1cf8f6e1 Rename build_view to new_view and build_model to new_model
The word "new" is shorter and blends in with `new` constructors that are common
in Rust. Been meaning to do this for a while.
2024-01-01 17:42:01 -07:00
Nathan Sobo
bcf0e3fb05 Merge branch 'pre-merge' into clean-up-doc-elements 2024-01-01 12:21:33 -07:00
Nathan Sobo
51d1d92d66 Attempt to return impl Element from render. 3 errors. 2024-01-01 14:23:02 +01:00
Nathan Sobo
83923fd6d5 Clean up Element API and start on docs 2023-12-31 08:33:40 -07:00
Piotr Osiewicz
904358263c
Remove #[allow(unused)] annotations in zed2 crates (#3798)
Release Notes:

- N/A
2023-12-25 12:23:44 +01:00
Kirill Bulatov
a249375f99 Do not show nav history buttons in terminal pane 2023-12-23 22:10:11 +02:00
Kirill Bulatov
e839dc5ee6 Hide pane tab bar for 0 items, hide its end buttons for no focus 2023-12-23 21:53:08 +02:00
Marshall Bowers
5a910aa874
Refine ported Zed1 themes (#3804)
This PR applies another round of refinements to the ported Zed1 themes.

Most of this was focused around the coloration of UI text to better
match Zed1.

Release Notes:

- N/A
2023-12-22 21:49:27 -05:00
Marshall Bowers
bdb89d4700 Render tab bar tools as muted 2023-12-22 21:25:31 -05:00
Joseph T. Lyons
b1870af386 Add project open event
Give the caller of report_app_event() the choice of whether to immediately flush the queue or not.
2023-12-22 20:23:55 -05:00
Max Brunsfeld
2edf560e5c
Maintain workspace's zoom state when opening/closing docks, activating panels (#3801)
Fixes an issue where zoom didn't work when closing and re-opening a
zoomed panel.
2023-12-22 16:54:13 -08:00
Max Brunsfeld
d7b0662058 Maintain workspace's zoom state when opening/closing docks, activating panels 2023-12-22 16:45:44 -08:00
Marshall Bowers
f03ee1ea24
Add spacing between tab bar buttons (#3799)
This PR adds spacing between buttons in the tab bar.

Release Notes:

- N/A
2023-12-22 19:18:04 -05:00
Marshall Bowers
b501f4eafc
Begin porting Zed1 themes to Zed2 (#3793)
This PR is a first pass at porting the Zed1 themes to Zed2.

For the initial release of Zed2 we'll be shipping just the themes that
existed in Zed1, ported to Zed2. The new themes that were previously
added just in Zed2 have been removed.

Release Notes:

- N/A
2023-12-22 17:37:53 -05:00
Antonio Scandurra
30340535e9
Prevent panels from getting so small they can't be resized (#3788)
This also switches to using `Pixels` instead of `f32` to store the panel
size everywhere.

Release Notes:

- N/A
2023-12-22 18:37:13 +01:00
Antonio Scandurra
961d8331f3 Prevent panels from getting so small they can't be resized 2023-12-22 18:28:28 +01:00
Antonio Scandurra
3715ddfa74 Use Pixels instead of f32 for panel size 2023-12-22 18:26:33 +01:00
Antonio Scandurra
87ff5f04cb
Fix resizing for bottom dock (#3787)
We were not using `flex` on the `PaneGroup`, which caused the bottom
dock to be unable to satisfy the desired resize value.

Release Notes:

- N/A
2023-12-22 18:10:50 +01:00
Antonio Scandurra
54e45306c5 Fix resizing for bottom dock
We were not using `flex` on the `PaneGroup`, which caused the bottom
dock to be unable to satisfy the desired resize value.
2023-12-22 18:00:03 +01:00
Kirill Bulatov
5de32f7b0b Do not display a getting start message when the project is open 2023-12-22 18:06:23 +02:00
Kirill Bulatov
420253a752 Restore zoom buttons in pane tab bars, fix + button in the terminal one 2023-12-22 15:32:47 +02:00
Antonio Scandurra
c1ad079f09 Fix dismissing context menu when clicking on an item dispatched action 2023-12-22 12:27:20 +01:00
Antonio Scandurra
3de72f8366 Fix context menu in tab bar 2023-12-22 10:23:27 +01:00
Julia
051bad734e
Some terminal bugs (#3767)
Fixes:
 - drag and drop into terminal element does not change its style
 - drag and drop terminal tab into main pane then back panics
 - can drop non-terminal items into the terminal pane

Release Notes:

- N/A
2023-12-21 18:05:14 -05:00
Julia
f3fda8018f Prevent drag-dropping non-terminal item into terminal pane 2023-12-21 17:52:29 -05:00
Marshall Bowers
3d1e52297e
Scale down status bar items (#3766)
This PR scales down the sizes of items in the status bar.

This brings us more in line with Zed1.

Release Notes:

- N/A
2023-12-21 17:42:54 -05:00
Julia
9efe5a30aa Fix pane drag target not appearing over terminal element 2023-12-21 13:08:48 -05:00
Julia
31e47f9b52 Prevent panic dragging tab into terminal panel 2023-12-21 12:56:30 -05:00
Kirill Bulatov
b14c07ca54 Fix Zed cli actions: opening notes and joining calls 2023-12-21 14:27:13 +02:00
Nathan Sobo
4f6bef5b63
Improve interaction between clicking and dragging (#3737)
Once a drag starts, we won't fire click listeners or style any elements
as active.

- Don't fire click listeners or show active state once a drag is in
progress
- Don't show hover style when a drag is in progress
- Draw borders above content
- If borders are opaque, apply them to the content mask. This prevents
hovers from firing on content underneath the border, which was creating
issues where the drag handle was inside the border, so we'd flicker the
hover when the mouse moved out of the drag handle and into the 1px
border on the left dock.
- Add a `block_mouse` helper which causes transparent elements to paint
an "opaque" layer to prevent mouse events from falling through. We use
this for the drag handle as well to disable hover, click, etc on items
in the panel.

Release Notes:

- N/A
2023-12-20 19:31:06 -07:00
Max Brunsfeld
afbc655100
Ensure that views' on_release callbacks are always called (#3747)
* Ensure that views' on_release callbacks are always called (even if
their window is gone), by passing them a `AppContext`, not a
`WindowContext`.
* Fix leaked handles to `CollabPanel`, `NotificationPanel`, and
`ChatPanel` caused by captures in a `ListState` render callback.

This fixes two issues we were seeing with following:
* inability to rejoin a remote project after you closed it
* following not working if a window had previously been closed
2023-12-20 16:45:37 -08:00
Max Brunsfeld
42bdc11112 Prune dead workspaces from WorkspaceStore on read
Also, remove unnecessary window handle from Workspace.
2023-12-20 16:08:58 -08:00
Max Brunsfeld
5e7c74c7b6 Ensure that on_release callbacks are called even if view outlives its window 2023-12-20 16:01:52 -08:00
Marshall Bowers
b9bc74abe5 Increase toolbar padding 2023-12-20 17:03:44 -05:00
Marshall Bowers
53b608378c Don't apply the gap when we don't have any items in the first row 2023-12-20 17:02:15 -05:00
Nathan Sobo
87ae21feb3 Merge remote-tracking branch 'origin/main' into cancel-clicks-on-drag 2023-12-20 15:01:10 -07:00
Nathan Sobo
15f16f08d9 Move application of content mask and z-index into Interactivity::paint
This allows the content mask to correctly apply to bounds used in event handlers,
which prevents content under opaque borders from being hovered in overflow hidden
containers.

Co-Authored-By: Antonio <antonio@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2023-12-20 11:43:45 -07:00
Nathan Sobo
fffb30ac6d Add InteractiveElement::block_mouse which renders an "opaque" layer
Co-Authored-By: Antonio <antonio@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2023-12-20 11:02:47 -07:00
Julia
e1a4e8ea16
Reintroduce LSP diagnostic/status message (#3728)
Release Notes:

- N/A
2023-12-20 12:23:36 -05:00
Julia
5840750b3d Avoid workspace use while leased 2023-12-20 11:28:56 -05:00
Kirill Bulatov
fe40e3920b Fix remaining z-index bugs
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-12-20 18:23:09 +02:00
Antonio Scandurra
57f3a882fe Render disconnected overlay when project becomes readonly 2023-12-20 14:10:59 +01:00
Antonio Scandurra
390ccbc6ad Disable focus when disconnecting from host 2023-12-20 14:10:56 +01:00