Patch #3130 2011-02-14 05:45

frosty

Highligh occurrences little patch
Download
3130-Highligh_occur.patch (1.2 KB)
Category
Application::Refinement
Status
Accepted
Close date
2013-02-02 01:36
Assigned to
tpetrov
Index: src/sdk/cbeditor.cpp
===================================================================
--- src/sdk/cbeditor.cpp    (revision 7010)
+++ src/sdk/cbeditor.cpp    (working copy)
@@ -490,16 +490,18 @@
         wxString selectedText(m_pOwner->GetControl()->GetTextRange(a, b));
 
         int eof = m_pOwner->m_pControl->GetLength();
-        ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("editor"));
 
         // Set Styling:
         // clear all style indications set in a previous run (is also done once after text gets unselected)
         m_pOwner->GetControl()->IndicatorClearRange(0, eof);
 
+        if (a == b)
+            return;
+
+        ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("editor"));
         // check that feature is enabled,
         // selected text has a minimal length of 3 and contains no spaces
         if( cfg->ReadBool(_T("/highlight_occurrence/enabled"), true)
-                && selectedText.Len() > 2        // if there is no text selected (a == b), it stops here and does not hog the cpu further
                 && selectedText.Find(_T(' ')) == wxNOT_FOUND
                 && selectedText.Find(_T('\t')) == wxNOT_FOUND
                 && selectedText.Find(_T('\n')) == wxNOT_FOUND )
frosty 2011-02-14 05:59

because sometimes we need to highlight very short names http://savepic.org/1311934.png

no cpu overload was detected

frosty 2011-02-16 20:52

replaced tabs to spaces

ollydbg 2011-02-27 14:46

I have discuss this kind of patch last year on the Codeblocks' forum, but it is thought will cause CPU load. I'm not sure why.

ollydbg

ollydbg 2011-03-02 13:31
tpetrov 2013-02-02 01:36

In svn with some modification.