summaryrefslogtreecommitdiff
path: root/helix-core/src/transaction.rs
diff options
context:
space:
mode:
authorBlaž Hrastnik2020-09-28 16:00:35 +0000
committerBlaž Hrastnik2020-09-28 16:00:35 +0000
commit3020077da8efbf914a9cb0a2cbb50362d339a39a (patch)
treeaf8eaf9c016ac5116f6349a6b5ebb79e77f8efb5 /helix-core/src/transaction.rs
parentfbe313779e83728b7dca7925df722c7fb4228d98 (diff)
Extend selection commands.
Diffstat (limited to 'helix-core/src/transaction.rs')
-rw-r--r--helix-core/src/transaction.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/helix-core/src/transaction.rs b/helix-core/src/transaction.rs
index 127cdaee..278e071b 100644
--- a/helix-core/src/transaction.rs
+++ b/helix-core/src/transaction.rs
@@ -1,4 +1,5 @@
use crate::{Range, Rope, Selection, State, Tendril};
+use std::convert::TryFrom;
/// (from, to, replacement)
pub type Change = (usize, usize, Option<Tendril>);
@@ -112,7 +113,7 @@ impl ChangeSet {
let (pos, _) = s.char_indices().nth(len - j).unwrap();
// calculate the difference
let to_drop = s.len() - pos;
- s.pop_back(to_drop as u32);
+ s.pop_back(u32::try_from(to_drop).unwrap());
head_a = Some(Insert(s));
head_b = changes_b.next();
}
@@ -136,7 +137,7 @@ impl ChangeSet {
let (pos, _) = s.char_indices().nth(j).unwrap();
// calculate the difference
let to_drop = s.len() - pos;
- s.pop_back(to_drop as u32);
+ s.pop_back(u32::try_from(to_drop).unwrap());
head_a = Some(Insert(s));
head_b = changes_b.next();
}