summaryrefslogtreecommitdiff
path: root/helix-core/src/selection.rs
diff options
context:
space:
mode:
authorNathan Vegdahl2021-07-06 03:27:49 +0000
committerNathan Vegdahl2021-07-06 03:27:49 +0000
commit85d5b399de70ff075a455ce2858549d1ed012fe3 (patch)
tree4824fcb47f39551d3b31a62931adaf0ee406c02b /helix-core/src/selection.rs
parent6e15c9b8745e9708ee5271c8701d41a8393cb038 (diff)
parent3c31f501164080998975883eb6f93c49bd8d3efb (diff)
Merge branch 'master' into great_line_ending_and_cursor_range_cleanup
Diffstat (limited to 'helix-core/src/selection.rs')
-rw-r--r--helix-core/src/selection.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/helix-core/src/selection.rs b/helix-core/src/selection.rs
index 6ca798a6..64ff51d8 100644
--- a/helix-core/src/selection.rs
+++ b/helix-core/src/selection.rs
@@ -216,6 +216,16 @@ impl Range {
}
}
+impl From<(usize, usize)> for Range {
+ fn from(tuple: (usize, usize)) -> Self {
+ Self {
+ anchor: tuple.0,
+ head: tuple.1,
+ horiz: None,
+ }
+ }
+}
+
/// A selection consists of one or more selection ranges.
/// invariant: A selection can never be empty (always contains at least primary range).
#[derive(Debug, Clone, PartialEq, Eq)]