eric6/QScintilla/Lexers/LexerPygments.py

changeset 8158
16a34a0167ba
parent 8027
ccbfefe5bc5a
child 8169
139bd30c52c2
--- a/eric6/QScintilla/Lexers/LexerPygments.py	Sat Mar 13 11:52:01 2021 +0100
+++ b/eric6/QScintilla/Lexers/LexerPygments.py	Sat Mar 13 15:55:35 2021 +0100
@@ -182,7 +182,9 @@
         @param parent parent widget of this lexer
         @param name name of the pygments lexer to use (string)
         """
-        LexerContainer.__init__(self, parent)
+        super(LexerPygments, self).__init__(parent)
+        
+        self.__inReadSettings = False
         
         if name.startswith("Pygments|"):
             self.__forcedPygmentsName = True
@@ -313,13 +315,28 @@
             PYGMENTS_BACKTICKSTRING: True,
         }
     
+    def readSettings(self, qs, prefix="/Scintilla" ):
+        """
+        Public method to read the lexer settings.
+        
+        Note: Overridden to treat the Pygments lexer specially.
+        
+        @param qs reference to the settings object
+        @type QSettings
+        @param prefix prefix for the settings key (defaults to "/Scintilla")
+        @type str (optional)
+        """
+        self.__inReadSettings = True
+        super(LexerPygments, self).readSettings(qs, prefix=prefix)
+        self.__inReadSettings = False
+    
     def language(self):
         """
         Public method returning the language of the lexer.
         
         @return language of the lexer (string)
         """
-        if self.__pygmentsName:
+        if self.__pygmentsName and not self.__inReadSettings:
             return self.__pygmentsName
         else:
             return "Guessed"

eric ide

mercurial