aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-06-07 00:26:49 +0000
committerBlaž Hrastnik2021-06-07 00:26:49 +0000
commit01b1bd15a1536244f9cd9ffd7c29ae9bfca66613 (patch)
tree957acfbe1d4bd9256fbcdf8f566ee0a7c751c822 /helix-term/src
parentff8a031cb2c2044b79539a7d278f14b0fc915a07 (diff)
commands: use chars().count() over .len() on strings
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/commands.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 52d3acbc..f260d3eb 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -1220,7 +1220,7 @@ fn open(cx: &mut Context, open: Open) {
let text = text.repeat(count);
// calculate new selection range
- let pos = index + text.len();
+ let pos = index + text.chars().count();
ranges.push(Range::new(pos, pos));
(index, index, Some(text.into()))
@@ -1811,7 +1811,7 @@ pub mod insert {
text.push('\n');
text.push_str(&indent);
- let head = pos + offs + text.len();
+ let head = pos + offs + text.chars().count();
// TODO: range replace or extend
// range.replace(|range| range.is_empty(), head); -> fn extend if cond true, new head pos
@@ -1833,7 +1833,7 @@ pub mod insert {
text.push_str(&indent);
}
- offs += text.len();
+ offs += text.chars().count();
(pos, pos, Some(text.into()))
});