]> git.saurik.com Git - wxWidgets.git/blobdiff - src/stc/stc.cpp
give the panel 3D grey colour by default: as it's not a native control, we must give...
[wxWidgets.git] / src / stc / stc.cpp
index d3e43c21a74287d861ac9fe015956be1b5b6b6e0..c3a5c5a725bfd36fb744765e1410e358f2decb16 100644 (file)
@@ -2547,9 +2547,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);