aff4c25a472228e7071600a6102d7bbecb9df980
### Summary Restore the agent pane’s code-block horizontal scrollbar for easier scrolling without trackpad and preserve individual scroll state across multiple code blocks. ### Motivation Addresses https://github.com/zed-industries/zed/issues/34224, where agent responses with wide code snippets couldn’t be scrolled horizontally in the panel. Previously there is no visual effect for scrollbar to let the user move the code snippet and it was not obviously to use trackpad or hold down `shift` while scrolling. This PR will ensure the user being able to only use their mouse to drag the horizontal scrollbar to show the complete line when the code overflow the width of code block. ### Changes - Support auto-hide horizontal scrollbar for rendering code block in agent panel by adding scrollbar support in markdown.rs - Add `code_block_scroll_handles` cache in _crates/markdown/src/markdown.rs_ to give each code block a persistent `ScrollHandle`. - Wrap rendered code blocks with custom horizontal scrollbars that match the vertical scrollbar styling and track hover visibility. - Retain or clear scroll handles based on whether horizontal overflow is enabled, preventing leaks when the markdown re-renders. ### How to Test 1. Open the agent panel, request code generation, and ensure wide snippets show a horizontal scrollbar on hover. 3. Scroll horizontally, navigate away (e.g., change tabs or trigger a re-render), and confirm the scroll position sticks when returning. 5. Toggle horizontal overflow styling off/on (if applicable) and verify scrollbars appear or disappear appropriately. ### Screenshots / Demos (if UI change) https://github.com/user-attachments/assets/e23f94d9-8fe3-42f5-8f77-81b1005a14c8 ### Notes for Reviewers - This is my first time contribution for `zed`, sorry for any code patten inconsistency. So please let me know if you have any comments and suggestions to make the code pattern consistent and easy to maintain. - For now, the horizontal scrollbar is not configurable from the setting and the style is fixed with the same design as the vertical one. I am happy to readjust this setting to fit the needs. - Please let me know if you think any behaviors or designs need to be changed for the scrollbar. - All changes live inside _crates/markdown/src/markdown.rs_; no API surface changes. Closes #34224 ### Release Notes: - AI: Show horizontal scroll-bars in wide markdown elements
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.
Other platforms are not yet available:
- 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 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.
Description
GPUI – Community Edition maintained by Oak Team
https://gpui-ce.github.io/
258 MiB
Languages
Rust
95.6%
WGSL
1.2%
Metal
1.1%
HLSL
1.1%
Python
0.6%
Other
0.3%