Patch #2864 2009-12-20 18:31

techy

Remove extra whitespace from keyword list
Download
2864-Remove_extra_w.patch (973 bytes)
Category
Application::Refinement
Status
Accepted
Close date
2009-12-31 14:45
Assigned to
mortenmacfly
Index: src/sdk/editorlexerloader.cpp
===================================================================
--- src/sdk/editorlexerloader.cpp    (revision 5986)
+++ src/sdk/editorlexerloader.cpp    (working copy)
@@ -172,8 +172,15 @@
         int keyidx = keywords->Attribute("index") ? atol(keywords->Attribute("index")) : -1;
     //    LOGSTREAM << "keyidx=" << keyidx << '\n';
         if (keyidx != -1)
-            m_pTarget->SetKeywords(language, keyidx, wxString ( keywords->Attribute("value"), wxConvUTF8 ) );
+        {
+            // the lexer file contains keywords indented - remove the extra spacing and EOLs 
+            wxRegEx regex(_T("[[:space:]]+"));
+            wxString value = wxString(keywords->Attribute("value"), wxConvUTF8);
+            regex.Replace(&value, _T(" "));
 
+            m_pTarget->SetKeywords(language, keyidx, wxString ( value, wxConvUTF8 ) );
+        }
+
         keywords = keywords->NextSiblingElement(nodename.mb_str());
     }
 }
techy 2009-12-20 18:34

In Settings->Editor->Syntax highlighting->Keywords the list of keywords contains extra spaces and newlines (which looks ugly). This is because the lexers definition file contains the list of keywords indented. This patch replaces a sequence of whitespaces with a single space between keywords.

techy 2009-12-26 20:50

I was testing the previous patch in ANSI compiled wxWidgets so there are some missing _T's. This new revision should compile also in Unicode wxWidgets.

mortenmacfly 2009-12-26 21:23

I had fixed that already, but thanks anyways...