850 else: |
850 else: |
851 return (0, 0) |
851 return (0, 0) |
852 |
852 |
853 def findFirstTarget(self, expr_, re_, cs_, wo_, |
853 def findFirstTarget(self, expr_, re_, cs_, wo_, |
854 begline=-1, begindex=-1, endline=-1, endindex=-1, |
854 begline=-1, begindex=-1, endline=-1, endindex=-1, |
855 ws_=False): |
855 ws_=False, posix=False, cxx11=False): |
856 """ |
856 """ |
857 Public method to search in a specified range of text without |
857 Public method to search in a specified range of text without |
858 setting the selection. |
858 setting the selection. |
859 |
859 |
860 @param expr_ search expression (string) |
860 @param expr_ search expression |
861 @param re_ flag indicating a regular expression (boolean) |
861 @type str |
862 @param cs_ flag indicating a case sensitive search (boolean) |
862 @param re_ flag indicating a regular expression |
863 @param wo_ flag indicating a word only search (boolean) |
863 @type bool |
864 @keyparam begline line number to start from (-1 to indicate current |
864 @param cs_ flag indicating a case sensitive search |
865 position) (integer) |
865 @type bool |
866 @keyparam begindex index to start from (-1 to indicate current |
866 @param wo_ flag indicating a word only search |
867 position) (integer) |
867 @type bool |
868 @keyparam endline line number to stop at (-1 to indicate end of |
868 @param begline line number to start from (-1 to indicate current |
869 document) (integer) |
869 position) |
870 @keyparam endindex index number to stop at (-1 to indicate end of |
870 @type int |
871 document) (integer) |
871 @param begindex index to start from (-1 to indicate current position) |
872 @keyparam ws_ flag indicating a word start search (boolean) |
872 @type int |
873 @return flag indicating a successful search (boolean) |
873 @param endline line number to stop at (-1 to indicate end of document) |
|
874 @type int |
|
875 @param endindex index number to stop at (-1 to indicate end of |
|
876 document) |
|
877 @type int |
|
878 @param ws_ flag indicating a word start search (boolean) |
|
879 @type bool |
|
880 @param posix |
|
881 @type bool |
|
882 @param cxx11 |
|
883 @type bool |
|
884 @return flag indicating a successful search |
|
885 @rtype bool |
874 """ |
886 """ |
875 self.__targetSearchFlags = 0 |
887 self.__targetSearchFlags = 0 |
876 if re_: |
888 if re_: |
877 self.__targetSearchFlags |= QsciScintilla.SCFIND_REGEXP |
889 self.__targetSearchFlags |= QsciScintilla.SCFIND_REGEXP |
878 if cs_: |
890 if cs_: |
879 self.__targetSearchFlags |= QsciScintilla.SCFIND_MATCHCASE |
891 self.__targetSearchFlags |= QsciScintilla.SCFIND_MATCHCASE |
880 if wo_: |
892 if wo_: |
881 self.__targetSearchFlags |= QsciScintilla.SCFIND_WHOLEWORD |
893 self.__targetSearchFlags |= QsciScintilla.SCFIND_WHOLEWORD |
882 if ws_: |
894 if ws_: |
883 self.__targetSearchFlags |= QsciScintilla.SCFIND_WORDSTART |
895 self.__targetSearchFlags |= QsciScintilla.SCFIND_WORDSTART |
|
896 if posix: |
|
897 self.__targetSearchFlags |= QsciScintilla.SCFIND_POSIX |
|
898 try: |
|
899 if cxx11: |
|
900 self.__targetSearchFlags |= QsciScintilla.SCFIND_CXX11REGEX |
|
901 except AttributeError: |
|
902 # defined for PyQt >= 2.11.0 |
|
903 pass |
884 |
904 |
885 if begline < 0 or begindex < 0: |
905 if begline < 0 or begindex < 0: |
886 self.__targetSearchStart = self.SendScintilla( |
906 self.__targetSearchStart = self.SendScintilla( |
887 QsciScintilla.SCI_GETCURRENTPOS) |
907 QsciScintilla.SCI_GETCURRENTPOS) |
888 else: |
908 else: |
1734 @param folds list of line numbers of folded lines (list of integer) |
1754 @param folds list of line numbers of folded lines (list of integer) |
1735 """ |
1755 """ |
1736 for line in folds: |
1756 for line in folds: |
1737 self.foldLine(line) |
1757 self.foldLine(line) |
1738 |
1758 |
|
1759 ######################################################################### |
|
1760 # method below implement a compatibility variant for the findFirst() |
|
1761 # extended with version 2.11 |
|
1762 ######################################################################### |
|
1763 |
|
1764 def findFirst(self, expression, regexp, caseSensitive, word, wrap, |
|
1765 forward=True, line=-1, index=-1, show=True, posix=False, |
|
1766 cxx11=False): |
|
1767 """ |
|
1768 Public method to search in the current editor text. |
|
1769 |
|
1770 @param expression search expression |
|
1771 @type str |
|
1772 @param regexp flag indicating a regular expression |
|
1773 @type bool |
|
1774 @param caseSensitive flag indicating a case sensitive search |
|
1775 @type bool |
|
1776 @param word flag indicating a word only search |
|
1777 @type bool |
|
1778 @param wrap flag indicating to warp around |
|
1779 @type bool |
|
1780 @param forward flag indicating the search direction |
|
1781 @type bool |
|
1782 @param line line to start the search on |
|
1783 @type int |
|
1784 @param index index to start the search on |
|
1785 @type int |
|
1786 @param show flag indicating to set the selection to the found |
|
1787 expression |
|
1788 @type bool |
|
1789 @param posix flag indicating the POSIX regular expression search mode |
|
1790 @type bool |
|
1791 @param cxx11 flag indicating the CXX11 regular expression search mode |
|
1792 @type bool |
|
1793 @return flag indicating a successful search |
|
1794 @rtype bool |
|
1795 """ |
|
1796 if QSCINTILLA_VERSION() >= 0x020B00: |
|
1797 return super(QsciScintillaCompat, self).findFirst( |
|
1798 expression, regexp, caseSensitive, word, wrap, |
|
1799 forward=forward, line=line, index=index, show=show, |
|
1800 posix=posix, cxx11=cxx11) |
|
1801 else: |
|
1802 return super(QsciScintillaCompat, self).findFirst( |
|
1803 expression, regexp, caseSensitive, word, wrap, |
|
1804 forward=forward, line=line, index=index, show=show, |
|
1805 posix=posix) |
|
1806 |
1739 ## ######################################################################### |
1807 ## ######################################################################### |
1740 ## # methods below have been added to QScintilla starting with version 2.x |
1808 ## # methods below have been added to QScintilla starting with version 2.x |
1741 ## ######################################################################### |
1809 ## ######################################################################### |
1742 ## |
1810 ## |
1743 ## if "newMethod" not in QsciScintilla.__dict__: |
1811 ## if "newMethod" not in QsciScintilla.__dict__: |