This reverts commit efba2cbfd3.
Unfortunately, the Docker image for 1.89 has not shown up yet. Once it
has, we should re-land this.
Release Notes:
- N/A
While default for ClickEvent shouldn't be used much this is helpful for
other projects using gpui besides Zed. Mainly because the orphan rule
prevents those projects from implementing their own default trait
cc: @huacnlee
Release Notes:
- N/A
This also fixed a bug where evaluate selected text was an available
option when the selected debug session was terminated.
Release Notes:
- debugger: add Run to Cursor back to Editor's context menu
Co-authored-by: Remco Smits <djsmits12@gmail.com>
Fixes a regression introduced in
https://github.com/zed-industries/zed/pull/34992
### Background
Paths are rendered first to an intermediate MSAA texture, and then
copied to the final drawable. Because paths can have transparency, it's
important that pixels are not copied repeatedly if paths have
overlapping bounding boxes. When N paths have the same draw order, we
infer that they must have disjoint bounding boxes, so that we can copy
them each individually (as opposed to copying a single rect that
contains them all). Previously, the bounding box that we were using to
copy paths was not accounting for the path's content mask (but it is
accounted for in the bounds tree that determines their draw order).
This cause bugs like this, where certain path pixels spuriously had
their opacity doubled:
https://github.com/user-attachments/assets/d792e60c-790b-49ad-b435-6695daba430f
This PR fixes that bug.
* [x] mac
* [x] linux
* [x] windows
Release Notes:
- Fixed a bug where a selection's opacity was computed incorrectly when
it overlapped with another editor's selections in a certain way.
Follow up to: https://github.com/zed-industries/zed/pull/35670,
simplifies the List state APIs so you no longer have to worry about
strong vs. weak pointers when rendering list items.
Release Notes:
- N/A
---------
Co-authored-by: Agus Zubiaga <agus@zed.dev>
Fixes https://github.com/zed-industries/zed/issues/33257
Previously, the scale-factor-change-handling logic relied on
`SetWindowPos` enqueuing a `WM_SIZE` window event. But that does not
happen when the window is maximized. So when the scale factor changed,
maximized windows neglected to call their `resize` callback, and would
misinterpret the positions of mouse events.
This PR adds special logic for maximized windows, to ensure that the
size is updated appropriately.
Release Notes:
- N/A
Release Notes:
- N/A
> Any user interaction that is equivalent to a click, such as pressing
the Space key or Enter key while the element is focused. Note that this
only applies to elements with a default key event handler, and
therefore, excludes other elements that have been made focusable by
setting the
[tabindex](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/tabindex)
attribute.
https://developer.mozilla.org/en-US/docs/Web/API/Element/click_event
---------
Co-authored-by: Anthony <anthony@zed.dev>
Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
Co-authored-by: Umesh Yadav <23421535+imumesh18@users.noreply.github.com>
Closes #ISSUE
Allows tabbing through everything in all three pages. Until #35075 is
merged it is not possible to actually "click" tab focused buttons with
the keyboard.
Additionally adds an action `onboarding::Finish` and displays the
keybind. The action corresponds to both the "Skip all" and "Start
Building" buttons, with the keybind displayed similar to how it is for
the page nav buttons
Release Notes:
- N/A *or* Added/Fixed/Improved ...
---------
Co-authored-by: MrSubidubi <finn@zed.dev>
This is a bit of a readability improvement IMHO; I often find myself
confused when dealing when dimension pairs, as there's no easy way to
jump to the implementation of a dimension for tuples to remind myself
for the n-th time how exactly that impl works. Now it should be possible
to jump directly to that impl.
Another bonus is that Dimension supports 3-ary tuples as well - by using
a () as a default value of a 3rd dimension.
Release Notes:
- N/A
Going back to having system be mutually exclusive with light/dark to
simplify the system. We instead just show both light and dark when
system is selected
Release Notes:
- N/A
---------
Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
Co-authored-by: Anthony Eid <hello@anthonyeid.me>
This PR doesn't change any logic, it just cleans up some naming and
style in the windows platform layer.
* Rename `WindowsWindowStatePtr` to `WindowsWindowInner`, since it isn't
a pointer type.
* Move window event handler methods into an impl on this type, so that
all of the `state_ptr: &Rc<WindowsWindowInner>` parameters can just be
replaced with `&self`.
* In window creation, use a `match` instead of a conditional followed by
an unwrap
There's a lot of whitespace in the diff, so view it with `w=1`.
Release Notes:
- N/A
This allows debugging Zed with Renderdoc, and also fixes an issue where
glyphs' bounds were miscalculated for certain sizes and scale factors.
Release Notes:
- N/A
---------
Co-authored-by: Kate <kate@zed.dev>
Co-authored-by: Julia <julia@zed.dev>
Co-authored-by: Junkui Zhang <364772080@qq.com>
Closes#35316
Bug in https://github.com/zed-industries/zed/pull/34514
Turns out you are not supposed to call `update_key` for modifiers on
`KeyPress`/`KeyRelease`, as modifiers are already updated in
`XkbStateNotify` events. Not sure why this only causes issues on a few
systems and works on others.
Tested on Ubuntu 24.04.2 LTS (initial bug) and Kubuntu 25.04 (worked
fine before too).
Release Notes:
- Fixed an issue where caps lock stopped working consistently on some
Linux X11 systems.
I was interested in potentially using gpui for a hobby project, but
needed [layer
shell](https://wayland.app/protocols/wlr-layer-shell-unstable-v1)
support for it. Turns out gpui's (excellent!) architecture made that
super easy to implement, so I went ahead and did it.
Layer shell is a window role used for notification windows, lock
screens, docks, backgrounds, etc. Supporting it in gpui opens the door
to implementing applications like that using the framework.
If this turns out interesting enough to merge - I'm also happy to
provide a follow-up PR (when I have the time to) to implement some of
the desirable window options for layer shell surfaces, such as:
- namespace (currently always `""`)
- keyboard interactivity (currently always `OnDemand`, which mimics
normal keyboard interactivity)
- anchor, exclusive zone, margins
- popups
Release Notes:
- Added support for wayland layer shell surfaces in gpui
---------
Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
This PR makes it so we send the `User-Agent` header on the WebSocket
connection requests when connecting to Collab.
We use the user agent set on the parent HTTP client.
Release Notes:
- N/A
This fixes an issue with tab indices where we would actually focus the
second focus handle on first focus instead of the first one. The test
was updated accordingly.
Release Notes:
- N/A
---------
Co-authored-by: Jason Lee <huacnlee@gmail.com>
This fixes an issue where focus handles with a tab index would get lost
between rendered frames because the focus handles were not reused for
the following paint cycle.
Release Notes:
- N/A
Closes #ISSUE
Fixes a bug that was cherry picked onto stable and preview branches
introduced in #35208 whereby modifier keys would show up and not be
removable when editing a keybind
Release Notes:
- (preview only) Keymap Editor: Fixed an issue introduced in v0.197.2
whereby modifier keys would show up and not be removable while recording
keystrokes in the keybind edit modal
Closes #ISSUE
Fixed various issues and improved UX around the keystroke input
primarily when used for keystroke search.
Release Notes:
- Keymap Editor: FIxed an issue where the modifiers used to activate
keystroke search would appear in the keystroke search
- Keymap Editor: Made it possible to search for repeat modifiers, such
as a binding with `cmd-shift cmd`
- Keymap Editor: Made keystroke search matches match based on ordered
(not necessarily contiguous) runs. For example, searching for `cmd
shift-j` will match `cmd-k cmd-shift-j alt-q` and `cmd-i g shift-j` but
not `alt-k shift-j` or `cmd-k alt-j`
- Keymap Editor: Fixed the clear keystrokes binding (`delete` by
default) not working in the keystroke input
Closes#31330
Second parts of https://github.com/zed-industries/zed/pull/31335
While the initial fix set the inset during drawing, that was after the
window was resized, resulting in needing to manually resize the window
for the change to properly take effect.
I updated the code to not make the Wayland renderer rely on
`client_inset` being updated by the API user to match with the
decoration mode (given it is supposed to only be used when using CSD).
I might later try to generalize that, and eventually make the
client_inset only defined on window creation (instead of inside
`client_side_decorations`, that would need testing on X) (and maybe also
allow configuration for shadow, but it’s not something I need).
Release Notes:
- Fixed switching from client side decoration to server side decoration
on Wayland
This is another attempt to solve the same problem as
https://github.com/zed-industries/zed/pull/29718, while avoiding the
regression on Intel GPUs.
### Background
Currently, on main, all paths are first rendered to an intermediate
"atlas" texture, similar to what we use for rendering glyphs, but with
multi-sample antialiasing enabled. They are then drawn into our actual
frame buffer in a separate pass, via the "path sprite" shaders.
Notably, the intermediate texture acts as an "atlas" - the paths are
laid out in a non-overlapping way, so that each path could be copied to
an arbitrary position in the final scene. This non-overlapping approach
makes a lot sense for Glyphs (which are frequently re-used in multiple
places within a frame, and even across frames), but paths do not have
these properties.
* we clear the atlas every frame
* we rasterize each path separately. there is no deduping.
The problem with our current approach is that the path atlas textures
can end up using lots of VRAM if the scene contains many paths. This is
more of a problem in other apps that use GPUI than it is in Zed, but I
do think it's an issue for Zed as well. On Windows, I have hit some
crashes related to GPU memory.
In https://github.com/zed-industries/zed/pull/29718, @sunli829
simplified path rendering to just draw directly to the frame buffer, and
enabled msaa for the whole frame buffer. But apparently this doesn't
work well on Intel GPUs because MSAA is slow on those GPUs. So we
reverted that PR.
### Solution
With this PR, we rasterize paths to an intermediate texture with MSAA.
But rather than treating this intermediate texture like an *atlas*
(growing it in order to allocate non-overlapping rectangles for every
path), we simply use a single fixed-size, color texture that is the same
size as thew viewport. In this texture, we rasterize the paths in their
final screen position, allowing them to overlap. Then we simply blit
them from the resolved texture to the frame buffer.
### To do
* [x] Implement for Metal
* [x] Implement for Blade
* [x] Fix content masking for paths
* [x] Fix rendering of partially transparent paths
* [x] Verify that this performs well on Intel GPUs (help @notpeter 🙏 )
* [ ] Profile and optimize
Release Notes:
- N/A
---------
Co-authored-by: Junkui Zhang <364772080@qq.com>
Previously we had `ScrollStrategy::ToPosition(usize)` which lets you
define the offset where you want to scroll that item to. This is the
same as `ScrollStrategy::Top` but imagine some space reserved at the
top.
This PR removes `ScrollStrategy::ToPosition` in favor of
`scroll_to_item_with_offset` which is the method to do the same. The
reason to add this method is that now not just `ScrollStrategy::Top` but
`ScrollStrategy::Center` can also uses this offset to center the item in
the remaining unreserved space.
```rs
// Before
scroll_handle.scroll_to_item(index, ScrollStrategy::ToPosition(offset));
// After
scroll_handle.scroll_to_item_with_offset(index, ScrollStrategy::Top, offset);
// New! Centers item skipping first x items
scroll_handle.scroll_to_item_with_offset(index, ScrollStrategy::Center, offset);
```
This will be useful for follow up PR.
Release Notes:
- N/A
There were two different underlying reasons for the issues with
ctrl-number and ctrl-punctuation:
1. Some keys in the ctrl-0..9 range send codes in the `\1b`..`\1f`
range. For example, `ctrl-2` sends keycode for `ctrl-[` (0x1b), but we
want to map it to `2`, not to `[`.
2. `ctrl-[` and four other ctrl-punctuation were incorrectly mapped,
since the expected conversion is by adding 0x40
Closes#35012
Release Notes:
- N/A
It took a long time to check this problem.
Finally, I found that due to a detail missing when changing #34832, the
bounds of `ScrollHandle` was not updated in the Interactivity `prepaint`
phase.
```diff
- scroll_handle_state.padded_content_size = padded_content_size;
+ scroll_handle_state.max_offset = scroll_max;
```
It was correct before the change, because the `padded_content_size`
(including `bounds.size`) was saved before, and the bounds was missing
after changing to `max_offset`, but the bounds were not updated
anywhere.
So when `scroll_handle.bounds()` is obtained outside, it is always 0px
here.
@MrSubidubi
Release Notes:
- N/A
This commit adds an example with deep children hierarchy.
The depth of a tree can be tweaked with GPUI_TREE_DEPTH env variable.
With depth=100
<img width="301" height="330" alt="image"
src="https://github.com/user-attachments/assets/844cd285-c5f3-4410-a74e-981bf093ba2e"
/>
With this example, I can trigger a stack overflow at depth=633 (and
higher).
Release Notes:
- N/A
https://github.com/user-attachments/assets/d472fbdd-7736-4bd7-8a90-8cca356b2815
This PR adds `editor: diff clipboard with selection` - good for spotting
the differences in eerily-similar code, which is when refactoring code,
as you need to see what needs to be passed in in order to maintain
previous behavior of both snippets.
1. Copy some text from anywhere
2. Highlight some text in Zed
3. Run `editor: diff clipboard with selection`
Like JetBrains' IDEs and VS Code with the `PartialDiff` package, if the
selection is empty, we take the entire buffer as the selection.
Caveats:
- We do not know the language of the text in the clipboard. I went ahead
and just assumed that in most cases, it will be the same language as the
selected text, which does mean we will highlight the old text
incorrectly if they are copying from a different language, but I think
in most cases, it will be the same, and the alternative of always having
no syntax highlighting is worse. PyCharm seems to do the same thing.
Release Notes:
- Added an `editor: diff clipboard with selection` action
---------
Co-authored-by: Junkui Zhang <364772080@qq.com>
Co-authored-by: Ben Kunkle <ben@zed.dev>
This gets rid of the need to pass context to all cursor functions. In
practice context is always immutable when interacting with cursors.
A nicety of this is in the follow-up PR we will be able to implement
Iterator for all Cursors/filter cursors (hell, we may be able to get rid
of filter cursor altogether, as it is just a custom `filter` impl on
iterator trait).
Release Notes:
- N/A
Closes #ISSUE
Simplifies the API to no longer have a variant that returns indices. The
downside is that a few places that used to call
`bindings_for_action_with_indices` now compare `Box<dyn Action>` instead
of indices, however the result is the removal of wrapper code and index
handling that is largely unnecessary
Release Notes:
- N/A *or* Added/Fixed/Improved ...
Co-authored-by: Conrad <conrad@zed.dev>
Follow up to #31836
After enabling rounding in the Taffy layout engine, we frequently run
into cases where the bounds produced by Taffy and ours slightly differ
after 5 or more decimal places. This leads to cases where containers
become scrollable for less than 0.0000x Pixels. In case this happens for
e.g. hover popovers, we render a scrollbar due to the container being
technically scrollable, even though the scroll amount here will in
practice never be visible.
This change fixes this by rounding the `scroll_max` by which we clamp
the current scroll position to two decimal places. We don't benefit from
the additional floating point precision here at all and it stops such
containers from becoming scrollable altogether. Furthermore, we now
store the `scroll_max` instead of the `padded_content_size` as the
former gives a much better idea on whether the corresponding container
is scrollable or not.
| `main` | After these changes |
| -- | -- |
| <img width="610" height="316" alt="main"
src="https://github.com/user-attachments/assets/ffcc0322-6d6e-4f79-a916-bd3c57fe4211"
/> | <img width="610" height="316" alt="scroll_max_rounded"
src="https://github.com/user-attachments/assets/5fe530f5-2e21-4aaa-81f4-e5c53ab73e4f"
/> |
Release Notes:
- Fixed an issue where scrollbars would appear in containers where no
scrolling was possible.
Wayland compositors can potentially generate thousands of resize
requests when drag-resizing a window, which Zed is unable to keep up
with. This commit changes the behavior to only resize once per vblank
cycle, which helps significantly when resizing the window with a high
poll-rate mouse (1000Hz is common these days)
Here is an example of the behavior pre and post this commit, with some
print-debugging added for tracking resize calls. I have a wireless mouse
with a 2000Hz polling rate and a 165Hz display:
Before:
https://github.com/user-attachments/assets/4c657f90-5fd2-4809-97ef-363fd48e81b8
After:
https://github.com/user-attachments/assets/4a0f5fbd-c3c4-40a1-9f71-3b4358c827cfCloses#20660
Release Notes:
- Improved: Make resizing smoother on Wayland/Linux
We've had problems in the past with bumping past 0.5.2 due to perf
regressions reported by @huacnlee; 0.5.1 was fine though.
Hence, let's bump taffy to 0.5.1 as a safe bet and then try to push past
0.5.2 (after we identify the root cause of regression
Related to #19189
Release Notes:
- N/A
Instead of selecting a screen to share arbitrarily, we'll now allow user
to select the screen to share. Note that sharing multiple screens at the
time is still not supported (though prolly not too far-fetched).
Related to #4666

Release Notes:
- Added screen selector dropdown to screen share button
---------
Co-authored-by: Kirill Bulatov <kirill@zed.dev>
Co-authored-by: Cole Miller <cole@zed.dev>