Connect rehighlight tags in editor to index signal on tags change (#1916)
This commit is contained in:
@@ -436,11 +436,6 @@ class GuiDocEditor(QPlainTextEdit):
|
|||||||
|
|
||||||
return True
|
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:
|
def replaceText(self, text: str) -> None:
|
||||||
"""Replace the text of the current document with the provided
|
"""Replace the text of the current document with the provided
|
||||||
text. This also clears undo history.
|
text. This also clears undo history.
|
||||||
@@ -1034,6 +1029,13 @@ class GuiDocEditor(QPlainTextEdit):
|
|||||||
self.beginSearch()
|
self.beginSearch()
|
||||||
return
|
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
|
# Private Slots
|
||||||
##
|
##
|
||||||
|
|||||||
@@ -215,6 +215,7 @@ class GuiMain(QMainWindow):
|
|||||||
SHARED.spellLanguageChanged.connect(self.mainStatus.setLanguage)
|
SHARED.spellLanguageChanged.connect(self.mainStatus.setLanguage)
|
||||||
SHARED.focusModeChanged.connect(self._focusModeChanged)
|
SHARED.focusModeChanged.connect(self._focusModeChanged)
|
||||||
SHARED.indexChangedTags.connect(self.docViewerPanel.updateChangedTags)
|
SHARED.indexChangedTags.connect(self.docViewerPanel.updateChangedTags)
|
||||||
|
SHARED.indexChangedTags.connect(self.docEditor.updateChangedTags)
|
||||||
SHARED.indexScannedText.connect(self.docViewerPanel.projectItemChanged)
|
SHARED.indexScannedText.connect(self.docViewerPanel.projectItemChanged)
|
||||||
SHARED.indexScannedText.connect(self.projView.updateItemValues)
|
SHARED.indexScannedText.connect(self.projView.updateItemValues)
|
||||||
SHARED.indexScannedText.connect(self.itemDetails.updateViewBox)
|
SHARED.indexScannedText.connect(self.itemDetails.updateViewBox)
|
||||||
@@ -745,7 +746,6 @@ class GuiMain(QMainWindow):
|
|||||||
self.mainStatus.setStatusMessage(
|
self.mainStatus.setStatusMessage(
|
||||||
self.tr("Indexing completed in {0} ms").format(f"{(tEnd - tStart)*1000.0:.1f}")
|
self.tr("Indexing completed in {0} ms").format(f"{(tEnd - tStart)*1000.0:.1f}")
|
||||||
)
|
)
|
||||||
self.docEditor.updateTagHighLighting()
|
|
||||||
self._updateStatusWordCount()
|
self._updateStatusWordCount()
|
||||||
QApplication.restoreOverrideCursor()
|
QApplication.restoreOverrideCursor()
|
||||||
|
|
||||||
|
|||||||
@@ -1597,7 +1597,6 @@ def testGuiEditor_Tags(qtbot, nwGUI, projPath, ipsumText, mockRnd):
|
|||||||
docEditor.replaceText(text)
|
docEditor.replaceText(text)
|
||||||
nwGUI.saveDocument()
|
nwGUI.saveDocument()
|
||||||
assert nwGUI.projView.projTree.revealNewTreeItem(cHandle)
|
assert nwGUI.projView.projTree.revealNewTreeItem(cHandle)
|
||||||
docEditor.updateTagHighLighting()
|
|
||||||
|
|
||||||
# Follow Tag
|
# Follow Tag
|
||||||
# ==========
|
# ==========
|
||||||
|
|||||||
Reference in New Issue
Block a user