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

This commit is contained in:
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

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