Skip to content

Commit

Permalink
Merge pull request #1 from Screwtapello/fix-no-selections
Browse files Browse the repository at this point in the history
Don't crash if we filter out all selections.
  • Loading branch information
ul authored Dec 29, 2018
2 parents cbc2371 + 3c91636 commit 62963df
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,11 @@ fn named_children<'a>(node: &'a Node) -> impl Iterator<Item = Node<'a>> {
}

fn select_ranges(buffer: &[String], ranges: &[Range]) -> String {
format!("select {}", ranges_to_selections_desc(&buffer, &ranges))
if ranges.is_empty() {
"fail no selections remaining".into()
} else {
format!("select {}", ranges_to_selections_desc(&buffer, &ranges))
}
}

fn node_matters(filetype_config: Option<&FiletypeConfig>, kind: &str) -> bool {
Expand Down

0 comments on commit 62963df

Please sign in to comment.