Commit graph

3313 commits

Author SHA1 Message Date
Mikayla Maki
4064af3458
Preserve and restore focus across window activation cycles (#47044)
Closes https://github.com/zed-industries/zed/issues/46953

This turned out to be a pretty deep rabbit hole, ultimately landing in
how GPUI didn't restore focus nicely when swapping window activation
states.

Release Notes:

- N/A

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 02:57:06 +00:00
Lukas Wirth
3ed6c68f3b
gpui: Fix utf8 slicing panic in truncate_line (#46914)
Fixes https://github.com/zed-industries/zed/issues/46904

Release Notes:

- Fixed a panic in the git panel when utf8 multibyte character filenames
got truncated
2026-01-15 16:02:54 +00:00
Marshall Bowers
adf2fec2e0
Revert "gpui: Add dynamic padding to prevent glyph clipping in text rendering on macOS (#45957)" (#46906)
This reverts commit 83ca31055c.

This change produces bad clipping on macOS:

<img width="59" height="80" alt="Screenshot 2026-01-15 at 8 51 28 AM"
src="https://github.com/user-attachments/assets/e1e295a4-f25c-4144-aa85-ec2fbbba03a8"
/>

<img width="218" height="67" alt="Screenshot 2026-01-15 at 8 51 35 AM"
src="https://github.com/user-attachments/assets/e662f8df-b009-445e-afee-3440b7fc52f0"
/>

<img width="303" height="43" alt="Screenshot 2026-01-15 at 8 51 41 AM"
src="https://github.com/user-attachments/assets/c972a1be-a07b-4b5f-970b-f75a51dac6b8"
/>

https://zed-industries.slack.com/archives/C04S5TU0RSN/p1768473926260279

Release Notes:

- Reverted #45957
2026-01-15 14:04:21 +00:00
Jony Lab
83ca31055c
gpui: Add dynamic padding to prevent glyph clipping in text rendering on macOS (#45957)
Here may caused by [font-kit](https://github.com/servo/font-kit), I was
tried to use
[render-glyph](https://github.com/servo/font-kit/blob/main/examples/render-glyph.rs)
example and also use the same option with `Transform2F::from_scale(2.0)`
for `raster_bounds`.

Then the `raster_bounds` will result same issue like the GPUI's font
rendering issue.

| Transform2F::default() | Transform2F::from_scale(2.) |
| --- | -- |
| <img width="943" height="638" alt="image"
src="https://github.com/user-attachments/assets/9b827c63-2cbb-45d3-bd62-b0e058a46614"
/> | <img width="943" height="638" alt="image"
src="https://github.com/user-attachments/assets/ee977a9b-2a7b-4b78-873b-146b2953c0db"
/> |

## Before

<img width="1032" height="1398" alt="SCR-20260105-pgcp-2"
src="https://github.com/user-attachments/assets/ebeb04cc-3a92-4333-99fc-8733a63b2553"
/>

## After

<img width="1032" height="1414" alt="SCR-20260105-pfny-1"
src="https://github.com/user-attachments/assets/063d0452-56d7-447c-810b-fee7c891235b"
/>

Release Notes:

- Fixed incorrect rendering of characters at large font sizes on macOS

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-authored-by: Jason Lee <huacnlee@gmail.com>
2026-01-14 21:46:42 -05:00
John Tur
95c698d31d
Fix emoji on Linux when using High DPI (#46857)
Fixes https://github.com/zed-industries/zed/issues/46849

Release Notes:

- Fixed emoji being too small on Linux when using High DPI
2026-01-15 02:40:13 +00:00
Conrad Irwin
4aa3cd07c3
Revert "Revert scheduler update (#46659)" (#46671)
Reland the new scheduler

Release Notes:

- N/A

---------

Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>
2026-01-14 07:19:13 +00:00
Bo He
d92f47746f
linux: Fix duplicate IME input on Wayland and Sunshine remotes (#46560)
## Summary
This PR fixes a issue where Chinese characters (and other IME-based
inputs) would duplicate in the editor on Linux Wayland after remote
desktop connected (e.g., via Sunshine) .

## Steps to Reproduce
requirement: linux with wayland, and Sunshine(this is remote desktop
server) installed
1. opening zed
2. using other device connect to Sunshine
3. input Chinese characters such as "的"

### Expected Result
"的"

### Actual Result
"的的"

### bug recording

https://github.com/user-attachments/assets/d18961ec-48cb-4c06-a396-9fc604591769
2026-01-13 22:04:30 -05:00
Conrad Irwin
8b4ab260e6
Revert scheduler update (#46659)
Reverts the new scheduler; it's destroyed our CI

Release Notes:

- N/A
2026-01-12 16:46:15 -07:00
Finn Evers
f651c4c340
gpui: Remove unused flume dependency (#46647)
Only the scheduler crate uses this currently, so we can remove this from
the long list of GPUI dependencies.

Release Notes:

- N/A
2026-01-12 20:19:13 +00:00
Antonio Scandurra
816e5f5c73
Fix panic when using RealtimeAudio priority (#46635)
The scheduler integration (#44810) removed the special handling for
realtime audio tasks that spawn them on a dedicated thread. This caused
a panic in the Mac dispatcher when RealtimeAudio priority was passed to
the regular dispatch path.

This restores the original behavior: RealtimeAudio tasks are spawned on
a dedicated thread via dispatcher.spawn_realtime(), using a bounded
channel to send runnables to it.

Release Notes:

- N/A
2026-01-12 17:55:51 +00:00
Lukas Wirth
37b05605e2
gpui(windows): Force a paint message when running out foreground budget (#46609)
Release Notes:

- Fixed zed no longer rendering on windows in a timely manner if it gets
overloaded with foreground work

Co-authored-by: John Tur <john-tur@outlook.com>
2026-01-12 14:17:21 +00:00
Martin Pool
3f2c7c6d30
Use let chain to avoid clippy::unnecessary_unwrap (#46409)
No bug, just shows up running the tests on `clippy 0.1.92 (ded5c06cf2
2025-12-08)`

Release Notes:

- N/A
2026-01-11 10:20:08 +02:00
John Tur
af6385a293
Fix Windows IME composition string being displayed incorrectly (#46545)
Previously, a new composition string was processed before a new
composition result. Thus, in the case that a keystroke creates a new
composition result and composition string, the processing of the new
result would overwrite the new string, even though they should both be
displayed. Processing them in the reverse order fixes this issue.
 
Fixes #42201

Additionally: while fixing this issue, I discovered that the Japanese
IME sometimes moves the cursor far away from the inserted text. WPF
works around this issue by only respecting the IME's requested cursor
position if it's adjacent to uncommitted text. So, we copy this
workaround.

Release Notes:

- N/A
2026-01-11 05:10:51 +00:00
Nathan Sobo
73d935330e
Integrate scheduler crate into GPUI (#44810)
## Motivation

This PR unifies the async execution infrastructure between GPUI and
other components that depend on the `scheduler` crate (such as our cloud
codebase). By having a scheduler that lives independently of GPUI, we
can enable deterministic testing across the entire stack - testing GPUI
applications alongside cloud services with a single, unified scheduler.

## Summary

This PR completes the integration of the `scheduler` crate into GPUI,
unifying async execution and enabling deterministic testing of GPUI
combined with other components that depend on the scheduler crate.

## Key Changes

### Scheduler Integration (Phases 1-5, previously completed)
- `TestDispatcher` now delegates to `TestScheduler` for timing, clock,
RNG, and task scheduling
- `PlatformScheduler` implements the `Scheduler` trait for production
use
- GPUI executors wrap scheduler executors, selecting `TestScheduler` or
`PlatformScheduler` based on environment
- Unified blocking logic via `Scheduler::block()`

### Dead Code Cleanup
- Deleted orphaned `crates/gpui/src/platform/platform_scheduler.rs`
(older incompatible version)

## Intentional Removals

### `spawn_labeled` and `deprioritize` removed
The `TaskLabel` system (`spawn_labeled`, `deprioritize`) was removed
during this integration. It was only used in a few places for test
ordering control.

cc @maxbrunsfeld @as-cii - The new priority-weighted scheduling in
`TestScheduler` provides similar functionality through
`Priority::High/Medium/Low`. If `deprioritize` is important for specific
test scenarios, we could add it back to the scheduler crate. Let me know
if this is blocking anything.

### `start_waiting` / `finish_waiting` debug methods removed
Replaced by `TracingWaker` in `TestScheduler` - run tests with
`PENDING_TRACES=1` to see backtraces of pending futures when parking is
forbidden.

### Realtime Priority removed
The realtime priority feature was unused in the codebase. I'd prefer to
reintroduce it when we have an actual use case, as the implementation
(bounded channel with capacity 1) could potentially block the main
thread. Having a real use case will help us validate the design.

## Testing
- All GPUI tests pass
- All scheduler tests pass
- Clippy clean

## Architecture

```
┌─────────────────────────────────────────────────────────────┐
│                          GPUI                                │
│  ┌──────────────────────┐    ┌────────────────────────────┐ │
│  │ gpui::Background-    │    │ gpui::ForegroundExecutor   │ │
│  │ Executor             │    │  - wraps scheduler::       │ │
│  │  - scheduler: Arc<   │    │    ForegroundExecutor      │ │
│  │    dyn Scheduler>    │    └────────────┬───────────────┘ │
│  └──────────┬───────────┘                 │                  │
│             │                             │                  │
│             └──────────┬──────────────────┘                  │
│                        ▼                                     │
│            ┌───────────────────────┐                         │
│            │  Arc<dyn Scheduler>   │                         │
│            └───────────┬───────────┘                         │
│         ┌──────────────┴──────────────┐                      │
│         ▼                             ▼                      │
│  ┌──────────────────┐      ┌────────────────────┐           │
│  │ PlatformScheduler│      │   TestScheduler    │           │
│  │   (production)   │      │ (deterministic)    │           │
│  └──────────────────┘      └────────────────────┘           │
└─────────────────────────────────────────────────────────────┘
```

Release Notes:

- N/A

---------

Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Yara <git@yara.blue>
Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>
2026-01-10 15:41:49 +01:00
Mikayla Maki
93e3a39077
Simplify networking tests even more (#46489)
Release Notes:

- N/A
2026-01-10 00:30:33 +00:00
Richard Feldman
558a741d75
Visual test infrastructure improvements (#46324)
This PR improves the visual test infrastructure:

- Adds controllable foreground executor for deterministic task
scheduling
- Adds tooltip hover testing capability
- Improves error handling in visual test runner
- Includes planning documentation for the approach

Release Notes:

- N/A
2026-01-09 03:56:14 +00:00
Max Brunsfeld
c17b48782b
Revert "Make tasks inherit their callers priority" (#46413)
Reverts zed-industries/zed#46179

⚠️ Don't merge this until we confirm that it fixes the performance
regression when saving buffers while scrolling ⚠️
2026-01-08 22:04:18 -05:00
Richard Feldman
0e97c18fd6
Add breakpoint hover visual tests with VisualTestPlatform (#46404)
Implements visual tests for breakpoint hover states in the editor gutter
with three states:
1. **No hover** - just line numbers
2. **Hover with indicator** - blue circle appears next to the line
3. **Hover with tooltip** - shows 'Set breakpoint' with F9 keybinding

- Added `VisualTestPlatform` that combines real Mac rendering with
controllable `TestDispatcher` for deterministic task scheduling and time
control
- Added `VisualTestAppContext::with_asset_source()` to enable SVG icon
rendering in visual tests (uses real Assets instead of empty source)
- Added F9 keybinding for ToggleBreakpoint so tooltip shows the
keybinding
- Removed debug `eprintln!` statements from editor, element, svg, and
window

The `VisualTestPlatform` enables `advance_clock()` which is essential
for testing time-based behaviors like tooltip delays. Without
deterministic time control, tests for hover states and tooltips would be
flaky.

Release Notes:

- N/A
2026-01-08 21:04:50 -05:00
Danilo Leal
f18b288fdf
gpui: Fix bug on on_hover callbacks (#46371)
Tackling this as I noticed a bug in the agent panel where the button to
delete a thread, which appeared only on hover, stopped showing up. PRs
#43324 and #45437 fixed stuff in applying hover styles through
`.hover()` but broke the `.on_hover()` callback. Problem was that both
methods were sharing the same `element_state.hover_state` but running at
different phases. The solution here was to add a new independent state
field for the hover listener (`hover_listener_state`) while the hover
style method keeps using `hover_state`.

Release Notes:

- Agent: Fixed a bug where the button to delete a thread stopped showing
up.
2026-01-08 19:47:22 -03:00
Xiaobo Liu
cfa478dde4
windows: Improve error message for credential write failures (#46221)
Release Notes:

- Improved Display the actual Windows error message when writing
credentials to Credential Manager fails, instead of the generic "Failed
to write API key to keychain" message. This helps users diagnose issues
like permission problems.

Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
2026-01-08 10:01:42 +00:00
Oleksandr Kholiavko
05efa59fc6
Add variable row height mode to table UI element (#46190)
## Add variable row height mode to data table infrastructure

This PR introduces support for variable row heights in the data table
component, laying the groundwork for more flexible tabular data
rendering in Zed.

**Context:**  
This is the first in a series of infrastructure-focused PRs split out
from the [original CSV preview draft
PR](https://github.com/zed-industries/zed/pull/44344). The draft PR
remains open as a reference and will be incrementally decomposed into
smaller, reviewable pieces like this one.

**Details:**  
- Adds a variable row height mode to the data table, enabling future
features that require rows of differing heights (such as CSV preview
and, eventually, database table views).
- No user-facing changes; this is an internal refactor to support
upcoming functionality.

**Thanks:**  
Big thanks to @Anthony-Eid for pairing sessions and guidance on how to
best structure and land these changes incrementally.

---

Release Notes:

- N/A (internal infrastructure change, no user impact)
2026-01-07 22:04:38 +00:00
Mikayla Maki
97c35c084b
gpui: Actually remove the Result from AsyncApp (#45809)
Depends on: https://github.com/zed-industries/zed/pull/45768

Refactor plan:
https://gist.github.com/mikayla-maki/6c4bf263fd80050715ba01f45478796e
Overall plan:
https://gist.github.com/mikayla-maki/7bb5078e4385a2e683e1e1eb40d17d38

This is the big one.

Release Notes:

- N/A

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 12:48:24 -08:00
John Tur
a3733b8f60
Use transparent clear color for opaque windows on Linux (#46281)
https://github.com/zed-industries/zed/pull/45423 changed the Blade
renderer to use a white clear color for "opaque" windows. This interacts
poorly with our client-side decorations, causing the shadows around the
window to be drawn over a white background.

Release Notes:

- N/A
2026-01-07 19:39:57 +00:00
Yara 🏳️‍⚧️
1ac2b977fa
Make tasks inherit their callers priority (#46179)
Additionally this extracts more functionality into the RunnableVariant which is renamed to GpuiRunnable. 

Release Notes:

- N/A

---------

Co-authored-by: Lukas Wirth <lukas@zed.dev>
Co-authored-by: Cole Miller <cole@zed.dev>
2026-01-07 15:52:10 +00:00
Mikayla Maki
8f961a41c6
gpui: Make all foreground tasks drop when the app dies (#46219)
This expands the liveness check to cover all foreground tasks that don't
take the app as a context (as some of their internal futures might.)

Release Notes:

- N/A
2026-01-07 02:13:05 +00:00
Mikayla Maki
09ce318a78
Add a GPUI testing example (#46215)
Had some trouble in a PR with missing a test API change until deep into
a refactor. Decided to move some example tests into the GPUI repo to put
those through their paces, and got carried away and made a big test
example file demonstrating all the testing features we have.

Release Notes:

- N/A

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 01:39:48 +00:00
Dino
bbb3d515fb
settings_ui: Fix scrollbar breaking when UI font size changes (#45099)
When the UI font size changes, the settings window's scrollbar would
break because list item measurements were cached and not invalidated.

We're using `ListState.measure_all()` to pre-measure all items for an
accurate scrollbar. When font size changes, these cached measurements
become stale but weren't being refreshed.

This commit fixes the issue by calling `ListState.measure_all()` when
settings change, ensuring items are re-measured on the next layout
without affecting scroll position.

Closes #43683

Release Notes:

- Fixed bug where changing the UI Font Size in the Settings UI would
break the scrollbar for the "Appearance" page

---------

Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>
2026-01-06 11:38:39 +00:00
John Tur
47d2694dcc
Add support for subpixel text rendering (#45423)
Subpixel text rendering is now implemented on Windows and Linux.

Comparison screenshots:

|Before|After|
| ------------- | ------------- |
| <img width="400"
src="https://github.com/user-attachments/assets/9d720d2c-2ec4-4adf-a83f-7c2d81d30025"
/> | <img width="400"
src="https://github.com/user-attachments/assets/8fd7dc2a-8ca0-4f71-86cd-55460f568f7a"
/> |


Release Notes:

- Added support for subpixel (ClearType-style) text rendering. This
improves the legibility of text on standard DPI displays. Subpixel
rendering is enabled by default on Windows and Linux and can be
configured using the `text_rendering_mode` setting.

---------

Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2026-01-06 03:46:31 -05:00
Richard Feldman
8c0b088366
Screenshot testing (#45259)
## Screenshot testing

Adds visual testing infrastructure for GPUI that captures screenshots by
rendering directly to Metal textures. The

The screenshots end up in `target/visual_tests/` and look like this:

<img width="2560" height="1600" alt="workspace_with_editor2"
src="https://github.com/user-attachments/assets/54112343-4af1-4347-9bab-f099de97dd29"
/>
<img width="2560" height="1600" alt="project_panel2"
src="https://github.com/user-attachments/assets/0cd54b61-dace-4398-a28e-0b4d7c2968f6"
/>


### Key Features

- **Direct texture capture**: Screenshots are captured by rendering the
scene to a Metal texture and reading pixels directly from GPU memory,
rather than using ScreenCaptureKit
- **No visibility requirements**: Windows don't need to be visible on
screen since we read directly from the render pipeline
- **Deterministic output**: Captures exactly what GPUI renders, not what
the OS compositor displays
- **No permissions needed**: Doesn't require Screen Recording permission
like ScreenCaptureKit would

### Running the Visual Tests

```bash
# Run visual tests (compares against baselines)
cargo run -p zed --bin visual_test_runner --features visual-tests

# Update baseline images (when UI intentionally changes)
UPDATE_BASELINE=1 cargo run -p zed --bin visual_test_runner --features visual-tests

# View the captured screenshots
open target/visual_tests/
```

### Implementation

- `Window::render_to_image()` - Renders the current scene to a texture
and returns an `RgbaImage`
- `MetalRenderer::render_to_image()` - Core implementation that renders
to a non-framebuffer-only texture
- `VisualTestAppContext` - Test context that uses real macOS platform
rendering
- `VisualTestAppContext::capture_screenshot()` - Synchronous screenshot
capture using direct texture rendering

### Usage

```rust
let mut cx = VisualTestAppContext::new();
let window = cx.open_window(...)?;
let screenshot: RgbaImage = cx.capture_screenshot(window.into())?;
```

Release Notes:

- N/A

---------

Co-authored-by: Amp <amp@ampcode.com>
2026-01-05 16:34:36 -05:00
Lukas Wirth
4e0e7cfde7
windows: Fix IME candidate window not appearing at cursor position (#46079)
Release Notes:

- Fixed some IME popups and the emoji picker not appearing at the cursor
position on windows
2026-01-05 15:48:52 +00:00
Lukas Wirth
ccce05d25c
language: Fix reparse timeout not actually working (#45347)
We use `block_with_timeout` to give the reparse task a millisecond to
complete, and if it takes longer we put the work off to the background.
The reason for this is that we want tree-sitter based features to feel
snappy.
The reparse task is non-cooperative though, it has no yield points,
giving us no place to actually check for our timeout, meaning we will
always drive it to completion and block for the entire duration.
This kicks out the `block_with_timeout` in favor of using the treesitter
progress callback to handle timeouts instead.

Release Notes:

- Improved responsiveness with very language language files on edits
2026-01-05 14:18:09 +00:00
Yara 🏳️‍⚧️
794fa9d6d1
Revert "Revert windows implementation of "Multiple priority scheduler (#44701)"" (#46066)
Reverts zed-industries/zed#44990

Release Notes:

- N/A
2026-01-05 11:56:10 +01:00
Marco Mihai Condrache
e57285fe39
gpui: Prepaint Div children with image cache (#46039)
Closes #39914

I was able to reproduce the issue on macOS using the same README.

The root cause was that `markdown_preview_view` attaches the image cache
to the root div, and while Div correctly applies that cache during
request_layout and paint, the prepaint phase didn’t have the same
context.

Markdown is rendered through a List, and `List::prepaint` renders its
items using `layout_as_root`. That meant images were getting loaded
during prepaint without the image cache in place. When that happened,
Img fell back to the global asset loader, which retains assets
indefinitely unless explicitly cleaned up.

So every image was loaded twice:

- once during layout/paint via RetainAllImageCache (correctly released
when the preview closed)
- once during prepaint via the global asset system (never released)

The result was doubled memory usage and a leak, since the globally
loaded images stuck around after the preview was closed.

Release Notes:

- Fixed a memory leak when previewing markdown files with images

Signed-off-by: Marco Mihai Condrache <52580954+marcocondrache@users.noreply.github.com>
2026-01-05 09:30:46 +01:00
Mikayla Maki
e8fbd5beaf
gpui: Cancel foreground tasks when the app is dropped (#45768)
This is in preparation for removing `Result<T>` from the `AsyncApp`
methods

Refactor machine goes brrrrrr

Plan and tracker for this PR:
https://gist.github.com/mikayla-maki/7dfc0d4907e76de119b5712e24665f02

This PR should be safe to merge, as I cannot observe any changes in
behavior from adding this to our application.

Release Notes:

- N/A
2026-01-04 23:00:54 -08:00
YangAo
48a109264b
gpui: Add clipboard pasting support for DIB images on Windows (#45695)
- Added handling for DIB format, converting to BMP after adding the
corresponding file header

Release Notes:

- fix: Unable to paste images from clipboard directly into agent panel
on Windows

---------

Co-authored-by: Lukas Wirth <me@lukaswirth.dev>
2026-01-04 13:22:20 +00:00
Mayank Verma
045e154915
gpui: Fix hover state getting stuck when rapidly hovering over elements (#45437)
Closes #45436

Release Notes:

- N/A

---------

Co-authored-by: MrSubidubi <finn@zed.dev>
2025-12-21 22:07:30 +00:00
Lukas Wirth
0884305e43
gpui(windows): Don't log incorrect errors on SetActiveWindow calls (#45493)
The function returns the previous focus handle, which may be null if
there is no previous focus. Unfortunately that also overlaps with the
error return value, so winapi will hand us a error 0 back in those cases
which we log ...


Release Notes:

- N/A *or* Added/Fixed/Improved ...
2025-12-21 16:14:23 +00:00
Marco Mihai Condrache
213cb30445
gpui: Enable direct-to-display optimization for metal (#45434)
Continuing of #44334 

I removed disabling of vsync which was causing jitter on some external
displays

cc: @maxbrunsfeld @Anthony-Eid 

Release Notes:

- Mark metal layers opaque for non-transparent windows to allow
direct-to-display when supported

Signed-off-by: Marco Mihai Condrache <52580954+marcocondrache@users.noreply.github.com>
2025-12-21 11:17:02 +02:00
Danilo Leal
0facdfa5ca
editor: Make TextAlign::Center and TextAlign::Right work (#45417)
Closes https://github.com/zed-industries/zed/issues/43208

This PR essentially unblocks the editable number field. The function
that shapes editor lines was hard-coding text alignment to the left,
meaning that whatever different alignment we'd pass through
`EditorStyles`would be ignored. To solve this, I just added a text align
and align width fields to the line paint function and updated all call
sites keeping the default configuration. Had to also add an
`alignment_offset()` helper to make sure the cursor positioning, the
selection background element, and the click-to-focus functionality were
kept in-sync with the non-left aligned editor.

Then... the big star of the show here is being able to add the `mode`
method to the number field, which uses `TextAlign::Center`, thus making
it work as we designed it to work.


https://github.com/user-attachments/assets/3539c976-d7bf-4d94-8188-a14328f94fbf

Next up, is turning the number filed to edit mode where applicable.

Release Notes:

- Fixed a bug where different text alignment configurations (i.e.,
center and right-aligned) wouldn't take effect in editors.
2025-12-19 17:37:15 -08:00
Lieunoir
42d5f7e73e
Set override_redirect for PopUps (#42224)
Currently on x11, gpui PopUp windows only rely on the "notification"
type in order to indicate that they should spawn as floating window.
Several window managers (leftwm in my case, but it also seems to be the
case for dwm and ratpoison) do not this property into account thus not
spawning them as float. On the other hand, using Floating instead of
PopUp do make those windows spawn as floating, as these window manager
do take into account the (older) "dialog" type.

The [freedekstop
documentation](https://specifications.freedesktop.org/wm/1.5/ar01s05.html#id-1.6.7)
does seem to suggest that these windows should also have the override
redirect property :
> This property is typically used on override-redirect windows. 

Note that this also disables pretty much all interactions with the
window manager (such as moving the window, resizing etc...)

Release Notes:

- Fix popup windows not spawning floating sometime on x11
2025-12-19 16:38:45 -08:00
Mayank Verma
1d76539d28
gpui: Fix hover styles not being applied during layout (#43324)
Closes #43214

Release Notes:

- Fixed GPUI hover styles not being applied during layout

Here's the before/after:


https://github.com/user-attachments/assets/5b1828bb-234a-493b-a33d-368ca01a773b
2025-12-19 16:33:32 -08:00
jkugs
e5eb26e8d6
gpui: Reset mouse scroll state on FocusOut to prevent large jumps (#43841)
This fixes an X11 scrolling issue where Zed may jump by a large amount
due to the scroll valuator state not being reset when the window loses
focus. If you Alt-Tab away from Zed, scroll in another application, then
return, the first scroll event in Zed applies the entire accumulated
delta instead of a single step.

The missing FocusOut reset was originally identified in issue #34901.

Resetting scroll positions on FocusOut matches the behavior already
implemented in the XinputLeave handler and prevents this jump.

Closes #34901
Closes #40538

Release Notes:

- Fixed an X11 issue where Alt-Tabbing to another application,
scrolling, and returning to Zed could cause the next scroll event to
jump by a large amount.
2025-12-19 16:29:44 -08:00
Serophots
a86b0ab2e0
gpui: Improve the tab stop example by demonstrating tab_group (#44647)
I've just enriched the existing tab_stop.rs example for GPUI with a
demonstration of tab_group. I don't think tab groups existed when the
original example was written.

(I didn't understand the behaviour for tab_group from the doccomments
and the example was missing, so I think this is a productive PR)

Release Notes:

- N/A
2025-12-20 00:29:26 +00:00
Jason Lee
5fb220a19a
gpui: Add a Popover example for test deferred (#44473)
Release Notes:

- N/A

<img width="1036" height="659" alt="image"
src="https://github.com/user-attachments/assets/8ca06306-719f-4495-92b3-2a609aa09249"
/>
2025-12-19 16:27:41 -08:00
Max Brunsfeld
6dfabddbb4
Revert "gpui: Enable direct-to-display optimization for metal" (#45405)
Reverts zed-industries/zed#44334

From my testing, this PR introduced screen tearing, or some kind of
strange visual artifact, when scrolling at medium speed on a large
display.

Release notes:

- N/A
2025-12-19 15:21:10 -08:00
Agus Zubiaga
d7e41f74fb
search: Respect macOS' find pasteboard (#45311)
Closes #17467

Release Notes:

- On macOS, buffer search now syncs with the system find pasteboard,
allowing <kbd>⌘E</kbd> and <kbd>⌘G</kbd> to work seamlessly across Zed
and other apps.
2025-12-19 13:31:27 -03:00
Danilo Leal
32600f255a
gpui: Fix truncation flickering (#45373)
It's been a little that we've noticed some flickering and other weird
resizing behavior with text truncation in Zed:


https://github.com/user-attachments/assets/4d5691a3-cd3d-45e0-8b96-74a4e0e273d2


https://github.com/user-attachments/assets/d1d0e587-7676-4da0-8818-f4e50f0e294e

Initially, we suspected this could be due to how we calculate the length
of a line to insert truncation, which is based first on the length of
each individual character, and then second goes through a pass
calculating the line length as a whole. This could cause mismatch and
culminate in our bug.

However, even though that felt like a reasonable suspicion, I realized
something rather simple at some point: the `truncate` and
`truncate_start` methods in the `Label` didn't use `whitespace_nowrap`.
If you take Tailwind as an example, their `truncate` utility class takes
`overflow: hidden; text-overflow: ellipsis; white-space: nowrap;`. This
pointed out to a potential bug with `whitespace_nowrap` where that was
blocking truncation entirely, even though that's technically part of
what's necessary to truncate as you don't want text that will be
truncated to wrap.

Ultimately, what was happening was that the text element was caching its
layout based on its `wrap_width` but not considering its
`truncate_width`. The truncate width is essentially the new definitive
width of the text based on the available space, which was never being
computed. So the fix here was to add `truncate_width.is_none()` to the
cache validation check, so that it only uses the cached text element
size _if the truncation width is untouched_. But if that changes, we
need to account for the new width. Then, in the Label component, we
added `min_w_0` to allow the label div to shrink below its original
size, and finally, we added `whitespace_nowrap()` as the cache check
fundamentally fixed that method's problem.

In a future PR, we can basically remove the `single_line()` label method
because: 1) whenever you want a single label, you most likely want it to
truncate, and 2) most instances of `truncate` are already followed by
`single_line` in Zed today, so we can cut that part.

Result is no flickering with truncated labels!


https://github.com/user-attachments/assets/ae17cbde-0de7-42ca-98a4-22fcb452016b

Release Notes:

- Fixed a bug in GPUI where truncated text would flicker as you resized
the container in which the text was in.

Co-authored-by: Lukas Wirth <me@lukaswirth.dev>
2025-12-19 13:14:31 -03:00
Antonio Scandurra
b603372f44
Reduce GPU usage by activating VRR optimization only during high-rate input (#45369)
Fixes #29073

This PR reduces unnecessary GPU usage by being more selective about when
we present frames to prevent display underclocking (VRR optimization).

## Problem

Previously, we would keep presenting frames for 1 second after *any*
input event, regardless of whether it triggered a re-render. This caused
unnecessary GPU work when the user was idle or during low-frequency
interactions.

## Solution

1. **Only track input that triggers re-renders**: We now only record
input timestamps when the input actually causes the window to become
dirty, rather than on every input event.

2. **Rate-based activation**: The VRR optimization now only activates
when input arrives at a high rate (≥ 60fps over the last 100ms). This
means casual mouse movements or occasional keystrokes won't trigger
continuous frame presentation.

3. **Sustained optimization**: Once high-rate input is detected (e.g.,
during scrolling or dragging), we sustain frame presentation for 1
second to prevent display underclocking, even if input briefly pauses.

## Implementation

Added `InputRateTracker` which:
- Tracks input timestamps in a 100ms sliding window
- Activates when the window contains ≥ 6 events (60fps × 0.1s)
- Extends a `sustain_until` timestamp by 1 second each time high rate is
detected

Release Notes:

- Reduced GPU usage when idle by only presenting frames during bursts of
high-frequency input.
2025-12-19 16:06:28 +01:00
Yara 🏳️‍⚧️
7427924405
adjusted scheduler prioritization algorithm (#45367)
This fixes a number of issues where zed depends on the order of polling which changed when switching scheduler. We have adjusted the algorithm so it matches the previous order while keeping the prioritization feature.

Release Notes:
- N/A
2025-12-19 15:03:35 +00:00
Danilo Leal
62d36b22fd
gpui: Add text_ellipsis_start method (#45122)
This PR is an additive change introducing the `truncate_start` method to
labels, which gives us the ability to add an ellipsis at the beginning
of the text as opposed to the regular `truncate`. This will be generally
used for truncating file paths, where the end is typically more relevant
than the beginning, but given it's a general method, there's the
possibility to be used anywhere else, too.

<img width="500" height="690" alt="Screenshot 2025-12-17 at 12  35@2x"
src="https://github.com/user-attachments/assets/f853f5a3-60b3-4380-a11c-bb47868a4470"
/>

Release Notes:

- N/A

---------

Co-authored-by: Lukas Wirth <lukas@zed.dev>
2025-12-19 10:25:19 -03:00