mirror of
https://github.com/helix-editor/helix.git
synced 2025-01-19 13:37:06 +04:00
pairs: Use token utf8 lengths instead of 1.
This commit is contained in:
parent
7c44443994
commit
015fd2ffa2
@ -69,7 +69,7 @@ fn handle_open(
|
|||||||
let pos = range.head;
|
let pos = range.head;
|
||||||
let next = next_char(doc, pos);
|
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 {
|
match next {
|
||||||
Some(ch) if !close_before.contains(ch) => {
|
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 pos = range.head;
|
||||||
let next = next_char(doc, pos);
|
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) {
|
if next == Some(close) {
|
||||||
// return transaction that moves past close
|
// return transaction that moves past close
|
||||||
|
Loading…
Reference in New Issue
Block a user