From 2d54e9fd355bae97df5132ecaf6ca8e5c5a714e9 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Mon, 24 Jan 2022 20:44:32 +0300 Subject: [PATCH] Fixed background display after untoggling spoilers in input fields. --- ui/widgets/input_fields.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ui/widgets/input_fields.cpp b/ui/widgets/input_fields.cpp index e014e4b..6154ae0 100644 --- a/ui/widgets/input_fields.cpp +++ b/ui/widgets/input_fields.cpp @@ -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);