Patch #1075 2006-05-23 18:58

sethjackson

Write protected source files
Download
1075-Write_protecte.patch (555 bytes)
Category
Application::Bugfix
Status
Closed
Close date
2006-06-07 18:25
Assigned to
 
Index: src/sdk/cbeditor.cpp
===================================================================
--- src/sdk/cbeditor.cpp    (revision 2490)
+++ src/sdk/cbeditor.cpp    (working copy)
@@ -776,16 +776,16 @@
     }
 }
 
-void cbEditor::SetLanguage( HighlightLanguage lang )
+void cbEditor::SetLanguage(HighlightLanguage lang)
 {
+    if (m_pControl->GetReadOnly())
+        return;
+
     if (m_pTheme)
-    {
         m_lang = m_pTheme->Apply(this, lang);
-    }
+
     else
-    {
         m_lang = HL_AUTO;
-    }
 }
 
 bool cbEditor::Open(bool detectEncoding)
sethjackson 2006-05-23 19:02

Fix for this bug.

http://forums.codeblocks.org/index.php?topic=3162.0

IMO this seems to be the best way to do this. You could of course change SetLanguage() to return a bool, and return false if the control is read-only, but it is your call (I really didn't want to have to rebuild the SDK).

mandrav 2006-06-05 09:57

I see no problem with write-protected files. This was resolved last week. Or do you mean something else?

sethjackson 2006-06-05 12:57

Nope it is fixed now. This patch can be rejected. :)