diff options
| -rw-r--r-- | modules/TUI/module.jai | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/modules/TUI/module.jai b/modules/TUI/module.jai index 97a520b..9ef0a7e 100644 --- a/modules/TUI/module.jai +++ b/modules/TUI/module.jai @@ -425,12 +425,17 @@ read_input_line :: (count_limit: int, is_visible: bool = true) -> string, Key { case Keys.End; idx = str.count-1; + while str[idx] == 0 && idx > 0 { + idx -= 1; + } + idx += 1; case Keys.Delete; if idx == str.count-1 continue; for idx..str.count-2 { str.data[it] = str.data[it+1]; } + str.data[str.count-1] = 0; case Keys.Backspace; if idx == 0 continue; @@ -438,10 +443,15 @@ read_input_line :: (count_limit: int, is_visible: bool = true) -> string, Key { for idx..str.count-2 { str.data[it] = str.data[it+1]; } + str.data[str.count-1] = 0; case; + if idx >= str.count continue; if !is_escape_code(key) { key_str := to_string(key); + for < str.count-1..idx { + str.data[it] = str.data[it-1]; + } str.data[idx] = key_str.data[0]; idx += 1; } |
