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.

editor: Fix an error when cut with vim visual line select (#17591)

CharlesChen08233613ebd93c13
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs
index 4792c6b2cb8..515cde1908a 100644
--- a/crates/editor/src/editor.rs
+++ b/crates/editor/src/editor.rs
@@ -6671,7 +6671,11 @@ impl Editor {
let is_entire_line = selection.is_empty() || self.selections.line_mode;
if is_entire_line {
selection.start = Point::new(selection.start.row, 0);
- selection.end = cmp::min(max_point, Point::new(selection.end.row + 1, 0));
+ if !selection.is_empty() && selection.end.column == 0 {
+ selection.end = cmp::min(max_point, selection.end);
+ } else {
+ selection.end = cmp::min(max_point, Point::new(selection.end.row + 1, 0));
+ }
selection.goal = SelectionGoal::None;
}
if is_first {