Closes https://github.com/zed-industries/zed/issues/59083 Closes https://github.com/zed-industries/zed/issues/42958 Closes https://github.com/zed-industries/zed/issues/59612 This PR improve selection copy of Agent Panel and Markdown Preview such that copied text is always valid markdown, following how VSCode handles it. The partial selection of styled text would not copy broken syntax like `bold**` or ```inline code` ``` like before. Now we follow simple rule: > Selecting any part, no matter from where, copies it as its markdown. Except when the selection sits entirely inside a single inline code span, in which case we copy plain text, for terminal and code use cases. Examples: This is **bold** text, this is *italic* text, and this is `code` all `in one` sentence. - selecting only bold → `**bold**` - selecting normal text and partial bold → `is is **bo**` - selecting a single code span completely → `code` - selecting partial code → `od` - selecting partial text and code → `` his is `cod` `` - selecting multiple code spans partially → `` `ode` all `in o` `` - selecting multiple code spans end to end → `` `code` all `in one` `` Nested spans, like **bold with `code` inside**: - partial text in bold → `**ld wi**` - partial code in bold → ``**`od`**`` - full code in bold → ``**`code`**`` - the whole sentence → ``**bold with `code` inside**`` Links, like [Visit Rust's website](https://rust.org): - partial link text → `[bsite](https://rust.org)` - full link text → `[Visit Rust's website](https://rust.org)` How it works: Selection boundaries that land inside delimiter syntax (`**`, backticks, etc.) first snap out so no delimiter is left half-selected. Then any spans the selection cuts through get their delimiters re-added, outermost first, so nested styling stays balanced. Only the root blocks containing the two selection boundaries are inspected, everything in between is copied right as is, which also keeps this cheap on large documents. Release Notes: - Improved copying selected text in Agent Panel and Markdown Preview. Partial selections of styled text now copy as well-formed markdown, and selections within a single inline code span copy as plain text.
Zed
Welcome to Zed, a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Installation
On macOS, Linux, and Windows you can download Zed directly or install Zed via your local package manager (macOS/Linux/Windows).
Other platforms are not yet available:
- Web (tracking discussion)
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
Zed source code is licensed primarily under GPL-3.0-or-later, with Apache-2.0 components where marked.
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 specifiederror for a crate you've created? If so, addpublish = falseunder[package]in your crate's Cargo.toml. - Is the error
failed to satisfy license requirementsfor 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 theacceptedarray inscript/licenses/zed-licenses.toml. - Is
cargo-aboutunable 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.
Sponsorship
Zed is developed by Zed Industries, Inc., a for-profit company.
If you’d like to financially support the project, you can do so via GitHub Sponsors. Sponsorships go directly to Zed Industries and are used as general company revenue. There are no perks or entitlements associated with sponsorship.