diff options
author | Blaž Hrastnik | 2021-04-06 08:28:56 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-04-06 08:28:56 +0000 |
commit | 015fd2ffa2993c77c023c890a13f90f0a908b151 (patch) | |
tree | c6b02c69065301efaede45730ca5109e5e7096e1 /helix-core | |
parent | 7c444439946a4617d080a87adbba528437c3b5c1 (diff) |
pairs: Use token utf8 lengths instead of 1.
Diffstat (limited to 'helix-core')
-rw-r--r-- | helix-core/src/auto_pairs.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/helix-core/src/auto_pairs.rs b/helix-core/src/auto_pairs.rs index cd052489..3ba27105 100644 --- a/helix-core/src/auto_pairs.rs +++ b/helix-core/src/auto_pairs.rs @@ -69,7 +69,7 @@ fn handle_open( let pos = range.head; let next = next_char(doc, pos); - ranges.push(Range::new(range.anchor, pos + 1)); // pos + open + ranges.push(Range::new(range.anchor, pos + open.len_utf8())); // pos + open match next { Some(ch) if !close_before.contains(ch) => { @@ -98,7 +98,7 @@ fn handle_close(doc: &Rope, selection: &Selection, _open: char, close: char) -> let pos = range.head; let next = next_char(doc, pos); - ranges.push(Range::new(range.anchor, pos + 1)); // pos + close + ranges.push(Range::new(range.anchor, pos + close.len_utf8())); // pos + close if next == Some(close) { // return transaction that moves past close |