Add a display name filed to index, and improve handling of it

This commit is contained in:
Veronica Berglyd Olsen
2024-01-29 17:47:30 +01:00
parent ca7ae6b666
commit b396cff9a7
7 changed files with 98 additions and 69 deletions
+6 -6
View File
@@ -1842,7 +1842,7 @@ class GuiDocEditor(QPlainTextEdit):
return nwTrinary.NEUTRAL
tag = ""
exist = False
exist = 0
cPos = cursor.selectionStart() - block.position()
tExist = SHARED.project.index.checkThese(tBits, self._nwItem)
for sTag, sPos, sExist in zip(reversed(tBits), reversed(tPos), reversed(tExist)):
@@ -1854,14 +1854,14 @@ class GuiDocEditor(QPlainTextEdit):
exist = sExist
break
if not tag or tag.startswith("@"):
# The keyword cannot be looked up, so we ignore that
if exist in (1, 3) or not tag:
# Ignore keywords, optionals and empty tags
return nwTrinary.NEUTRAL
if follow and exist:
if follow and exist == 2:
logger.debug("Attempting to follow tag '%s'", tag)
self.loadDocumentTagRequest.emit(tag, nwDocMode.VIEW)
elif create and not exist:
elif create and exist == 0:
if SHARED.question(self.tr(
"Do you want to create a new project note for the tag '{0}'?"
).format(tag)):
@@ -1874,7 +1874,7 @@ class GuiDocEditor(QPlainTextEdit):
"If one doesn't exist, you must create one first."
).format(trConst(nwLabels.CLASS_NAME[itemClass])))
return nwTrinary.POSITIVE if exist else nwTrinary.NEGATIVE
return nwTrinary.POSITIVE if exist == 2 else nwTrinary.NEGATIVE
return nwTrinary.NEUTRAL