From 59b45f57c3062a83c553573e178b4278b7ba7537 Mon Sep 17 00:00:00 2001 From: CrispyPin Date: Tue, 28 Feb 2023 21:54:12 +0100 Subject: [PATCH] fix selection with wide unicode chars --- src/editor.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/editor.rs b/src/editor.rs index 69287e4..6d8ae98 100644 --- a/src/editor.rs +++ b/src/editor.rs @@ -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();