Patch #1715 2006-12-12 07:31

mcdave

Bugfix for bug:009641
Download
1715-Bugfix_for_bug.patch (32.5 KB)
Category
Application::Bugfix
Status
Closed
Close date
2006-12-15 09:03
Assigned to
 
Index: src/sdk/cbeditor.cpp
===================================================================
--- src/sdk/cbeditor.cpp    (revision 3377)
+++ src/sdk/cbeditor.cpp    (working copy)
@@ -27,25 +27,25 @@
 #include "sdk_precomp.h"
 
 #ifndef CB_PRECOMP
-    #include <wx/filename.h>
-    #include <wx/notebook.h>
-    #include <wx/wfstream.h>
+#include <wx/filename.h>
+#include <wx/notebook.h>
+#include <wx/wfstream.h>
 
-    #include "cbeditor.h" // class's header file
-    #include "globals.h"
-    #include "sdk_events.h"
-    #include "cbproject.h"
-    #include "projectfile.h"
-    #include "projectbuildtarget.h"
-    #include "editorcolourset.h"
-    #include "manager.h"
-    #include "configmanager.h"
-    #include "projectmanager.h"
-    #include "pluginmanager.h"
-    #include "editormanager.h"
-    #include "messagemanager.h"
-    #include "macrosmanager.h" // ReplaceMacros
-    #include "cbplugin.h"
+#include "cbeditor.h" // class's header file
+#include "globals.h"
+#include "sdk_events.h"
+#include "cbproject.h"
+#include "projectfile.h"
+#include "projectbuildtarget.h"
+#include "editorcolourset.h"
+#include "manager.h"
+#include "configmanager.h"
+#include "projectmanager.h"
+#include "pluginmanager.h"
+#include "editormanager.h"
+#include "messagemanager.h"
+#include "macrosmanager.h" // ReplaceMacros
+#include "cbplugin.h"
 #endif
 
 #include <wx/fontutil.h>
@@ -71,14 +71,14 @@
 #define DEBUG_STYLE         wxSCI_MARK_ARROW
 
 BEGIN_EVENT_TABLE(cbStyledTextCtrl, wxScintilla)
-    EVT_CONTEXT_MENU(cbStyledTextCtrl::OnContextMenu)
-    EVT_KILL_FOCUS(cbStyledTextCtrl::OnKillFocus)
-    EVT_MIDDLE_DOWN(cbStyledTextCtrl::OnGPM)
+EVT_CONTEXT_MENU(cbStyledTextCtrl::OnContextMenu)
+EVT_KILL_FOCUS(cbStyledTextCtrl::OnKillFocus)
+EVT_MIDDLE_DOWN(cbStyledTextCtrl::OnGPM)
 END_EVENT_TABLE()
 
 cbStyledTextCtrl::cbStyledTextCtrl(wxWindow* pParent, int id, const wxPoint& pos, const wxSize& size, long style)
-    : wxScintilla(pParent, id, pos, size, style),
-    m_pParent(pParent)
+        : wxScintilla(pParent, id, pos, size, style),
+        m_pParent(pParent)
 {
     //ctor
 }
@@ -117,7 +117,7 @@
 #ifndef __WXGTK__
     int pos = PositionFromPoint(wxPoint(event.GetX(), event.GetY()));
 
-    if(pos == wxSCI_INVALID_POSITION)
+    if (pos == wxSCI_INVALID_POSITION)
         return;
 
     int start = GetSelectionStart();
@@ -125,7 +125,7 @@
 
     wxString s = GetSelectedText();
 
-    if(pos < GetCurrentPos())
+    if (pos < GetCurrentPos())
     {
         start += s.length();
         end += s.length();
@@ -163,22 +163,21 @@
     cbEditor* m_pOwner;
 
     cbEditorInternalData(cbEditor* owner)
-        : m_pOwner(owner),
-        m_strip_trailing_spaces(true),
-        m_ensure_final_line_end(false),
-        m_ensure_consistent_line_ends(true),
-        m_LastMarginMenuLine(-1),
-        m_LastDebugLine(-1),
-        m_useByteOrderMark(false),
-        m_byteOrderMarkLength(0),
-        m_lineNumbersWidth(0)
+            : m_pOwner(owner),
+            m_strip_trailing_spaces(true),
+            m_ensure_final_line_end(false),
+            m_ensure_consistent_line_ends(true),
+            m_LastMarginMenuLine(-1),
+            m_LastDebugLine(-1),
+            m_useByteOrderMark(false),
+            m_byteOrderMarkLength(0),
+            m_lineNumbersWidth(0)
     {
         m_encoding = wxLocale::GetSystemEncoding();
     }
 
     ~cbEditorInternalData()
-    {
-    }
+    {}
 
     // add member vars/funcs below
     wxString GetEOLString() const
@@ -187,14 +186,14 @@
         cbStyledTextCtrl* control = m_pOwner->GetControl();
         switch (control->GetEOLMode())
         {
-            case wxSCI_EOL_LF:
-                eolstring = _T("\n");
-                break;
-            case wxSCI_EOL_CR:
-                eolstring = _T("\r");
-                break;
-            default:
-                eolstring = _T("\r\n");
+        case wxSCI_EOL_LF:
+            eolstring = _T("\n");
+            break;
+        case wxSCI_EOL_CR:
+            eolstring = _T("\r");
+            break;
+        default:
+            eolstring = _T("\r\n");
         }
         return eolstring;
     }
@@ -213,11 +212,11 @@
             wxChar c = control->GetCharAt(--position);
             int style = control->GetStyleAt(position);
             bool inComment = style == wxSCI_C_COMMENT ||
-                            style == wxSCI_C_COMMENTDOC ||
-                            style == wxSCI_C_COMMENTDOCKEYWORD ||
-                            style == wxSCI_C_COMMENTDOCKEYWORDERROR ||
-                            style == wxSCI_C_COMMENTLINE ||
-                            style == wxSCI_C_COMMENTLINEDOC;
+                             style == wxSCI_C_COMMENTDOC ||
+                             style == wxSCI_C_COMMENTDOCKEYWORD ||
+                             style == wxSCI_C_COMMENTDOCKEYWORDERROR ||
+                             style == wxSCI_C_COMMENTLINE ||
+                             style == wxSCI_C_COMME
download for full patch...
mcdave 2006-12-12 10:39

Sorry guys, I made a stupid error, here is the correct one!

mcdave 2006-12-12 10:40

Sorry guys, I made a stupid error, here is the correct one!

killerbot 2006-12-12 13:39

there's a side effect, not applying yet

mcdave 2006-12-14 06:03

Okay... side effects removed, I combined this patch with the patch of 001716. My tests confirmed it to be working... but hey... I am only human.

mcdave 2006-12-14 06:40

This also fixes bug nr: 009247 and 006965

mcdave 2006-12-14 10:13

A Small change ... but works better

mcdave 2006-12-14 11:42

Yippeee... this now works for all the fold levels... :)

killerbot 2006-12-15 09:03

I have tested this, and it works (all 3 bugs fixed). Congrats.

One little note : there's a little glitch in the sense that you see the fake editor being created. But I think we can live with that, normally one does not change the folding options that much.

I have modified the code (style) a very little bit.

Many thanks for the help.

revision : 3380