ui: fixed method names disappearing in code view after being deselected

This commit is contained in:
Eberhard Graether
2017-02-22 04:30:48 +01:00
parent 79fc78a518
commit 224f0b05f9
2 changed files with 21 additions and 4 deletions
+18 -4
View File
@@ -855,16 +855,30 @@ void QtCodeArea::annotateText()
}
const AnnotationColor& newColor = getAnnotationColorForAnnotation(annotation);
if ((newColor.text != oldColor.text || !m_wasAnnotated))
if (newColor.text != oldColor.text || (!m_wasAnnotated && newColor.text != "transparent"))
{
if (newColor.text.size() > 0 && newColor.text != "transparent")
{
if (!annotation.oldTextColor.isValid())
bool isDuplicateAnnotation = false;
for (Annotation* a : m_colorChangedAnnotations)
{
annotation.oldTextColor = m_highlighter->getFormat(annotation.start, annotation.end).foreground().color();
if (a->start == annotation.start && a->end == annotation.end && a->tokenId != annotation.tokenId)
{
isDuplicateAnnotation = true;
break;
}
}
setTextColorForAnnotation(annotation, QColor(newColor.text.c_str()));
if (!isDuplicateAnnotation)
{
if (!annotation.oldTextColor.isValid())
{
annotation.oldTextColor = m_highlighter->getFormat(annotation.start, annotation.end).foreground().color();
}
setTextColorForAnnotation(annotation, QColor(newColor.text.c_str()));
m_colorChangedAnnotations.push_back(&annotation);
}
}
else if (annotation.oldTextColor.isValid())
{