]> git.saurik.com Git - wxWidgets.git/blobdiff - src/stc/stc.cpp.in
set device origin when drawing on a frame in order to not overwrite the menu/toolbar...
[wxWidgets.git] / src / stc / stc.cpp.in
index 7459ffa401ed44758d28da62f1087e280ba8effd..a859ec1a47e8a2a97f2987770cc25193c92e7a73 100644 (file)
@@ -356,9 +356,12 @@ bool wxStyledTextCtrl::LoadFile(const wxString& filename)
         if (len > 0)
         {
 #if wxUSE_UNICODE
-            wxMemoryBuffer buffer(len);
+            wxMemoryBuffer buffer(len+1);
             success = (file.Read(buffer.GetData(), len) == len);
-            contents = wxString(buffer, *wxConvCurrent);
+           if (success) {
+                ((char*)buffer.GetData())[len] = 0;
+                contents = wxString(buffer, *wxConvCurrent, len);
+            }
 #else
             wxString buffer;
             success = (file.Read(wxStringBuffer(buffer, len), len) == len);