From 2521ef7bc447a241e5e6169f01d386a8d5049c84 Mon Sep 17 00:00:00 2001 From: Michael Sloan Date: Mon, 11 Nov 2024 21:28:26 -0700 Subject: [PATCH] Document why join_lines has a special case for single-line selections (#20528) Release Notes: - N/A --- crates/editor/src/editor.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index bd78020608f91b7636895e9bdd17f267ebd05527..638babe7ecc36be9e6191f0d5b480a1b7caf119f 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -6313,6 +6313,8 @@ impl Editor { let mut row_ranges = Vec::>::new(); for selection in self.selections.all::(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 {