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
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
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
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>
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
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
[[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