zed/crates/editor/src
Tim Vermeulen cc409210c1
editor: Fix hit testing when the editor is clipped (#56861)
Fixes editor hit testing when the editor is clipped, most easily
noticeable in a partially off-screen markdown block in the agent panel.

`PositionMap::point_for_position` was indexing into `self.line_layouts`
relative to the editor's scroll position (which in this example doesn't
apply because these editors don't scroll), rather than relative to
`self.visible_row_range.start`. This caused the reported column to not
always be computed using the correct row, which especially impacted rows
closer to the bottom of the editor. Notice how closer to the bottom,
`point_for_position` reports the correct row, but reports the column as
0:


https://github.com/user-attachments/assets/2a5b2c8b-2994-4983-a33b-ede209ba00e6




Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- Fixes selection not always matching the mouse position in a markdown
block in the agent panel
2026-05-15 11:43:39 +00:00
..
display_map Rust 1.95 (#55104) 2026-04-29 10:27:47 +00:00
editor_tests gpui: Add property_test macro (#50935) 2026-03-06 14:03:45 +00:00
git Require multibuffer excerpts to be ordered and nonoverlapping (#52364) 2026-04-01 17:25:32 +00:00
inlays Require multibuffer excerpts to be ordered and nonoverlapping (#52364) 2026-04-01 17:25:32 +00:00
scroll editor: Add preserve scroll strategy for go to definition (#55036) 2026-04-29 07:29:15 +00:00
test Remove smol as a dependency from a bunch of crates (#53603) 2026-04-24 10:29:51 +00:00
actions.rs editor: Add base64 encode/decode commands (#55361) 2026-05-05 04:36:18 +00:00
blink_manager.rs Revert "Revert scheduler update (#46659)" (#46671) 2026-01-14 07:19:13 +00:00
bookmarks.rs editor: Introduce Bookmarks (#54174) 2026-04-17 13:54:43 +02:00
bracket_colorization.rs Require multibuffer excerpts to be ordered and nonoverlapping (#52364) 2026-04-01 17:25:32 +00:00
clangd_ext.rs Merge gpui::Task and scheduler::Task (#53674) 2026-05-05 22:41:13 +00:00
code_actions.rs editor: Extract completions and code_actions out of editor.rs (#56030) 2026-05-07 13:02:11 +00:00
code_completion_tests.rs agent_ui: Render skills as creases (#56689) 2026-05-14 22:20:34 +00:00
code_context_menus.rs agent_ui: Render skills as creases (#56689) 2026-05-14 22:20:34 +00:00
code_lens.rs Clip flex editor blocks to the text viewport (#56549) 2026-05-12 20:06:01 +00:00
completions.rs agent_ui: Render skills as creases (#56689) 2026-05-14 22:20:34 +00:00
config.rs editor: Extract rewrap and config out of editor.rs (#55855) 2026-05-06 11:57:36 +00:00
diagnostics.rs editor: Extract rewrap and config out of editor.rs (#55855) 2026-05-06 11:57:36 +00:00
display_map.rs editor: Extend underlines into inlay hints (#56407) 2026-05-13 06:52:46 +00:00
document_colors.rs Rust 1.95 (#55104) 2026-04-29 10:27:47 +00:00
document_symbols.rs editor: Fix breadcrumb syntax colors not updating when theme changes (#53185) 2026-04-11 16:52:27 +00:00
edit_prediction_tests.rs agent_ui: Render skills as creases (#56689) 2026-05-14 22:20:34 +00:00
editor.rs Remove code lens from the diff view (#56726) 2026-05-14 09:39:44 +00:00
editor_block_comment_tests.rs editor: Add action to toggle block comments (#48752) 2026-04-08 22:29:16 +03:00
editor_settings.rs Add text icons for completion items (#56396) 2026-05-12 06:29:16 +00:00
editor_tests.rs agent_ui: Render skills as creases (#56689) 2026-05-14 22:20:34 +00:00
element.rs editor: Fix hit testing when the editor is clipped (#56861) 2026-05-15 11:43:39 +00:00
fold.rs editor: Extract fold and selection out of editor.rs (#56070) 2026-05-07 16:14:47 +00:00
folding_ranges.rs git: Fix diff hunks not being removed on restore in remote projects (#54823) 2026-05-07 17:40:28 +00:00
git.rs git: Add setting to hide stage/restore buttons (#56740) 2026-05-14 12:37:00 +00:00
highlight_matching_bracket.rs editor: Fix bracket highlight flickering when editing (#49797) 2026-02-21 11:19:56 +00:00
hover_links.rs editor: Support file:line:col navigation from hover links (#55877) 2026-05-06 15:47:59 +00:00
hover_popover.rs Merge gpui::Task and scheduler::Task (#53674) 2026-05-05 22:41:13 +00:00
indent_guides.rs Add vim/emacs modeline support (#49267) 2026-03-25 03:15:51 +00:00
inlays.rs Require multibuffer excerpts to be ordered and nonoverlapping (#52364) 2026-04-01 17:25:32 +00:00
input.rs editor: Extract navigation out of editor.rs (#56634) 2026-05-14 07:20:51 +00:00
items.rs Fix macOS find query seeding (#56681) 2026-05-13 23:35:10 +00:00
jsx_tag_auto_close.rs Require multibuffer excerpts to be ordered and nonoverlapping (#52364) 2026-04-01 17:25:32 +00:00
linked_editing_ranges.rs Require multibuffer excerpts to be ordered and nonoverlapping (#52364) 2026-04-01 17:25:32 +00:00
lsp_ext.rs lsp: Reduce lsp log spam for unimportant failures (#55732) 2026-05-05 06:57:05 +00:00
mouse_context_menu.rs Gate Format Selections on whether the active formatter can actually format ranges (#53178) 2026-04-16 09:11:22 +03:00
movement.rs editor: Fix forward word movement over inline folds in agent panel (#53979) 2026-04-16 11:25:08 +01:00
navigation.rs editor: Extract navigation out of editor.rs (#56634) 2026-05-14 07:20:51 +00:00
persistence.rs Fix shared database test isolation (#51809) 2026-03-18 12:05:57 -07:00
rewrap.rs editor: Extract rewrap and config out of editor.rs (#55855) 2026-05-06 11:57:36 +00:00
runnables.rs Fix "Run Debugger" failing silently when project does not compile (#52439) 2026-05-04 06:50:38 +00:00
rust_analyzer_ext.rs Merge gpui::Task and scheduler::Task (#53674) 2026-05-05 22:41:13 +00:00
scroll.rs editor: Un-pub ScrollManager (#55767) 2026-05-05 13:01:02 +00:00
selection.rs editor: Extract navigation out of editor.rs (#56634) 2026-05-14 07:20:51 +00:00
selections_collection.rs Require multibuffer excerpts to be ordered and nonoverlapping (#52364) 2026-04-01 17:25:32 +00:00
semantic_tokens.rs git: Fix diff hunks not being removed on restore in remote projects (#54823) 2026-05-07 17:40:28 +00:00
signature_help.rs markdown: Refactor code block copy button visibility to use enum (#52817) 2026-04-01 09:05:03 +00:00
split.rs Remove code lens from the diff view (#56726) 2026-05-14 09:39:44 +00:00
split_editor_view.rs Require multibuffer excerpts to be ordered and nonoverlapping (#52364) 2026-04-01 17:25:32 +00:00
tasks.rs Require multibuffer excerpts to be ordered and nonoverlapping (#52364) 2026-04-01 17:25:32 +00:00
test.rs Require multibuffer excerpts to be ordered and nonoverlapping (#52364) 2026-04-01 17:25:32 +00:00