]> git.saurik.com Git - wxWidgets.git/blobdiff - src/html/m_pre.cpp
added test for writing empty value to the config
[wxWidgets.git] / src / html / m_pre.cpp
index a474a1ec385af0b07b05f00ce3d70bd810cf816b..e6e26c6c85dbd1fea2750bef2d3fc8deaa30e728 100644 (file)
 #endif
 
 #ifndef WXPRECOMP
 #endif
 
 #ifndef WXPRECOMP
-#include "wx/wx.h"
 #endif
 
 #endif
 
-
 #include "wx/html/forcelnk.h"
 #include "wx/html/m_templ.h"
 
 #include "wx/html/forcelnk.h"
 #include "wx/html/m_templ.h"
 
@@ -62,21 +60,19 @@ TAG_HANDLER_BEGIN(PRE, "PRE")
         c = m_WParser->OpenContainer();
         c->SetAlignHor(wxHTML_ALIGN_LEFT);
 
         c = m_WParser->OpenContainer();
         c->SetAlignHor(wxHTML_ALIGN_LEFT);
 
-        wxString src, srcMid;
-
-        src = *m_WParser->GetSource();
-        srcMid = src.Mid(tag.GetBeginPos(), 
-                         tag.GetEndPos1() - tag.GetBeginPos());
+        wxString srcMid = 
+            m_WParser->GetSource()->Mid(tag.GetBeginPos(),
+                                        tag.GetEndPos1() - tag.GetBeginPos());
         srcMid.Replace(wxT("\t"), wxT("        "));
         srcMid.Replace(wxT(" "), wxT(" "));
         srcMid.Replace(wxT("\n"), wxT("<br>"));
 
         // It is safe to temporarily change the source being parsed,
         // provided we restore the state back after parsing
         srcMid.Replace(wxT("\t"), wxT("        "));
         srcMid.Replace(wxT(" "), wxT("&nbsp;"));
         srcMid.Replace(wxT("\n"), wxT("<br>"));
 
         // It is safe to temporarily change the source being parsed,
         // provided we restore the state back after parsing
-        m_Parser->SetSource(srcMid);
+        m_Parser->SetSourceAndSaveState(srcMid);
         m_Parser->DoParsing();
         m_Parser->DoParsing();
-        m_Parser->SetSource(src);
-        
+        m_Parser->RestoreState();
+
         m_WParser->CloseContainer();
         c = m_WParser->OpenContainer();
 
         m_WParser->CloseContainer();
         c = m_WParser->OpenContainer();