[ChatView] Fix game log first line incorrect background color (#6612)

This commit is contained in:
RickyRister 2026-02-21 04:40:47 -08:00 committed by GitHub
parent 6ab558dd58
commit 189f3a7bbc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -75,8 +75,14 @@ void ChatView::adjustColorsToPalette()
void ChatView::refreshBlockColors()
{
QTextDocument *doc = document();
QTextCursor cursor(doc);
// Empty QTextDocuments still have 1 block, so we need handle this edge case
if (doc->isEmpty()) {
evenNumber = true;
return;
}
QTextCursor cursor(doc);
bool even = true; // start fresh
for (QTextBlock block = doc->begin(); block.isValid(); block = block.next()) {