fix selection with wide unicode chars

This commit is contained in:
Crispy 2023-02-28 21:54:12 +01:00
parent 6c8dd2edbe
commit 59b45f57c3

View file

@ -117,7 +117,7 @@ impl Editor {
print!("{}", text.replace('\t', &" ".repeat(TAB_SIZE)));
} else {
let mut in_selection = false;
for (i, char) in text.chars().enumerate() {
for (i, char) in text.char_indices() {
let char_i = line.start + i;
if char_i >= selection.start && char_i <= selection.end && !in_selection {
color_selection();