diff options
Diffstat (limited to 'helix-lsp/src')
-rw-r--r-- | helix-lsp/src/lib.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/helix-lsp/src/lib.rs b/helix-lsp/src/lib.rs index d053dbf9..277a4c28 100644 --- a/helix-lsp/src/lib.rs +++ b/helix-lsp/src/lib.rs @@ -377,7 +377,7 @@ pub mod util { .expect("transaction must be valid for primary selection"); let removed_text = text.slice(removed_start..removed_end); - let (transaction, selection) = Transaction::change_by_selection_ignore_overlapping( + let (transaction, mut selection) = Transaction::change_by_selection_ignore_overlapping( doc, selection, |range| { @@ -420,6 +420,11 @@ pub mod util { return transaction; } + // Don't normalize to avoid merging/reording selections which would + // break the association between tabstops and selections. Most ranges + // will be replaced by tabstops anyways and the final selection will be + // normalized anyways + selection = selection.map_no_normalize(changes); let mut mapped_selection = SmallVec::with_capacity(selection.len()); let mut mapped_primary_idx = 0; let primary_range = selection.primary(); @@ -428,7 +433,6 @@ pub mod util { mapped_primary_idx = mapped_selection.len() } - let range = range.map(changes); let tabstops = tabstops.first().filter(|tabstops| !tabstops.is_empty()); let Some(tabstops) = tabstops else{ // no tabstop normal mapping |