Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/ImGui.NET/ImGui.Manual.ReadOnlySpan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public static bool InputText(
utf8LabelBytes = stackPtr;
}
Util.GetUtf8(label, utf8LabelBytes, utf8LabelByteCount);
utf8LabelBytes[utf8LabelByteCount] = 0;

bool ret;
fixed (byte* bufPtr = buf)
Expand Down Expand Up @@ -111,6 +112,7 @@ public static bool InputText(
utf8LabelBytes = stackPtr;
}
Util.GetUtf8(label, utf8LabelBytes, utf8LabelByteCount);
utf8LabelBytes[utf8LabelByteCount] = 0;

int utf8InputByteCount = Encoding.UTF8.GetByteCount(input);
int inputBufSize = Math.Max((int)maxLength + 1, utf8InputByteCount + 1);
Expand Down Expand Up @@ -201,6 +203,7 @@ public static bool InputTextMultiline(
utf8LabelBytes = stackPtr;
}
Util.GetUtf8(label, utf8LabelBytes, utf8LabelByteCount);
utf8LabelBytes[utf8LabelByteCount] = 0;

int utf8InputByteCount = Encoding.UTF8.GetByteCount(input);
int inputBufSize = Math.Max((int)maxLength + 1, utf8InputByteCount + 1);
Expand Down Expand Up @@ -292,6 +295,7 @@ public static bool InputTextWithHint(
utf8LabelBytes = stackPtr;
}
Util.GetUtf8(label, utf8LabelBytes, utf8LabelByteCount);
utf8LabelBytes[utf8LabelByteCount] = 0;

int utf8HintByteCount = Encoding.UTF8.GetByteCount(hint);
byte* utf8HintBytes;
Expand All @@ -305,6 +309,7 @@ public static bool InputTextWithHint(
utf8HintBytes = stackPtr;
}
Util.GetUtf8(hint, utf8HintBytes, utf8HintByteCount);
utf8HintBytes[utf8HintByteCount] = 0;

int utf8InputByteCount = Encoding.UTF8.GetByteCount(input);
int inputBufSize = Math.Max((int)maxLength + 1, utf8InputByteCount + 1);
Expand Down Expand Up @@ -439,6 +444,7 @@ public static bool InputText(
utf8LabelBytes = stackPtr;
}
Util.GetUtf8(label, utf8LabelBytes, utf8LabelByteCount);
utf8LabelBytes[utf8LabelByteCount] = 0;

bool ret = ImGuiNative.igInputText(utf8LabelBytes, (byte*)buf.ToPointer(), buf_size, flags, callback, user_data.ToPointer()) != 0;

Expand All @@ -464,6 +470,7 @@ public static bool Begin(ReadOnlySpan<char> name, ImGuiWindowFlags flags)
utf8NameBytes = stackPtr;
}
Util.GetUtf8(name, utf8NameBytes, utf8NameByteCount);
utf8NameBytes[utf8NameByteCount] = 0;

byte* p_open = null;
byte ret = ImGuiNative.igBegin(utf8NameBytes, p_open, flags);
Expand Down
7 changes: 7 additions & 0 deletions src/ImGui.NET/ImGui.Manual.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public static bool InputText(
utf8LabelBytes = stackPtr;
}
Util.GetUtf8(label, utf8LabelBytes, utf8LabelByteCount);
utf8LabelBytes[utf8LabelByteCount] = 0;

bool ret;
fixed (byte* bufPtr = buf)
Expand Down Expand Up @@ -107,6 +108,7 @@ public static bool InputText(
utf8LabelBytes = stackPtr;
}
Util.GetUtf8(label, utf8LabelBytes, utf8LabelByteCount);
utf8LabelBytes[utf8LabelByteCount] = 0;

int utf8InputByteCount = Encoding.UTF8.GetByteCount(input);
int inputBufSize = Math.Max((int)maxLength + 1, utf8InputByteCount + 1);
Expand Down Expand Up @@ -197,6 +199,7 @@ public static bool InputTextMultiline(
utf8LabelBytes = stackPtr;
}
Util.GetUtf8(label, utf8LabelBytes, utf8LabelByteCount);
utf8LabelBytes[utf8LabelByteCount] = 0;

int utf8InputByteCount = Encoding.UTF8.GetByteCount(input);
int inputBufSize = Math.Max((int)maxLength + 1, utf8InputByteCount + 1);
Expand Down Expand Up @@ -288,6 +291,7 @@ public static bool InputTextWithHint(
utf8LabelBytes = stackPtr;
}
Util.GetUtf8(label, utf8LabelBytes, utf8LabelByteCount);
utf8LabelBytes[utf8LabelByteCount] = 0;

int utf8HintByteCount = Encoding.UTF8.GetByteCount(hint);
byte* utf8HintBytes;
Expand All @@ -301,6 +305,7 @@ public static bool InputTextWithHint(
utf8HintBytes = stackPtr;
}
Util.GetUtf8(hint, utf8HintBytes, utf8HintByteCount);
utf8HintBytes[utf8HintByteCount] = 0;

int utf8InputByteCount = Encoding.UTF8.GetByteCount(input);
int inputBufSize = Math.Max((int)maxLength + 1, utf8InputByteCount + 1);
Expand Down Expand Up @@ -435,6 +440,7 @@ public static bool InputText(
utf8LabelBytes = stackPtr;
}
Util.GetUtf8(label, utf8LabelBytes, utf8LabelByteCount);
utf8LabelBytes[utf8LabelByteCount] = 0;

bool ret = ImGuiNative.igInputText(utf8LabelBytes, (byte*)buf.ToPointer(), buf_size, flags, callback, user_data.ToPointer()) != 0;

Expand All @@ -460,6 +466,7 @@ public static bool Begin(string name, ImGuiWindowFlags flags)
utf8NameBytes = stackPtr;
}
Util.GetUtf8(name, utf8NameBytes, utf8NameByteCount);
utf8NameBytes[utf8NameByteCount] = 0;

byte* p_open = null;
byte ret = ImGuiNative.igBegin(utf8NameBytes, p_open, flags);
Expand Down