Don't cut off last letter in textBox() (#325)

This commit is contained in:
Nikolas committed 2026-04-28 12:18:21 +02:00
1 parent 47766db82f
commit 58f3c0fa32
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -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;
}
+1 -1
View File
@@ -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)