From 36b958c1204a6ce28d5dc3b3173641b9ef79e3e3 Mon Sep 17 00:00:00 2001 From: Karl Zylinski Date: Wed, 30 Oct 2024 11:09:46 +0100 Subject: [PATCH] Fix for using utf8string.at with last rune index returning wrong rune. --- core/unicode/utf8/utf8string/string.odin | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/unicode/utf8/utf8string/string.odin b/core/unicode/utf8/utf8string/string.odin index 431939efe..4b0fe7241 100644 --- a/core/unicode/utf8/utf8string/string.odin +++ b/core/unicode/utf8/utf8string/string.odin @@ -66,7 +66,7 @@ at :: proc(s: ^String, i: int, loc := #caller_location) -> (r: rune) { return case s.rune_count-1: - r, s.width = utf8.decode_rune_in_string(s.contents) + r, s.width = utf8.decode_last_rune(s.contents) s.rune_pos = i s.byte_pos = _len(s.contents) - s.width return