From cd275b91b54df394e0121da37259c1604a4b30b5 Mon Sep 17 00:00:00 2001 From: Eric Mellino Date: Mon, 22 Aug 2016 00:27:41 -0700 Subject: [PATCH] Fix a bug in TextInputBuffer --- src/ImGui.NET/TextInputBuffer.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ImGui.NET/TextInputBuffer.cs b/src/ImGui.NET/TextInputBuffer.cs index 347863b..1423b21 100644 --- a/src/ImGui.NET/TextInputBuffer.cs +++ b/src/ImGui.NET/TextInputBuffer.cs @@ -104,6 +104,9 @@ namespace ImGuiNET unsafe { Unsafe.CopyBlock(Buffer.ToPointer(), tempNativeString.ToPointer(), bytesToCopy); + byte* endOfData = (byte*)Buffer.ToPointer() + bytesToCopy; + uint bytesToClear = _length - bytesToCopy; + Unsafe.InitBlock(endOfData, 0, bytesToClear); } Marshal.FreeHGlobal(tempNativeString); }