mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-24 11:01:54 +00:00
Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
ca9cee85e1
Closes #17870 Context: On Linux, when creating a new window, bounds are either pulled from existing workspace data (serialized in an SQLite DB) or fall back to some default constants if no data exists. These bounds include the full dimensions of the window (width and height), which already account for insets. However, properties like `inset` (Wayland) or `last_insets` (X11) exist only at the platform level and are not part of the window bounds themselves. During rendering, we call `set_client_inset`, which updates the inset values and also adjusts the window bounds, increasing their dimensions. In Zed's case, the inset is 10px, which adds 20px to both the width and height (10px from each side). Problem: When quitting, the full window bounds (which already account for inset) are saved to the DB. On reopening, these saved bounds are used to create the window. `set_client_inset` runs again and inflates the dimensions even more. Solution: Store window bounds *without* the inset-inflated dimensions. On the next session, `set_client_inset` will take care of applying the inset, resulting window dimensions matching the previous session. This fix is in the PR. Alternative Solution: Another option is to save the inset explicitly in the DB and apply it during window creation. But this means storing more data, and the inset would need to be platform-agnostic, which adds complexity. Doesn’t seem worth it for no real gain. X11 Before: ```sh saving window bounds with width: 1136, height: 784 tims@lemon ~/w/zed (fix-window-growing-larger)> cargo run Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.37s Running `target/debug/zed` saving window bounds with width: 1156, height: 804 <---- +20px tims@lemon ~/w/zed (fix-window-growing-larger)> cargo run Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.35s Running `target/debug/zed` saving window bounds with width: 1176, height: 824 <---- +20px tims@lemon ~/w/zed (fix-window-growing-larger)> cargo run Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.36s Running `target/debug/zed` saving window bounds with width: 1196, height: 844 <---- +20px ``` X11 After: ```sh Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.35s Running `target/debug/zed` saving window bounds with width: 1116, height: 764 tims@lemon ~/w/zed (fix-window-growing-larger)> cargo run Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.35s Running `target/debug/zed` saving window bounds with width: 1116, height: 764 <---- same tims@lemon ~/w/zed (fix-window-growing-larger)> cargo run Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.35s Running `target/debug/zed` saving window bounds with width: 1116, height: 764 <---- same ``` On Wayland, saving occurs only when you actually resize the window (on X11, saving happens both on init and while dragging the window). To trigger saving, I manually resized the window by ~1px to make it print. Wayland Before: ```sh Finished `dev` profile [unoptimized + debuginfo] target(s) in 1m 36s Running `target/debug/zed` saving window bounds with width: 945, height: 577 tims@orange ~/zed (fix-window-growing-larger)> cargo run Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.77s Running `target/debug/zed` saving window bounds with width: 966, height: 597 <--- +20px on both (1px increase in width is me resizing) tims@orange ~/zed (fix-window-growing-larger)> cargo run Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.87s Running `target/debug/zed` saving window bounds with width: 987, height: 618 <--- +20px on both (1px increase in width and height is me resizing) tims@orange ~/zed (fix-window-growing-larger)> cargo run Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.89s Running `target/debug/zed` saving window bounds with width: 1006, height: 638 <--- +20px on both (1px decrease in width is me resizing) ``` Wayland After: ```sh Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.82s Running `target/debug/zed` saving window bounds with width: 925, height: 558 tims@orange ~/zed (fix-window-growing-larger)> cargo run Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.84s Running `target/debug/zed` saving window bounds with width: 925, height: 557 <--- same (1px decrease in height is me resizing) saving window bounds with width: 925, height: 558 ``` Release Notes: - Fix non-maximized zed windows growing larger across sessions on Linux --------- Co-authored-by: mgsloan@gmail.com <michael@zed.dev> |
||
---|---|---|
.cargo | ||
.cloudflare | ||
.config | ||
.github | ||
.zed | ||
assets | ||
crates | ||
docs | ||
extensions | ||
legal | ||
nix | ||
script | ||
tooling/xtask | ||
.git-blame-ignore-revs | ||
.gitattributes | ||
.gitignore | ||
.mailmap | ||
Cargo.lock | ||
Cargo.toml | ||
clippy.toml | ||
CODE_OF_CONDUCT.md | ||
compose.yml | ||
CONTRIBUTING.md | ||
Cross.toml | ||
debug.plist | ||
default.nix | ||
docker-compose.sql | ||
Dockerfile-collab | ||
Dockerfile-collab.dockerignore | ||
Dockerfile-cross | ||
Dockerfile-cross.dockerignore | ||
Dockerfile-distros | ||
Dockerfile-distros.dockerignore | ||
flake.lock | ||
flake.nix | ||
LICENSE-AGPL | ||
LICENSE-APACHE | ||
LICENSE-GPL | ||
livekit.yaml | ||
Procfile | ||
Procfile.postgrest | ||
README.md | ||
renovate.json | ||
rust-toolchain.toml | ||
shell.nix | ||
typos.toml |
Zed
Welcome to Zed, a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Installation
On macOS and Linux you can download Zed directly or install Zed via your local package manager.
Other platforms are not yet available:
- Windows (tracking issue)
- Web (tracking issue)
Developing Zed
- Building Zed for macOS
- Building Zed for Linux
- Building Zed for Windows
- Running Collaboration Locally
Contributing
See CONTRIBUTING.md for ways you can contribute to Zed.
Also... we're hiring! Check out our jobs page for open roles.
Licensing
License information for third party dependencies must be correctly provided for CI to pass.
We use cargo-about
to automatically comply with open source licenses. If CI is failing, check the following:
- Is it showing a
no license specified
error for a crate you've created? If so, addpublish = false
under[package]
in your crate's Cargo.toml. - Is the error
failed to satisfy license requirements
for a dependency? If so, first determine what license the project has and whether this system is sufficient to comply with this license's requirements. If you're unsure, ask a lawyer. Once you've verified that this system is acceptable add the license's SPDX identifier to theaccepted
array inscript/licenses/zed-licenses.toml
. - Is
cargo-about
unable to find the license for a dependency? If so, add a clarification field at the end ofscript/licenses/zed-licenses.toml
, as specified in the cargo-about book.