feat: print helpful suggestion when using `:{,r}sort` incorrectly (#12585)

pull/12692/head
Kristoffer Plagborg Bak Sørensen 2025-01-26 17:39:19 +01:00 committed by GitHub
parent 259be07f05
commit 7c907e66f4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 0 deletions

View File

@ -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())