Patch #1104 2006-06-07 20:41
kkez
"Fold all on file open" fix- Download
- 1104-Fold_all_on_fi.patch (2.3 KB)
Index: src/sdk/cbeditor.cpp
===================================================================
--- src/sdk/cbeditor.cpp (revision 2537)
+++ src/sdk/cbeditor.cpp (working copy)
@@ -384,8 +384,10 @@
// Manager::Get()->GetMessageManager()->DebugLog(_T("ctor: Filename=%s\nShort=%s"), m_Filename.c_str(), m_Shortname.c_str());
CreateEditor();
+
+ SetEditorStyleBeforeFileOpen();
m_IsOK = Open();
- SetEditorStyle();
+ SetEditorStyleAfterFileOpen();
// if !m_IsOK then it's a new file, so set the modified flag ON
if (!m_IsOK && filename.IsEmpty())
@@ -563,6 +565,12 @@
void cbEditor::SetEditorStyle()
{
+ SetEditorStyleBeforeFileOpen();
+ SetEditorStyleAfterFileOpen();
+}
+
+void cbEditor::SetEditorStyleBeforeFileOpen()
+{
ConfigManager* mgr = Manager::Get()->GetConfigManager(_T("editor"));
wxFont font(8, wxMODERN, wxNORMAL, wxNORMAL);
@@ -610,14 +618,6 @@
m_pControl->SetTabWidth(mgr->ReadInt(_T("/tab_size"), 4));
- // line numbering
- m_pControl->SetMarginType(0, wxSCI_MARGIN_NUMBER);
- if (mgr->ReadBool(_T("/show_line_numbers"), true))
- m_pData->SetLineNumberColWidth();
-
- else
- m_pControl->SetMarginWidth(0, 0);
-
// margin for bookmarks, breakpoints etc.
// FIXME: how to display a mark with an offset???
m_pControl->SetMarginWidth(1, 16);
@@ -709,6 +709,18 @@
SetLanguage( HL_AUTO );
}
+void cbEditor::SetEditorStyleAfterFileOpen()
+{
+ ConfigManager* mgr = Manager::Get()->GetConfigManager(_T("editor"));
+
+ // line numbering
+ m_pControl->SetMarginType(0, wxSCI_MARGIN_NUMBER);
+ if (mgr->ReadBool(_T("/show_line_numbers"), true))
+ m_pData->SetLineNumberColWidth();
+ else
+ m_pControl->SetMarginWidth(0, 0);
+}
+
void cbEditor::SetColourSet(EditorColourSet* theme)
{
m_pTheme = theme;
Index: src/sdk/cbeditor.h
===================================================================
--- src/sdk/cbeditor.h (revision 2537)
+++ src/sdk/cbeditor.h (working copy)
@@ -220,6 +220,8 @@
bool DoFoldLine(int line, int fold); // 0=unfold, 1=fold, 2=toggle
void CreateEditor();
void SetEditorStyle();
+ void SetEditorStyleBeforeFileOpen();
+ void SetEditorStyleAfterFileOpen();
void DetectEncoding();
bool Open(bool detectEncoding = true);
void DoAskForCodeCompletion(); // relevant to code-completion plugins
History
kkez 2006-06-07 20:46
The 2531 revision introduced a new feature but also the bug i reported here: https://developer.berlios.de/bugs/?func=detailbug&bug_id=7780&group_id=5358
The problem is that the file is opened after the SetEditorStyles() call, because SetLineNumberColWidth(); needs the editor line count. But the "fold all on file open" feature needs to be called before the file is opened. So i splitted SetEditorStyles() in two function, one to be called before the file is opened, one to be called after.
You can still call SetEditorStyles() that will call both these functions.