Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Fix off by one error in click ranges

Mikayla Maki269df10a16b3
diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs
index a44cb781971..239be524616 100644
--- a/crates/editor/src/element.rs
+++ b/crates/editor/src/element.rs
@@ -221,7 +221,8 @@ impl EditorElement {
position_to_display_point(e.position, text_bounds, &position_map);
if let Some(point) = point {
for (range, callback) in click_ranges.iter() {
- if range.contains(&point) {
+ // Range -> RangeInclusive
+ if range.contains(&point) || range.end == point {
callback(&e, range, &position_map.snapshot, cx)
}
}