From 65227c476071914b82720084a2a775b44e4de885 Mon Sep 17 00:00:00 2001 From: dam Date: Mon, 6 May 2024 12:50:22 +0100 Subject: Cleanup UTF helper. --- modules/TUI/module.jai | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'modules/TUI/module.jai') diff --git a/modules/TUI/module.jai b/modules/TUI/module.jai index e25672f..7c3a71d 100644 --- a/modules/TUI/module.jai +++ b/modules/TUI/module.jai @@ -398,7 +398,7 @@ get_key :: (timeout_milliseconds: s32 = -1) -> Key { // By default, parse a single UTF8 character (1 to 4 bytes). to_parse := input_string; - to_parse.count = count_utf8_bytes(input_string[0]); + to_parse.count = count_character_bytes(input_string[0]); defer advance(*input_string, to_parse.count); // Advance over parsed input. // Try to parse escape code. @@ -555,7 +555,7 @@ read_input_line :: (count_limit: int, is_visible: bool = true) -> string, Key { case; if is_escape_code(key) continue; - buff_idx := map_character_to_buffer_idx(str, idx); + buff_idx := get_byte_idx(str, idx); key_str := to_string(key,, allocator = temporary_allocator); // Make sure we have space to append the new character at the end (in case we're trying to do it). @@ -572,7 +572,7 @@ read_input_line :: (count_limit: int, is_visible: bool = true) -> string, Key { idx += 1; // Truncate string to avoid incomplete utf8 codes on the string tail. - str.count = truncate_string(str, count_limit); + truncate(*str, count_limit); } } -- cgit v1.2.3