Fixed background display after untoggling spoilers in input fields.

This commit is contained in:
23rd 2022-01-24 20:44:32 +03:00
parent 7bd7ada3ff
commit 2d54e9fd35

View file

@ -702,6 +702,7 @@ void RemoveDocumentTags(
format.setProperty(kTagProperty, QString());
format.setProperty(kReplaceTagId, QString());
format.setForeground(st.textFg);
format.setBackground(QBrush());
format.setFont(st.font);
cursor.mergeCharFormat(format);
}
@ -748,6 +749,7 @@ void ApplyTagFormat(QTextCharFormat &to, const QTextCharFormat &from) {
to.setProperty(kReplaceTagId, from.property(kReplaceTagId));
to.setFont(from.font());
to.setForeground(from.foreground());
to.setBackground(from.background());
}
// Returns the position of the first inserted tag or "changedEnd" value if none found.
@ -1435,7 +1437,9 @@ void InputField::updatePalette() {
auto format = fragment.charFormat();
const auto tag = format.property(kTagProperty).toString();
format.setForeground(PrepareTagFormat(_st, tag).foreground());
const auto updatedFormat = PrepareTagFormat(_st, tag);
format.setForeground(updatedFormat.foreground());
format.setBackground(updatedFormat.background());
cursor.setPosition(fragment.position());
cursor.setPosition(till, QTextCursor::KeepAnchor);
cursor.mergeCharFormat(format);