--- a/QScintilla/QsciScintillaCompat.py Tue Mar 05 18:59:19 2019 +0100 +++ b/QScintilla/QsciScintillaCompat.py Tue Mar 05 19:00:06 2019 +0100 @@ -852,25 +852,37 @@ def findFirstTarget(self, expr_, re_, cs_, wo_, begline=-1, begindex=-1, endline=-1, endindex=-1, - ws_=False): + ws_=False, posix=False, cxx11=False): """ Public method to search in a specified range of text without setting the selection. - @param expr_ search expression (string) - @param re_ flag indicating a regular expression (boolean) - @param cs_ flag indicating a case sensitive search (boolean) - @param wo_ flag indicating a word only search (boolean) - @keyparam begline line number to start from (-1 to indicate current - position) (integer) - @keyparam begindex index to start from (-1 to indicate current - position) (integer) - @keyparam endline line number to stop at (-1 to indicate end of - document) (integer) - @keyparam endindex index number to stop at (-1 to indicate end of - document) (integer) - @keyparam ws_ flag indicating a word start search (boolean) - @return flag indicating a successful search (boolean) + @param expr_ search expression + @type str + @param re_ flag indicating a regular expression + @type bool + @param cs_ flag indicating a case sensitive search + @type bool + @param wo_ flag indicating a word only search + @type bool + @param begline line number to start from (-1 to indicate current + position) + @type int + @param begindex index to start from (-1 to indicate current position) + @type int + @param endline line number to stop at (-1 to indicate end of document) + @type int + @param endindex index number to stop at (-1 to indicate end of + document) + @type int + @param ws_ flag indicating a word start search (boolean) + @type bool + @param posix + @type bool + @param cxx11 + @type bool + @return flag indicating a successful search + @rtype bool """ self.__targetSearchFlags = 0 if re_: @@ -881,6 +893,14 @@ self.__targetSearchFlags |= QsciScintilla.SCFIND_WHOLEWORD if ws_: self.__targetSearchFlags |= QsciScintilla.SCFIND_WORDSTART + if posix: + self.__targetSearchFlags |= QsciScintilla.SCFIND_POSIX + try: + if cxx11: + self.__targetSearchFlags |= QsciScintilla.SCFIND_CXX11REGEX + except AttributeError: + # defined for PyQt >= 2.11.0 + pass if begline < 0 or begindex < 0: self.__targetSearchStart = self.SendScintilla( @@ -1736,6 +1756,54 @@ for line in folds: self.foldLine(line) + ######################################################################### + # method below implement a compatibility variant for the findFirst() + # extended with version 2.11 + ######################################################################### + + def findFirst(self, expression, regexp, caseSensitive, word, wrap, + forward=True, line=-1, index=-1, show=True, posix=False, + cxx11=False): + """ + Public method to search in the current editor text. + + @param expression search expression + @type str + @param regexp flag indicating a regular expression + @type bool + @param caseSensitive flag indicating a case sensitive search + @type bool + @param word flag indicating a word only search + @type bool + @param wrap flag indicating to warp around + @type bool + @param forward flag indicating the search direction + @type bool + @param line line to start the search on + @type int + @param index index to start the search on + @type int + @param show flag indicating to set the selection to the found + expression + @type bool + @param posix flag indicating the POSIX regular expression search mode + @type bool + @param cxx11 flag indicating the CXX11 regular expression search mode + @type bool + @return flag indicating a successful search + @rtype bool + """ + if QSCINTILLA_VERSION() >= 0x020B00: + return super(QsciScintillaCompat, self).findFirst( + expression, regexp, caseSensitive, word, wrap, + forward=forward, line=line, index=index, show=show, + posix=posix, cxx11=cxx11) + else: + return super(QsciScintillaCompat, self).findFirst( + expression, regexp, caseSensitive, word, wrap, + forward=forward, line=line, index=index, show=show, + posix=posix) + ## ######################################################################### ## # methods below have been added to QScintilla starting with version 2.x ## #########################################################################