diff options
Diffstat (limited to 'modules/TUI')
| -rw-r--r-- | modules/TUI/module.jai | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/modules/TUI/module.jai b/modules/TUI/module.jai index 5993676..98afe3d 100644 --- a/modules/TUI/module.jai +++ b/modules/TUI/module.jai @@ -389,9 +389,8 @@ read_input :: (count_limit: int = -1, terminators: .. u8) -> string { // TODO UNTESTED read_input_line :: (count_limit: int, is_visible: bool = true) -> string, Key { assert(count_limit >= 0, "Invalid value on count_limit parameter."); - str := alloc_string(count_limit); + str := alloc_string(count_limit); // TODO Alloc like a boss... - // TODO Show blinking cursor write_strings(Commands.StartBlinking, Commands.BlinkingUnderlineShape); row, col := get_cursor_position(); @@ -461,10 +460,19 @@ read_input_line :: (count_limit: int, is_visible: bool = true) -> string, Key { // append(*builder, str); // set_cursor_position(row, col); // write_builder(*builder, false); - set_cursor_position(row, col+idx); - for idx..count_limit print_character(#char " "); - set_cursor_position(row, col); - write_string(str); + if is_visible { + set_cursor_position(row, col+idx); + for idx..count_limit print_character(#char " "); + set_cursor_position(row, col); + write_string(str); + } + else { + set_cursor_position(row, col); + for 0..str.count-1 { + char := cast(u8) ifx str[it] != 0 then #char "*" else #char " "; + print_character(char); + } + } // print(">%<", builder_to_string(*builder,, temporary_allocator)); set_cursor_position(row, col+idx); } |
