Simplify a few more functions

This commit is contained in:
Veronica Berglyd Olsen
2024-03-17 16:10:27 +01:00
parent c26cfd5372
commit 6bb9ec0dc1
4 changed files with 53 additions and 71 deletions
+4 -9
View File
@@ -1192,7 +1192,10 @@ class GuiDocEditor(QPlainTextEdit):
if time() - self._lastEdit < 25.0:
logger.debug("Running word counter")
SHARED.runInThreadPool(self.wCounterDoc)
self._updateOutline()
self.docHeader.setOutline({
block.blockNumber(): block.text()
for block in self._qDocument.iterBlockByType(BLOCK_TITLE)
})
return
@@ -1837,14 +1840,6 @@ class GuiDocEditor(QPlainTextEdit):
# Internal Functions
##
def _updateOutline(self) -> None:
"""Scan the text for headings and update the outline."""
self.docHeader.setOutline({
block.blockNumber(): block.text()
for block in self._qDocument.iterBlockByType(BLOCK_TITLE)
})
return
def _processTag(self, cursor: QTextCursor | None = None,
follow: bool = True, create: bool = False) -> nwTrinary:
"""Activated by Ctrl+Enter. Checks that we're in a block