This PR updates the GPUI `image` example such that it works when run in
the following ways:
- `cargo run -p gpui --example image` from the repository root
- `cargo run --example image` from within `crates/gpui`
Release Notes:
- N/A
Release Notes:
- Render unstaged hunks in the project diff editor with a slashed
background
---------
Co-authored-by: maxbrunsfeld <max@zed.dev>
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
* correct the size of key binding icons
* avoid spurious modifier in 'jump to edit' popover when already
previewing
* fix height of the edit preview popover
Release Notes:
- N/A
Co-authored-by: agu-z <hi@aguz.me>
Release Notes:
- N/A
As https://github.com/zed-industries/zed/discussions/24260 I mentioned
issue.
Make a complex data table example to test the text rendering
performance.
This example also can be an example to show how to build a large data
table.
```bash
cargo run -p gpui --example data_table
```
<img width="2004" alt="image"
src="https://github.com/user-attachments/assets/653771e5-ef08-4d76-97b9-90ea4b78be59"
/>
----
I will try to do some test.
For example: With a threshold for the hold number of caches in
`FrameCache`, and only when the threshold is greater than a certain
number, some caches are released, or when a certain time has passed. I
am not sure if this is feasible.
This example is added to help us to test.
Closes#24139
For weird reasons, Sway on few linux distoros sends `NoKeymap` event when
switching windows. Zed crashes due to assertion on this event to be `XkbV1`.
To fix this, we ignore `NoKeymap` event instead crashing Zed.
Release Notes:
- Fixed a crash in Wayland-based compositors like Sway when switching windows via the keyboard.
Release Notes:
- N/A
------
- Continue #24090 to fix text align for when used `whitespace_nowrap`.
- Fix wrapped line length calculation.
And add example
```
cargo run -p gpui --example text_layout
```
<img width="760" alt="image"
src="https://github.com/user-attachments/assets/a087c300-0e0e-4a80-98c6-90161a9b0905"
/>
---------
Co-authored-by: Owen Law <owenlaw222@gmail.com>
Byte size before was 672, now is 56. The `cached` method is only used in
two places, so this was a lot of extra bytes being shuffled around for
every `AnyView` not using this.
Release Notes:
- N/A
Implement `raw_window_handle::HasWindowHandle` for `gpui::Window`
This opens a lot of possibility of using gpui with platform specific
APIs.
Edit: With this exposed, we can use crates like `window-vibrancy`,
`muda` (menus crate) or even use `wry` (a webview renderer) to create a
child `WebView` inside the gpui window.
Release Notes:
- N/A
Regression in #22644
Unfortunately not a full fix, In the case where a tooltip gets displayed
and then gets occluded after display, it will stick around until the
mouse exits the hover bounds.
Release Notes:
- N/A
Co-authored-by: Ben <ben@zed.dev>
This long standing bug was caused by `Pane`'s focus_in handler bouncing
the focus to another handle.
Because focus resolution happens _after_ a frame has been rendered, the
only way to deal with this case is to schedule another frame to be
redrawn. However, we where suppressing all window refreshes that occur
during a focus transfer, causing this focus change to be completely
missed. However, changing this behavior can lead to infinite notify
loops, due to drawing a frame causing another to be rendered.
This PR fixes this problem narrowly by adding an `on_next_frame()`
callback in the pane's focus handle, so that the focus changes take
effect almost immediately. But only for this case, where we know it
doesn't cause infinite notify loops.
TODO:
- [x] Fix the infinite notify loop bug or determine a third way to fix
this lag
Release Notes:
- Fixed a bug where shifting focus to the terminal panel could be slow
Fixes#22939Fixes#23970
Supersedes https://github.com/zed-industries/zed/pull/23469
Release Notes:
- Fixed a bug where Zed could crash with certain input sources on macOS
---------
Co-authored-by: Louis Brunner <louis.brunner.fr@gmail.com>
Co-authored-by: ben <ben@zed.dev>
Chatted with @as-cii about limitations in the `Window::parent_view_id()`
API (see:
https://github.com/zed-industries/zed/pull/24182/commits/662153dcfdd80804f4041761c09c4a309d79f6d4)
and realized that I shouldn't be using the dispatch tree's data
structures as they are layout dependent. I've introduced a new stack to
`Window`, `rendered_entity_stack`, that tracks exactly which view's
elements are being drawn. As such, I've also been able to remove the
`Option<>` around the previous API.
Release Notes:
- N/A
We think this could fix issues around view invalidation during focus
handling.
I want to run CI on this and see.
cc @mikayla-maki @maxbrunsfeld
Release Notes:
- N/A
Release Notes:
- Fixed some modifier changed events not being present on Linux X11.
This affected things like the project search palette, where holding ctrl
would not cause the split options to appear.
Use of this location info was added in #21758 to help with diagnosing
remote_server panics on drop of tasks on a different thread.
Release Notes:
- N/A
Adds a text property for controlling left, center, or right text
alignment.
#8792 should stay open since this doesn't add support for `justify`
(which would require a much bigger change since this can just alter the
origin of each line, but justify requires changing spacing, whereas
justify requires changes to each platform's shaping code).
Release Notes:
- N/A
This PR updates function signatures, docstrings, and gpui's other
documentation to reflect it's new state following the merge of `Model`
and `View` into `Entity` as well as the removal of `WindowContext`.
Release Notes:
- N/A
This PR adds two helpers methods to the `TextSystem`:
- `em_width`
- `em_advance`
These methods return the width and advance width for an `em`,
respectively.
We were using these definitions in a number of different spots, and by
unifying them we better canonicalize that an `em` is based on the `m`
character.
Release Notes:
- N/A
GPUI applications can set the window class by the `app_id` window
option. However, GPUI will map the window first and then change the
window class after the window is displayed. This doesn't work on some
X11 window managers. FVWM, for example, does not track window class
after a window is mapped. Because in practice, a window shouldn't change
its application group on the fly.
This PR fixed this by adding a `map_window()` function `PlatformWindow`.
On X11, it will `set_app_id()` first and then map the window.
Release Notes:
- N/A
Previously, editor elements had to listen for mouse_up events to
determine when a click had completed. This meant that they only had
access to modifier keys that were pressed during the mouse_up event.
This led to some incorrect user experiences, such as executing a
ctrl+click if the user pressed ctrl after pressing the mouse button, but
before releasing it.
This change adds a click event handler to EditorElement, and adds a
modifier() method to the ClickEvent, which only includes the modifier
keys that were pressed during both mouse down and mouse up. The code for
handling link clicks has been moved into the click event handler, so
that it's only triggered when the non-multi-cursor modifier was held for
both the mouse down and mouse up events.
Closes#12752, #16074, #17892 (the latter two seem to be duplicates of
the former!)
Release Notes:
- Fixed a bug where pressing ctrl/cmd (or other modifiers) after mouse
down but before mouse up still triggered ctrl/cmd+click behavior (e.g.
"go to definition")
Closes#14170
To fix this, Zed needs to handle swipe events on its NSView. Logitech
mice don't send the usual Mouse4 and Mouse5 buttons but emulate swipe
gestures according to these websites:
- https://superuser.com/a/1216049
- https://sensible-side-buttons.archagon.net/
Of course, the user can map these buttons to something else in the
device's driver. Most IDEs (VSCode, IntelliJ) handle that correctly by
default so it would be good to follow that pattern.
Since it's my first contribution here, please let me know if I need to
enhance this PR to make it good enough for the main branch.
Release Notes:
- Fixed mouse navigation buttons on some devices (Logitech, Mac OS)
This PR prevents situations like
https://github.com/zed-industries/zed/pull/23850, which caused our linux
nightly build to fail to open at all.
This PR also sorts the GPUI build and dev dependencies out from the sea
of platform specific dependencies.
Release Notes:
- N/A
Closes#20762
Release Notes:
- N/A
---
Enable MSAA for Anti-Aliasing to Path (`cx.paint_path`) for drawing a
better vector graphics.
```bash
cargo run -p gpui --example gradient --features macos-blade
cargo run -p gpui --example gradient
cargo run -p gpui --example painting --features macos-blade
cargo run -p gpui --example painting
```
**Before**
<img width="1089" alt="image"
src="https://github.com/user-attachments/assets/0ae7240f-4ba9-4ef5-896c-e436c1282770"
/>
**After**
<img width="944" alt="image"
src="https://github.com/user-attachments/assets/71a07ae8-be54-452c-aacc-b8cec1f810c0"
/>
## TODO
- [x] Support Metal and Blade.
- [x] Detect system support to set up sample count.
- [x] Fix extra lines between Path vertices wait #22808 to merge.
Ref https://github.com/kvark/blade/pull/213
Ask @kvark to review.
I am not sure if there is anything I missed. I modified it according to
the
[particle](https://github.com/kvark/blade/tree/main/examples/particle)
example of Blade project. But the difference is that after the first
MSAA render, I did not do it a second time, I tested it and found it was
not necessary.
TODO:
- [x] BackgroundOrientation
- [x] PatternDash
- [x] `pattern_horizontal_dash` & `pattern_vertical_dash`
- [x] Metal dash shader
- [x] Blade dash shader
- [x] Update ui::Divider to use new pattern
---
This PR introduces proper dashed dividers using the new `PatternDash`
background shader.

Before this we were using 128 elements to create a dashed divider, which
is both expensive, and would not scale beyond a certain size. This
allows us to simplify the divider element as well.
Changes:
- Adds `BackgroundOrientation` to `gpui::color::Background` to allow
specifying a direction for a pattern
- Adds the PatternDash pattern variant
- Updates `ui::Divider`'s dashed variants to be more efficient
Misc:
- Documents the `ui::Divider` component
- Treat `.metal` files as `C` in the Zed project until we get some metal
syntax highlighting.
Release Notes:
- N/A
TODO:
- [x] Add BackgroundTag::PatternSlash
- [x] Support metal slash pattern fills
- [x] Support blade slash pattern fills
---
Adds support for a new background type in gpui, `pattern_slash`.
Usage:
```rust
div().size(px(56.0)).bg(pattern_slash(gpui::red()))
```
This will create a 56px square with a red slash pattern fill.
You can run the pattern example with `cargo run -p gpui --example
pattern`:

---
After talking with @as-cii at length about how we want to support
patterns in gpui, we decided for now we'll simply add a new
BackgroundTag specific to this pattern.
It isn't the best long term plan however – we'll likely want to
introduce the concept of a `Fill` at some point so we can have
`Fill::Solid`, `Fill::Gradient(LinearGradient)`, etc in the future.
The pattern is designed to seamlessly tile vertically for elements of
the same height. For example, for use in editor line backgrounds:

---
Release Notes:
(do we do gpui release notes?)
- Adds support for slash pattern fills in `gpui`.
---------
Co-authored-by: Antonio Scandurra <me@as-cii.com>
I recently noticed that on my Windows 11 machine, Zed no longer receive
the `WM_DWMCOLORIZATIONCOLORCHANGED` message when the system theme
changes. This functionality was present in the past. While this change
might be unexpected, it's understandable given Microsoft's history of
system updates.
This pull request proposes an alternative approach using the
`WM_SETTINGCHANGE` message to handle theme changes.
Release Notes:
- N/A
Fix bugs caused by the window context PR, where the window could be on
the stack and is then requested from the App.
This PR also adds derive macros for `AppContext` and `VisualContext` so
that it's easy to define further contexts in API code, such as
`editor::BlockContext`.
Release Notes:
- N/A