Simplify and fix chat markdown helper and add additional tests

This commit is contained in:
James Graham
2026-01-11 18:14:37 +00:00
parent b45ded678e
commit 79de8a792c
7 changed files with 185 additions and 87 deletions

View File

@@ -22,8 +22,6 @@ public:
ChatTextItemHelper *textItem() const;
void setTextItem(ChatTextItemHelper *textItem);
void handleExternalFormatChange();
Q_SIGNALS:
void textItemChanged();
@@ -36,21 +34,14 @@ Q_SIGNALS:
void unhandledBlockFormat(RichFormat::Format format);
private:
enum State {
None,
Pre,
Started,
};
QPointer<ChatTextItemHelper> m_textItem;
State m_currentState = None;
int m_startPos = 0;
int m_endPos = 0;
void updateStart();
QHash<RichFormat::Format, int> m_currentFormats;
void checkMarkdown(int position, int charsRemoved, int charsAdded);
void updatePosition(int position);
void checkMarkdownForward(int charsAdded);
void complete();
};