Commit Graph
15864 Commits
Author SHA1 Message Date
Max Brunsfeld b52db696d3 Fix overlay rendering when dragging onto the center of a pane (#3667) 2023-12-14 16:59:19 -08:00
Max Brunsfeld 52b9fc303b Fix overlay rendering when dragging onto the center of a pane 2023-12-14 16:52:03 -08:00
Mikayla Maki c27dd57a48 Make more performance improvements to GPUI 2 (#3664)
In the 3 charts below, "window draw" has 3 major subroutines. Request
layout, where we walk over the tree and have everything talk to the
layout engine initially. Compute layout, where we have the layout engine
actually do the layout, and then paint, where we use the computed bounds
to populate the scene.


![image_720](https://github.com/zed-industries/zed/assets/1789/d2225389-865f-4c8a-9452-9f611da64dcf)

Things are moving quickly so before/after comparisons are tough. In the
graph above, green bars are from a commit actually pre-dates a merge of
master which increased the complexity of layout. The red bars represent
the state of the world after this PR. Note how we improve the
performance of `paint`.

Improvements:

- Not moving `self` in `Element::paint`. This was moving from the heap
to the stack and imposing a big cost. This is the biggest win in this
PR.
- We got some minor wins by making the stacking order a bigger smallvec
of u8 instead of u32.
- A big win that doesn't show up in this chart is avoiding a double
render of the editor when autoscrolling by never pushing notification
effects or marking the window dirty when notifying during a window draw.

Release Notes:

- N/A
2023-12-14 16:45:58 -08:00
Max Brunsfeld b95cc7221c Fix centering of empty pane text (#3666)
The formatting of the empty pane text regressed in #3665, in which I
also made it possible to drag items onto an empty pane.
2023-12-14 16:44:30 -08:00
Mikayla Maki 05cb68eff1 Merge branch 'main' into perf-2 2023-12-14 16:39:10 -08:00
Max Brunsfeld 842f15c65b Fix centering of empty pane text 2023-12-14 16:35:58 -08:00
Max Brunsfeld 82c8b49dac Fix stickiness of main pane drag target (#3665)
Reimplement the pane drag targets using on_drag_move
2023-12-14 16:30:02 -08:00
Mikayla Maki 8418f25d0a Merge branch 'main' into perf-2 2023-12-14 16:25:40 -08:00
Max Brunsfeld d6383ab0c6 Fix stickiness of main pane drag target
Reimplement the pane drag targets using on_drag_move
2023-12-14 16:23:15 -08:00
Mikayla Maki 0b4b81fa0c Fix dock resizing (#3663)
This fixes some bugs in the display and tracking of dock resizes

Release Notes:

-
2023-12-14 16:20:29 -08:00
Nathan Sobo ad8165ae79 Rename draw2 -> draw_and_update_state 2023-12-14 17:20:27 -07:00
Nathan Sobo f4a954db4f Merge remote-tracking branch 'origin/main' into perf-2 2023-12-14 17:15:44 -07:00
Mikaylaandconrad 8b4cf38379 Fix dock resize handles
co-authored-by: conrad <conrad@zed.dev>
2023-12-14 16:05:10 -08:00
Nathan Sobo 02606d1fb9 Merge remote-tracking branch 'origin/main' into perf-2 2023-12-14 16:56:36 -07:00
Marshall Bowers bc3e6649f8 Fix warning in release mode (#3662)
This PR fixes a warning that was present in release mode, which was
preventing the nightly builds from running:

```
error: variable does not need to be mutable
   --> crates/gpui2/src/elements/div.rs:547:9
    |
547 |     let mut div = Div {
    |         ----^^^
    |         |
    |         help: remove this `mut`
    |
    = note: `-D unused-mut` implied by `-D warnings`
```

Release Notes:

- N/A
2023-12-14 18:52:14 -05:00
Mikaylaandconrad 4c63c74f92 Fix bug in drag move dispatch
co-authored-by: conrad <conrad@zed.dev>
2023-12-14 15:23:24 -08:00
Marshall Bowers 139fe7c1f1 Use separate editor foreground color (#3661)
This PR populates the `editor_foreground` color in the various themes
and updates the editor to use this as the color for text.

The `text` field in the theme should now be used for UI elements, while
`editor_foreground` should be used for buffers.

This improves the contrast in some themes, notably Ayu Dark.

Release Notes:

- N/A
2023-12-14 17:54:44 -05:00
Max Brunsfeld fcbd58fed4 Enable all warnings in workspace, fix all warnings (#3660) 2023-12-14 14:38:28 -08:00
Marshall Bowers 2b278e69f7 Use editor_foreground color in editor 2023-12-14 17:34:07 -05:00
Marshall Bowers 292fac37bb Use editor.foreground from VS Code for the editor foreground 2023-12-14 17:30:37 -05:00
Marshall Bowers 8bac4e199d Emit editor_foreground color from theme converter 2023-12-14 17:28:45 -05:00
Max BrunsfeldandConrad 6170895932 Fix bug in Workspace::activate_pane_in_direction
Co-authored-by: Conrad <conrad@zed.dev>
2023-12-14 14:27:44 -08:00
Joseph T. Lyons 4e7005b4f7 Use bitflags to hold error states 2023-12-14 17:22:13 -05:00
Max Brunsfeld b5e9e277db Re-enable cmd-<number> key bindings for activating panes (#3659) 2023-12-14 14:16:43 -08:00
Max BrunsfeldandConrad 23d5f3f3e8 Enable all warnings in workspace, fix all warnings
Bring back some workspace tests

Co-authored-by: Conrad <conrad@zed.dev>
2023-12-14 14:15:56 -08:00
Nathan Sobo d13a21c238 Don't move in paint 2023-12-14 15:15:18 -07:00
Max Brunsfeld 8d994ce8c5 Enable dragging from project panel to panes (#3658)
Rework gpui2 drag API so that receivers need not specify the dragged
view type.
2023-12-14 13:32:40 -08:00
Max BrunsfeldandConrad 6b06bb4ffe Re-enable cmd-<number> key bindings for activating panes
co-authored-by: Conrad <conrad@zed.dev>
2023-12-14 13:30:11 -08:00
8791f7cefc Enable dragging from project panel to panes
Rework gpui2 drag API so that receivers need not specify the dragged view type.

co-authored-by: Max <max@zed.dev>
co-authored-by: Conrad <conrad@zed.dev>
2023-12-14 13:20:48 -08:00
Nathan Sobo fb3382bcc5 Merge remote-tracking branch 'origin/main' into perf-2 2023-12-14 14:16:59 -07:00
Marshall Bowers 35838ae554 Style "Replace in project" input in project search (#3657)
This PR styles the "Replace in project" input in the project search.

Release Notes:

- N/A
2023-12-14 16:10:22 -05:00
Nathan Sobo 0dd6c50a20 Use FxHashMap for element state 2023-12-14 14:06:19 -07:00
Marshall Bowers c166311c06 Style "Replace in project" input 2023-12-14 15:58:17 -05:00
Marshall Bowers 2484a6969a Fix toolbar flex sizing 2023-12-14 15:57:06 -05:00
Conrad Irwin 2efd7cedbc Ignore invisible layers for mouse events (#3651)
Fixes clicking in the top/bottom 100px of the editor


Release Notes:

- N/A
2023-12-14 12:01:45 -07:00
Marshall Bowers ed098c834e Style inputs in project search (#3655)
This PR styles the inputs in the project search.

<img width="772" alt="Screenshot 2023-12-14 at 1 53 28 PM"
src="https://github.com/zed-industries/zed/assets/1486634/fe2362be-79db-4551-a473-2acf7a8a1bcb">

Release Notes:

- N/A
2023-12-14 13:58:11 -05:00
Nathan Sobo 3d1dae9a06 Make z_indices bigger in StackingOrder 2023-12-14 11:37:48 -07:00
Nathan Sobo 0d30b698a4 Don't allocate interactive bounds 2023-12-14 11:28:52 -07:00
Joseph T. Lyons 8a361c93e2 Prep feedback code for testing 2023-12-14 13:22:41 -05:00
Marshall Bowers c6e44683e6 Hide the toolbar if it has no visible items (#3654)
This PR makes the toolbar hide itself if it has no visible items.

This removes the double border beneath the tab bar when there are no
visible tools in the toolbar.

Release Notes:

- N/A
2023-12-14 13:02:27 -05:00
Conrad Irwin 4e1b4c4390 Refactor editor to be more clear about stacking 2023-12-14 10:48:15 -07:00
Conrad Irwin d8cb0e8a2a Fix z-indexes in editor element
* Ensure that scroll events from blocks scroll the editor
* Ensure that scroll bars show behind hover things
2023-12-14 10:36:16 -07:00
Nathan Sobo 1ae25f52a1 WIP 2023-12-14 10:31:45 -07:00
Marshall Bowers fd133df896 Improve storybook story selection (#3653)
This PR builds on top of #3652 by adding a selection prompt to the
storybook to allow you to choose from the available list of stories if
you don't provide one explicitly:

<img width="1387" alt="Screenshot 2023-12-14 at 12 00 26 PM"
src="https://github.com/zed-industries/zed/assets/1486634/640d62a3-1340-45f1-9746-69b513faff62">

This way we don't have to keep generating the `script/storybook` script
whenever stories are added/removed.

#### Usage (through `cargo`):

```sh
# Select from the available stories
cargo run -p storybook2

# Run a specific story
cargo run -p storybook2 -- components/list_item
```

#### Usage (through `script/storybook`):

```sh
# Select from the available stories
./script/storybook

# Run a specific story
./script/storybook list_item
```

Release Notes:

- N/A
2023-12-14 12:13:02 -05:00
Conrad Irwin c2c7eead8a Robustify checks for visibility 2023-12-14 10:02:54 -07:00
Nate Butler 08418618ab Generate script/storybook (#3652)
[[PR Description]]

This PR adds the ability to run stories with `script/storybook`.

Running it directly will give you a selector like this:

```zsh
➜  zed git:(add-storybook-script) script/storybook
1) auto_height_editor	 9) icon		17) scroll
2) avatar		10) icon_button		18) tab
3) button		11) keybinding		19) tab_bar
4) checkbox		12) label		20) text
5) context_menu		13) list		21) viewport_units
6) cursor		14) list_header		22) z_index
7) disclosure		15) list_item		23) picker
8) focus		16) overflow_scroll
```

You can also provide a value like:

`script/storybook {STORY_NAME}` - Example: `script/storybook text`

OR 

`script/storybook components/{STORY_NAME}` - Example: `script/storybook
components/text`

I just wanted an easier way to interface with stories quickly to make
using them a bit easier, and enable discovery of what exists easier with
the selector.

This was a really quick hack, in the future we can extend this to a
proper CLI.

Release Notes:

- N/A
2023-12-14 11:52:06 -05:00
Conrad Irwin 17a80ca09b Ignore invisible layers for mouse events 2023-12-14 09:44:04 -07:00
Nate Butler ac3622cc6a Generate script/storybook 2023-12-14 11:42:08 -05:00
Nathan Sobo 6f17cf7337 WIP 2023-12-14 09:25:14 -07:00
Piotr Osiewicz da960fffe7 calls: Fix off by one in prompts for leaving a call. (#3649)
We've noticed how leaving a call with multiple windows open would still
prompt with the popup along the lines of "Do you want to leave the
current call?". In Zed1, that popup only showed up when you've had just
one window open.

The code for prompting did not change at all between zed1 and zed2, but
the way we calculate the window count did. Calling AppContext::windows
to get all window handles from WindowContext::update essentially
excluded the window we were updating (that is the window being closed)
from the returned Vec of window handles. I've decided to keep the code
as close to original as possible (as the alternative would be to change
the \# of workspaces needed for a prompt to pop up). We now query the
window handles via a deref to AsyncAppContext, which does not exclude
"our" window handle from the returned results.

Release Notes:

- N/A
2023-12-14 15:35:31 +01:00