Skip to content

Commit

Permalink
feat: print helpful suggestion when using :{,r}sort incorrectly (#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
kpbaks authored Jan 26, 2025
1 parent 259be07 commit 7c907e6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions helix-term/src/commands/typed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit 7c907e6

Please sign in to comment.