Corrected an issue in the editor.

Sun, 29 Sep 2013 12:04:35 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 29 Sep 2013 12:04:35 +0200
changeset 2959
86ad8854361b
parent 2958
ed0a8d4304a8
child 2960
9453efa25fd5

Corrected an issue in the editor.

APIs/Python3/eric5.api file | annotate | diff | comparison | revisions
Documentation/Source/eric5.QScintilla.Editor.html file | annotate | diff | comparison | revisions
QScintilla/Editor.py file | annotate | diff | comparison | revisions
--- a/APIs/Python3/eric5.api	Sun Sep 29 10:28:29 2013 +0200
+++ b/APIs/Python3/eric5.api	Sun Sep 29 12:04:35 2013 +0200
@@ -2357,7 +2357,7 @@
 eric5.Helpviewer.Download.DownloadUtilities.timeString?4(timeRemaining)
 eric5.Helpviewer.Feeds.FeedEditDialog.FeedEditDialog.getData?4()
 eric5.Helpviewer.Feeds.FeedEditDialog.FeedEditDialog.on_titleEdit_textChanged?4(txt)
-eric5.Helpviewer.Feeds.FeedEditDialog.FeedEditDialog.on_urlEdit_textChanged?4(p0)
+eric5.Helpviewer.Feeds.FeedEditDialog.FeedEditDialog.on_urlEdit_textChanged?4(txt)
 eric5.Helpviewer.Feeds.FeedEditDialog.FeedEditDialog?1(urlString, title, parent=None)
 eric5.Helpviewer.Feeds.FeedsDialog.FeedsDialog?1(availableFeeds, browser, parent=None)
 eric5.Helpviewer.Feeds.FeedsManager.FeedsManager.ErrorDataRole?7
--- a/Documentation/Source/eric5.QScintilla.Editor.html	Sun Sep 29 10:28:29 2013 +0200
+++ b/Documentation/Source/eric5.QScintilla.Editor.html	Sun Sep 29 12:04:35 2013 +0200
@@ -1859,7 +1859,12 @@
 <b>__processFlags</b>(<i></i>)
 <p>
         Private method to extract flags and process them.
-</p><a NAME="Editor.__processRequestSyncCommand" ID="Editor.__processRequestSyncCommand"></a>
+</p><dl>
+<dt>Returns:</dt>
+<dd>
+list of change flags (list of string)
+</dd>
+</dl><a NAME="Editor.__processRequestSyncCommand" ID="Editor.__processRequestSyncCommand"></a>
 <h4>Editor.__processRequestSyncCommand</h4>
 <b>__processRequestSyncCommand</b>(<i>argsString</i>)
 <p>
--- a/QScintilla/Editor.py	Sun Sep 29 10:28:29 2013 +0200
+++ b/QScintilla/Editor.py	Sun Sep 29 12:04:35 2013 +0200
@@ -297,6 +297,9 @@
         # set the text display
         self.__setTextDisplay()
         
+        # initialize the online syntax check timer
+        self.__initOnlineSyntaxCheck()
+        
         self.isResourcesFile = False
         if editor is None:
             if self.fileName is not None:
@@ -421,9 +424,6 @@
         # connect signals after loading the text
         self.textChanged.connect(self.__textChanged)
         
-        # initialize the online syntax check timer
-        self.__initOnlineSyntaxCheck()
-        
         # initialize the online change trace timer
         self.__initOnlineChangeTrace()
         
@@ -2574,20 +2574,30 @@
     def __processFlags(self):
         """
         Private method to extract flags and process them.
+        
+        @return list of change flags (list of string)
         """
         txt = self.text()
         flags = Utilities.extractFlags(txt)
         
+        changedFlags = []
+        
         # Flag 1: FileType
         if "FileType" in flags:
+            oldFiletype = self.filetype
             if isinstance(flags["FileType"], str):
                 self.filetype = flags["FileType"]
                 self.filetypeByFlag = True
+                if oldFiletype != self.filetype:
+                    changedFlags.append("FileType")
         else:
             if self.filetype != "" and self.filetypeByFlag:
                 self.filetype = ""
                 self.filetypeByFlag = False
                 self.__bindName(txt.splitlines()[0])
+                changedFlags.append("FileType")
+        
+        return changedFlags
     
     ############################################################################
     ## File handling methods below
@@ -2843,8 +2853,8 @@
             self.setReadOnly(False)
             self.setWindowTitle(self.fileName)
             # get eric specific flags
-            self.__processFlags()
-            if not self.__lexerReset:
+            changedFlags = self.__processFlags()
+            if not self.__lexerReset and "FileType" in changedFlags:
                 self.setLanguage(self.fileName)
             
             if saveas:
@@ -4794,6 +4804,8 @@
         Private method to perform an automatic syntax check of the file.
         """
         if Preferences.getEditor("AutoCheckSyntax"):
+            if Preferences.getEditor("OnlineSyntaxCheck"):
+                self.__onlineSyntaxCheckTimer.stop()
             self.clearSyntaxError()
             self.clearFlakesWarnings()
             if self.isPy3File():
@@ -5400,26 +5412,22 @@
                         errorAnnotations.append(
                             self.trUtf8("Error: {0}").format(msg))
             
-            wLen = len(warningAnnotations)
-            eLen = len(errorAnnotations)
-            sLen = len(styleAnnotations)
             annotations = []
-            
-            if sLen:
+            if styleAnnotations:
                 annotationStyleTxt = "\n".join(styleAnnotations)
-                if wLen:
+                if warningAnnotations or errorAnnotations:
                     annotationStyleTxt += "\n"
                 annotations.append(QsciStyledText(annotationStyleTxt,
                     self.annotationStyleStyle))
             
-            if wLen:
+            if warningAnnotations:
                 annotationWarningTxt = "\n".join(warningAnnotations)
-                if eLen:
+                if errorAnnotations:
                     annotationWarningTxt += "\n"
                 annotations.append(QsciStyledText(annotationWarningTxt,
                     self.annotationWarningStyle))
             
-            if eLen:
+            if errorAnnotations:
                 annotationErrorTxt = "\n".join(errorAnnotations)
                 annotations.append(QsciStyledText(annotationErrorTxt,
                     self.annotationErrorStyle))

eric ide

mercurial