From c1edda931d81f159e5c4be9f753153b621bdbad2 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 13 Sep 2017 11:56:52 +0200 Subject: Replaced the invisible char hack with a better solution We now cache the format until the next char is inserted, which seems to work fine, doesn't break selection and is overall much cleaner. --- framework/src/domain/documenthandler.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'framework/src/domain/documenthandler.h') diff --git a/framework/src/domain/documenthandler.h b/framework/src/domain/documenthandler.h index 0c1bf971..8be3ba16 100644 --- a/framework/src/domain/documenthandler.h +++ b/framework/src/domain/documenthandler.h @@ -140,8 +140,12 @@ Q_SIGNALS: void textChanged(); +private Q_SLOTS: + void contentsChange(int position, int charsRemoved, int charsAdded); + private: void reset(); + QTextCharFormat charFormat() const; QTextCursor textCursor() const; QTextDocument *textDocument() const; void mergeFormatOnWordOrSelection(const QTextCharFormat &format); @@ -151,6 +155,7 @@ private: int m_cursorPosition; int m_selectionStart; int m_selectionEnd; + QSharedPointer m_cachedTextFormat; }; #endif // DOCUMENTHANDLER_H -- cgit v1.2.3