Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Go to file
Tau Gärtli 9245015d1a
terminal: Retain relative order of responses (#16456)
Partially addresses #8497 (namely, the occurring with `delta`)

As I mentioned in
https://github.com/zed-industries/zed/issues/8497#issuecomment-2226896371,
zed currently replies to OSC color requests (`OSC 10`, `OSC 11`, ...)
out of order when immediately followed by another request (for example
`CSI c`). All other terminals that [I have
tested](https://github.com/bash/terminal-colorsaurus/blob/main/doc/terminal-survey.md)
maintain relative order when replying to requests.

## Solution
Respond to the `ColorRequest` in `process_event` (in the same place
where other PTY writes happen) instead of queuing it up in the internal
event queue.

## Alternative
I initially thought that I could handle the color request similarly to
the `TextAreaSizeRequest` where the size is stored in `last_content` and
updated on `sync`. However this causes the terminal to report
out-of-date values when a "set color" sequence is followed by a color
request.

## Tests

1. `OSC 11; ?` (request bg color) + `CSI c` (request device attributes):
   ```shell
   printf '\e]11;?\e\\ \e[c' && cat -v
   # Expected result: ^[]11;rgb:dcdc/dcdc/dddd^[\^[[?6c
# Current result: ^[[?6c^[]11;rgb:dcdc/dcdc/dddd^[\ ()
# Result with this PR: ^[]11;rgb:dcdc/dcdc/dddd^[\^[[?6c ()
# Result with alternative: ^[]11;rgb:dcdc/dcdc/dddd^[\^[[?6c ()
   ```
2. `OSC 11; rgb:f0f0/f0f0/f0f0` (set bg color) + `OSC 11; ?` (request bg
color)
   ```shell
   printf '\e]11;rgb:f0f0/f0f0/f0f0\e\\ \e]11;?\e\\' && cat -v
   # Expected result: ^[]11;rgb:f0f0/f0f0/f0f0^[\
# Current result: ^[]11;rgb:f0f0/f0f0/f0f0^[\ ()
# Result with this PR: ^[]11;rgb:f0f0/f0f0/f0f0^[\ ()
# Result with alternative: ^[]11;rgb:OUT_OF_DATE_COLOR_HERE^[\ ()
   ```

Release Notes:

- N/A
2024-08-22 16:19:24 +02:00
.cargo windows: Bump windows-rs version (#14719) 2024-07-25 10:41:59 -07:00
.cloudflare docs: Black-hole zombie pages 2024-08-20 21:37:41 -04:00
.config tests: Test 'db' package sequentially (#2654) 2023-06-28 15:00:43 +02:00
.github Update rui314/setup-mold digest to 0bf4f07 (#16613) 2024-08-21 17:23:57 -04:00
.zed Add a task for running zed in "local release" mode (#16357) 2024-08-16 17:33:04 +03:00
assets Force Vue and Svelte language servers to be the first in the list for their languages (#16654) 2024-08-22 15:36:31 +03:00
crates terminal: Retain relative order of responses (#16456) 2024-08-22 16:19:24 +02:00
docs Fix typo (#16657) 2024-08-22 14:02:41 +03:00
extensions zig: Bump to v0.3.0 (#16669) 2024-08-22 15:56:09 +02:00
legal Update Terms and Conditions (#16478) 2024-08-19 17:08:46 -04:00
script Update Terms and Conditions (#16478) 2024-08-19 17:08:46 -04:00
tooling/xtask xtask: Add command for checking packages conform to certain standards (#15236) 2024-07-25 19:20:08 -04:00
.dockerignore Update .dockerignore (#14016) 2024-07-09 16:27:55 -04:00
.git-blame-ignore-revs More ignorable commits (#14596) 2024-07-16 17:09:50 -04:00
.gitattributes Prevent GitHub from displaying comments within JSON files as errors (#7043) 2024-01-29 23:11:25 -05:00
.gitignore Add the ability to store secret dev-only env vars in .env.secret.toml (#15557) 2024-07-31 12:41:09 -07:00
.mailmap Update .mailmap (#16640) 2024-08-21 18:51:58 -04:00
Cargo.lock zig: Bump to v0.3.0 (#16669) 2024-08-22 15:56:09 +02:00
Cargo.toml Replace lazy_static with std::sync::LazyLock (#16066) 2024-08-20 14:27:33 -04:00
CODE_OF_CONDUCT.md Add CODE_OF_CONDUCT.md (#4239) 2024-01-23 22:31:39 -05:00
compose.yml Add Postgrest to Docker Compose (#16498) 2024-08-19 20:50:45 -04:00
CONTRIBUTING.md docs: Fix some typos (#13509) 2024-06-25 10:58:11 -04:00
debug.plist WIP 2023-12-14 09:25:14 -07:00
docker-compose.sql collab: Setup database for LLM service (#15882) 2024-08-06 17:18:08 -04:00
Dockerfile collab: Setup database for LLM service (#15882) 2024-08-06 17:18:08 -04:00
flake.lock Add Nix/NixOS dev-shell (#13407) 2024-07-09 09:21:42 +02:00
flake.nix Add Nix/NixOS dev-shell (#13407) 2024-07-09 09:21:42 +02:00
LICENSE-AGPL chore: Add crate licenses. (#4158) 2024-01-23 16:56:22 +01:00
LICENSE-APACHE chore: Add crate licenses. (#4158) 2024-01-23 16:56:22 +01:00
LICENSE-GPL Licenses: change license fields in Cargo.toml to AGPL-3.0-or-later. (#5535) 2024-01-27 13:51:16 +01:00
livekit.yaml Add LiveKit server to Docker Compose (#7907) 2024-02-16 10:49:48 -05:00
Procfile Refactor: Restructure collab main function to prepare for new subcommand: serve llm (#15824) 2024-08-05 12:07:38 -07:00
Procfile.postgrest Fix llm queries (#16006) 2024-08-08 17:21:38 -07:00
README.md Update README.md 2024-07-09 14:05:29 -07:00
renovate.json renovate: Fix wasmtime package prefix 2024-07-25 11:45:14 -04:00
rust-toolchain.toml chore: Bump Rust version to 1.80 (#15186) 2024-07-25 22:48:42 +02:00
shell.nix Point PROTOC to nixpkgs.protobuf pkg in shell.nix (#15931) 2024-08-07 16:35:49 -04:00
typos.toml Promote package suggestions to a first-class concept on IndexedDocsProviders (#16177) 2024-08-13 16:01:58 -04:00

Zed

CI

Welcome to Zed, a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.


Installation

Packaging status

On macOS and Linux you can download Zed directly or install Zed via your local package manager.

Other platforms are not yet available:

Developing Zed

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, add publish = 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 the accepted array in script/licenses/zed-licenses.toml.
  • Is cargo-about unable to find the license for a dependency? If so, add a clarification field at the end of script/licenses/zed-licenses.toml, as specified in the cargo-about book.