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.

Document why join_lines has a special case for single-line selections (#20528)

Michael Sloan2521ef7bc447
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs
index bd78020608f..638babe7ecc 100644
--- a/crates/editor/src/editor.rs
+++ b/crates/editor/src/editor.rs
@@ -6313,6 +6313,8 @@ impl Editor {
let mut row_ranges = Vec::<Range<MultiBufferRow>>::new();
for selection in self.selections.all::<Point>(cx) {
let start = MultiBufferRow(selection.start.row);
+ // Treat single line selections as if they include the next line. Otherwise this action
+ // would do nothing for single line selections individual cursors.
let end = if selection.start.row == selection.end.row {
MultiBufferRow(selection.start.row + 1)
} else {