Unnamed repository; edit this file 'description' to name the repository.
feat: print helpful suggestion when using `:{,r}sort` incorrectly (#12585)
Kristoffer Plagborg Bak Sørensen 2025-01-26
parent 259be07 · commit 7c907e6
-rw-r--r--helix-term/src/commands/typed.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs
index 8a335674..9c48bf72 100644
--- a/helix-term/src/commands/typed.rs
+++ b/helix-term/src/commands/typed.rs
@@ -2116,6 +2116,10 @@ fn sort_impl(
let selection = doc.selection(view.id);
+ if selection.len() == 1 {
+ bail!("Sorting requires multiple selections. Hint: split selection first");
+ }
+
let mut fragments: Vec<_> = selection
.slices(text)
.map(|fragment| fragment.chunks().collect())