Make 'wrap selections in tag' work with line selection mode (#41030)

The `wrap selections in tag` action currently did not take line_mode
into account, which means when selecting lines with `shift-v`, the
start/end tags would be inserted into the middle of the selection (where
the cursor sits)


https://github.com/user-attachments/assets/a1cbf3da-d52a-42e2-aecf-1a7b6d1dbb32

This PR fixes this behaviour by checking if the selection uses line_mode
and then adjusting start and end points accordingly.

NOTE: I looked into amending the test cases for this, but I am unsure
how to express line mode with range markers. I would appreciate some
guidance on this and then I am happy to add test cases.

After:


https://github.com/user-attachments/assets/a212c41f-b0db-4f50-866f-fced7bc677ca

Release Notes:

- Fixed `Editor: wrap selection in tags` when in vim visual line mode

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
Lukas
2025-10-28 03:07:41 +00:00
committed by GitHub
co-authored by Conrad Irwin
parent 6823847978
commit 1d0bb5a7a6
2 changed files with 51 additions and 5 deletions
+1 -1
View File
@@ -10522,7 +10522,7 @@ impl Editor {
for selection in self
.selections
.all::<Point>(&self.display_snapshot(cx))
.all_adjusted(&self.display_snapshot(cx))
.iter()
{
let Some(wrap_config) = snapshot