6 """ |
6 """ |
7 Module implementing the search and replace widget. |
7 Module implementing the search and replace widget. |
8 """ |
8 """ |
9 |
9 |
10 import re |
10 import re |
|
11 import contextlib |
11 |
12 |
12 from PyQt5.QtCore import pyqtSignal, Qt, pyqtSlot, QEvent |
13 from PyQt5.QtCore import pyqtSignal, Qt, pyqtSlot, QEvent |
13 from PyQt5.QtGui import QColor, QPalette |
14 from PyQt5.QtGui import QColor, QPalette |
14 from PyQt5.QtWidgets import ( |
15 from PyQt5.QtWidgets import ( |
15 QWidget, QHBoxLayout, QToolButton, QScrollArea, QSizePolicy, QFrame |
16 QWidget, QHBoxLayout, QToolButton, QScrollArea, QSizePolicy, QFrame |
622 else: |
623 else: |
623 indicate = True |
624 indicate = True |
624 if indicate: |
625 if indicate: |
625 aw.setSearchIndicator(tgtPos, tgtLen) |
626 aw.setSearchIndicator(tgtPos, tgtLen) |
626 ok = aw.findNextTarget() |
627 ok = aw.findNextTarget() |
627 try: |
628 with contextlib.suppress(AttributeError): |
628 aw.updateMarkerMap() |
629 aw.updateMarkerMap() |
629 except AttributeError: |
630 # ignore it for MiniEditor |
630 # MiniEditor doesn't have this, ignore it |
|
631 pass |
|
632 |
631 |
633 def __findNextPrev(self, txt, backwards): |
632 def __findNextPrev(self, txt, backwards): |
634 """ |
633 """ |
635 Private method to find the next occurrence of the search text. |
634 Private method to find the next occurrence of the search text. |
636 |
635 |