diff options
| author | dam <dam@gudinoff> | 2024-05-05 04:19:06 +0100 |
|---|---|---|
| committer | dam <dam@gudinoff> | 2024-05-05 04:19:06 +0100 |
| commit | 54103773365e06d6da8518d135c396949e683960 (patch) | |
| tree | 464f1f1c04fd1d418c2f13bee79737b7e2a6958d /modules/TUI | |
| parent | 1ae2933bcbda43d16d2583a28c3c5a74adaaa9e4 (diff) | |
| download | task-time-tracker-54103773365e06d6da8518d135c396949e683960.tar.zst task-time-tracker-54103773365e06d6da8518d135c396949e683960.zip | |
Fixed memory leaks.
Diffstat (limited to 'modules/TUI')
| -rw-r--r-- | modules/TUI/module.jai | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/modules/TUI/module.jai b/modules/TUI/module.jai index 3f824a4..dc9643c 100644 --- a/modules/TUI/module.jai +++ b/modules/TUI/module.jai @@ -511,17 +511,17 @@ read_input_line :: (count_limit: int, is_visible: bool = true) -> string, Key { // Draw preview. if is_visible { - append(*builder, tprint(Commands.SetCursorPosition, y, x)); + print_to_builder(*builder, Commands.SetCursorPosition, y, x); append(*builder, str); for chars_count..count_limit-1 append(*builder, " "); } else { - append(*builder, tprint(Commands.SetCursorPosition, y, x)); + print_to_builder(*builder, Commands.SetCursorPosition, y, x); for 1..chars_count append(*builder, "*"); for chars_count..count_limit-1 append(*builder, " "); } - append(*builder, tprint(Commands.SetCursorPosition, y, x+idx)); - write_string(builder_to_string(*builder)); + print_to_builder(*builder, Commands.SetCursorPosition, y, x+idx); + write_string(builder_to_string(*builder,, allocator = temporary_allocator)); // Process input key. key = get_key(); @@ -600,7 +600,7 @@ draw_box :: (x: int, y: int, width: int, height: int) { append(*builder, Commands.DrawingMode); // Draw top line - append(*builder, tprint(Commands.SetCursorPosition, y, x)); + print_to_builder(*builder, Commands.SetCursorPosition, y, x); append(*builder, Drawings.CornerTL); for 1..width-2 { append(*builder, Drawings.LineH); @@ -609,14 +609,14 @@ draw_box :: (x: int, y: int, width: int, height: int) { // Draw left and right sides. for idx: y+1..y+height-2 { - append(*builder, tprint(Commands.SetCursorPosition, idx, x)); + print_to_builder(*builder, Commands.SetCursorPosition, idx, x); append(*builder, Drawings.LineV); - append(*builder, tprint(Commands.SetCursorPosition, idx, x+width-1)); + print_to_builder(*builder, Commands.SetCursorPosition, idx, x+width-1); append(*builder, Drawings.LineV); } // Draw bottom line. - append(*builder, tprint(Commands.SetCursorPosition, y+height-1, x)); + print_to_builder(*builder, Commands.SetCursorPosition, y+height-1, x); append(*builder, Drawings.CornerBL); for 1..width-2 { append(*builder, Drawings.LineH); @@ -625,7 +625,7 @@ draw_box :: (x: int, y: int, width: int, height: int) { append(*builder, Commands.TextMode); - write_string(builder_to_string(*builder)); + write_string(builder_to_string(*builder,, allocator = temporary_allocator)); } clear_terminal :: inline () { @@ -647,7 +647,7 @@ get_terminal_size :: () -> width: int, height: int { // Expected response format: \e[8;<r>;<c>t // where <r> is the number of rows and <c> of columns. FORMAT :: "\e[8;<r>;<c>t"; - input := read_input(64, #char "t",, temporary_allocator); + input := read_input(64, #char "t",, allocator = temporary_allocator); // Discard head noise. while input.count >= 3 && (input[0] != FORMAT[0] || input[1] != FORMAT[1] || input[2] != FORMAT[2]) { @@ -663,7 +663,7 @@ get_terminal_size :: () -> width: int, height: int { input[0] == FORMAT[0] && input[1] == FORMAT[1] && input[2] == FORMAT[2] && input[input.count-1] == FORMAT[FORMAT.count-1], "Failed to query window size: invalid response."); - parts := split(input, ";",, temporary_allocator); + parts := split(input, ";",, allocator = temporary_allocator); rows = parse_int(*parts[1]); columns = parse_int(*parts[2]); } @@ -696,7 +696,7 @@ get_cursor_position :: () -> x: int, y: int { // Expected response format: \e[<r>;<c>R // where <r> is the number of rows and <c> of columns. FORMAT :: "\e[<r>;<c>R"; - input := read_input(64, #char "R"); + input := read_input(64, #char "R",, allocator = temporary_allocator); // Discard head noise. while input.count >= 2 && (input[0] != FORMAT[0] || input[1] != FORMAT[1]) { @@ -713,7 +713,7 @@ get_cursor_position :: () -> x: int, y: int { "Failed to query cursor position: invalid response."); advance(*input, 2); - parts := split(input, ";",, temporary_allocator); + parts := split(input, ";",, allocator = temporary_allocator); row := parse_int(*parts[0]); column := parse_int(*parts[1]); return column, row; |
