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 shift-y on empty line in vim mode (#29253)

Conrad Irwina320d324f12e
diff --git a/crates/editor/src/display_map.rs b/crates/editor/src/display_map.rs
index a12a5213479..0bae2c02d39 100644
--- a/crates/editor/src/display_map.rs
+++ b/crates/editor/src/display_map.rs
@@ -808,10 +808,14 @@ impl DisplaySnapshot {
// used by line_mode selections and tries to match vim behavior
pub fn expand_to_line(&self, range: Range<Point>) -> Range<Point> {
let new_start = MultiBufferPoint::new(range.start.row, 0);
- let new_end = MultiBufferPoint::new(
- range.end.row,
- self.buffer_snapshot.line_len(MultiBufferRow(range.end.row)),
- );
+ let new_end = if range.end.column > 0 {
+ MultiBufferPoint::new(
+ range.end.row,
+ self.buffer_snapshot.line_len(MultiBufferRow(range.end.row)),
+ )
+ } else {
+ range.end
+ };
new_start..new_end
}