Make sure that we only insert a new block for headers. This makes sure that hitting return in a list just adds the next list item.

This commit is contained in:
James Graham
2026-02-21 14:42:02 +00:00
parent a60d6c4a60
commit 73e6a536db

View File

@@ -190,6 +190,11 @@ bool ChatKeyHelper::insertReturn(Qt::KeyboardModifiers modifiers)
return false;
}
// If we are not a heading or are in a list just pass enter as normal.
if (cursor.blockFormat().headingLevel() <= 0 || cursor.currentList()) {
return false;
}
// If there was a heading we always want to revert to Paragraph format.
auto newBlockFormat = RichFormat::blockFormatForFormat(RichFormat::Paragraph);
auto newCharFormat = cursor.charFormat();