--- a/QScintilla/Editor.py Sat Sep 28 11:49:09 2013 +0200 +++ b/QScintilla/Editor.py Sun Sep 29 19:34:03 2013 +0200 @@ -299,6 +299,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: @@ -423,9 +426,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() @@ -2563,20 +2563,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 @@ -2830,8 +2840,8 @@ self.setReadOnly(False) self.setWindowTitle(self.fileName) # get eric specific flags - self.__processFlags() - if self.lexer_ is None and not self.__lexerReset: + changedFlags = self.__processFlags() + if not self.__lexerReset and "FileType" in changedFlags: self.setLanguage(self.fileName) if saveas: @@ -4771,6 +4781,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():