Fixed a few issues related to the configurable keywords support. 5_1_x

Sun, 20 Nov 2011 14:44:05 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 20 Nov 2011 14:44:05 +0100
branch
5_1_x
changeset 1459
191eea8598e8
parent 1452
c45568ff630d
child 1460
8796ba2ba2ec

Fixed a few issues related to the configurable keywords support.
(transplanted from 45fe12e8533b6fdc26eb5a8479c077b7f62942d4)

Preferences/ConfigurationPages/EditorKeywordsPage.py file | annotate | diff | comparison | revisions
QScintilla/Lexers/LexerContainer.py file | annotate | diff | comparison | revisions
--- a/Preferences/ConfigurationPages/EditorKeywordsPage.py	Sat Nov 19 15:39:25 2011 +0100
+++ b/Preferences/ConfigurationPages/EditorKeywordsPage.py	Sun Nov 20 14:44:05 2011 +0100
@@ -13,6 +13,7 @@
 from .Ui_EditorKeywordsPage import Ui_EditorKeywordsPage
 
 import QScintilla.Lexers
+from QScintilla.Lexers.LexerContainer import LexerContainer
 
 import Preferences
 
@@ -35,20 +36,20 @@
         languages = sorted([''] + \
                     list(QScintilla.Lexers.getSupportedLanguages().keys()))
         for lang in languages:
-            if lang != "Guessed":
-                self.languageCombo.addItem(lang)
-        
-        for lang in languages[1:]:
-            keywords = Preferences.getEditorKeywords(lang)[:]
-            if not keywords:
-                keywords = [""]
+            if lang:
                 lex = QScintilla.Lexers.getLexer(lang)
-                for kwSet in range(1, 10):
-                    kw = lex.keywords(kwSet)
-                    if kw is None:
-                        kw = ""
-                    keywords.append(kw)
-            self.__keywords[lang] = keywords
+                if isinstance(lex, LexerContainer):
+                    continue
+                keywords = Preferences.getEditorKeywords(lang)[:]
+                if not keywords:
+                    keywords = [""]
+                    for kwSet in range(1, 10):
+                        kw = lex.keywords(kwSet)
+                        if kw is None:
+                            kw = ""
+                        keywords.append(kw)
+                self.__keywords[lang] = keywords
+            self.languageCombo.addItem(lang)
         
         self.currentLanguage = ''
         self.currentSet = 1
--- a/QScintilla/Lexers/LexerContainer.py	Sat Nov 19 15:39:25 2011 +0100
+++ b/QScintilla/Lexers/LexerContainer.py	Sun Nov 20 14:44:05 2011 +0100
@@ -74,3 +74,12 @@
         """
         self.editor.startStyling(start, 0x1f)
         self.editor.setStyling(end - start + 1, 0)
+    
+    def keywords(self, kwSet):
+        """
+        Public method to get the keywords.
+        
+        @param kwSet number of the keyword set (integer)
+        @return string giving the keywords (string) or None
+        """
+        return Lexer.keywords(self, kwSet)

eric ide

mercurial