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 overflow in hover handler

Conrad Irwin276032398bd2
diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs
index 309f6c7789e..6c6bfba190c 100644
--- a/crates/editor/src/element.rs
+++ b/crates/editor/src/element.rs
@@ -599,7 +599,10 @@ impl EditorElement {
return;
};
let range = DisplayPoint::new(point.row(), point.column().saturating_sub(1))
- ..DisplayPoint::new(point.row(), point.column() + 1);
+ ..DisplayPoint::new(
+ point.row(),
+ (point.column() + 1).min(snapshot.line_len(point.row())),
+ );
let range = snapshot
.buffer_snapshot