Connect rehighlight tags in editor to index signal on tags change (#1916)

This commit is contained in:
Veronica Berglyd Olsen
2024-06-16 21:13:50 +02:00
parent f548927b74
commit 683e81c57b
3 changed files with 8 additions and 7 deletions
+7 -5
View File
@@ -436,11 +436,6 @@ class GuiDocEditor(QPlainTextEdit):
return True
def updateTagHighLighting(self) -> None:
"""Rerun the syntax highlighter on all meta data lines."""
self._qDocument.syntaxHighlighter.rehighlightByType(BLOCK_META)
return
def replaceText(self, text: str) -> None:
"""Replace the text of the current document with the provided
text. This also clears undo history.
@@ -1034,6 +1029,13 @@ class GuiDocEditor(QPlainTextEdit):
self.beginSearch()
return
@pyqtSlot(list, list)
def updateChangedTags(self, updated: list[str], deleted: list[str]) -> None:
"""Tags have changed, so just in case we rehighlight them."""
if updated or deleted:
self._qDocument.syntaxHighlighter.rehighlightByType(BLOCK_META)
return
##
# Private Slots
##