From 58f3c0fa328fc9ff48d17c2c3771ab9c5114aaa6 Mon Sep 17 00:00:00 2001 From: Nikolas Date: Tue, 28 Apr 2026 12:18:21 +0200 Subject: [PATCH] Don't cut off last letter in textBox() (#325) --- lib/preludes/raygui-prelude.zig | 2 +- lib/raygui.zig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/preludes/raygui-prelude.zig b/lib/preludes/raygui-prelude.zig index 15fca97..9705349 100644 --- a/lib/preludes/raygui-prelude.zig +++ b/lib/preludes/raygui-prelude.zig @@ -520,5 +520,5 @@ pub fn checkBox(bounds: Rectangle, text: [:0]const u8, checked: *bool) bool { /// Text Box control, updates input text /// Returns true on ENTER pressed (useful for data validation) pub fn textBox(bounds: Rectangle, text: [:0]u8, editMode: bool) bool { - return @as(i32, cdef.GuiTextBox(bounds, @as([*c]u8, @ptrCast(text)), @as(c_int, @intCast(text.len)), editMode)) > 0; + return @as(i32, cdef.GuiTextBox(bounds, @as([*c]u8, @ptrCast(text)), @as(c_int, @intCast(text.len)) + 1, editMode)) > 0; } diff --git a/lib/raygui.zig b/lib/raygui.zig index 26e230e..3803c16 100644 --- a/lib/raygui.zig +++ b/lib/raygui.zig @@ -520,7 +520,7 @@ pub fn checkBox(bounds: Rectangle, text: [:0]const u8, checked: *bool) bool { /// Text Box control, updates input text /// Returns true on ENTER pressed (useful for data validation) pub fn textBox(bounds: Rectangle, text: [:0]u8, editMode: bool) bool { - return @as(i32, cdef.GuiTextBox(bounds, @as([*c]u8, @ptrCast(text)), @as(c_int, @intCast(text.len)), editMode)) > 0; + return @as(i32, cdef.GuiTextBox(bounds, @as([*c]u8, @ptrCast(text)), @as(c_int, @intCast(text.len)) + 1, editMode)) > 0; } /// Enable gui controls (global state)