Commit: b8adae3cb229364f892a3befa81fbc9f8617e3d1
Parent: bb148acd60f4a870d621c335b05ff0ee35e5bfa2
Author: Randy Palamar
Date: Wed, 9 Oct 2024 22:44:34 -0600
stop NUL terminating input buffer
the rest of the code touching it uses the stored length now
Diffstat:
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/ui.c b/ui.c
@@ -249,10 +249,8 @@ do_text_input(BeamformerCtx *ctx, i32 max_disp_chars, Rect r, Color colour)
/* NOTE: handle multiple input keys on a single frame */
i32 key = GetCharPressed();
while (key > 0) {
- if (ctx->is.buf_len == (ARRAY_COUNT(ctx->is.buf) - 1)) {
- ctx->is.buf[ARRAY_COUNT(ctx->is.buf) - 1] = 0;
+ if (ctx->is.buf_len == ARRAY_COUNT(ctx->is.buf))
break;
- }
b32 allow_key = ((key >= '0' && key <= '9') || (key == '.') ||
(key == '-' && ctx->is.cursor == 0));