From 65227c476071914b82720084a2a775b44e4de885 Mon Sep 17 00:00:00 2001 From: dam Date: Mon, 6 May 2024 12:50:22 +0100 Subject: Cleanup UTF helper. --- ttt.jai | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'ttt.jai') diff --git a/ttt.jai b/ttt.jai index 3f7ac59..0802220 100644 --- a/ttt.jai +++ b/ttt.jai @@ -718,10 +718,9 @@ import_from_csv :: (db: *Database, path: string) -> bool { task: Task; csv_values := split(line, ",",, temporary_allocator); - // Import task name. - name_length := min(task.name.count, csv_values[0].count); - memcpy(task.name.data, csv_values[0].data, name_length); - truncate_string(xx task.name, name_length); + // Truncate and import task name. + truncate(*csv_values[0], task.name.count); + memcpy(task.name.data, csv_values[0].data, csv_values[0].count); advance(*csv_values); for csv_values @@ -1466,7 +1465,7 @@ main :: () { // Change task name. TUI.using_style(action_style); input := read_input_string(2, selected_task_row, Task.name.count, size_x - 2 - Task.name.count,, temporary_allocator); - if is_empty_string(input) == false { + if is_empty(input) == false { replace_chars(input, "\t\x0B\x0C\r", #char " "); // Replace weird spaces with space. memset(selected_task.name.data, 0, Task.name.count); memcpy(selected_task.name.data, input.data, min(Task.name.count, input.count)); @@ -1516,7 +1515,7 @@ main :: () { input := read_input_string(input_pos_x, selected_task_row, input_width,, temporary_allocator); // Abort if input if empty. - if is_empty_string(input) continue; + if is_empty(input) continue; // Search for assign '=' operator and discard everything before it. assign_idx := find_index_from_left(input, "="); -- cgit v1.2.3