Summary: | KSyntaxHighlighting::SyntaxHighlighter removes QTextBlock::userData() silently | ||
---|---|---|---|
Product: | [Frameworks and Libraries] frameworks-syntax-highlighting | Reporter: | Szyk Cech <szyk100> |
Component: | framework | Assignee: | KWrite Developers <kwrite-bugs-null> |
Status: | RESOLVED WORKSFORME | ||
Severity: | major | CC: | vkrause |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Microsoft Windows | ||
OS: | Microsoft Windows | ||
Latest Commit: | Version Fixed In: |
Description
Szyk Cech
2017-08-10 10:23:44 UTC
Indeed, this is because the Syntax-highlighting framework uses the userData itself to store the State and folding infos, see: https://github.com/KDE/syntax-highlighting/blob/master/src/lib/syntaxhighlighter.cpp So: how is the recommended way to implement bookmarks? Should I dig in Kate code? Maybe someone can explain it in few words. This will save me hours... There is one possible solution: Instead of using the ready-made QSyntaxHighlighter based solution, you could implement your own QSyntaxHighlighter-based solution. This is e.g. done in this commit in the KDE PIM suite: https://phabricator.kde.org/D7672 https://cgit.kde.org/kpimtextedit.git/commit/?id=c775ce3a438814f82cb1ba9c2c8671b9f5be08c4 Here, the class PlainTextSyntaxSpellCheckingHighlighter derives from Sonnet::Highlighter AND KSyntaxHighlighting::AbstractHighlighter. If you follow this same route, you will be able to do what you want. @Volker: I think this is the only solution to this problem, right? If so, I think we can close this bug report, correct? Hi Szyk, after talking to Volker about this, the solution you can find in the linked sources is the only way to go if you need your own custom QTextBlocks. But give this works, there is no real bug, so we will close this as works-for-me. Kate will later use this approach as well. |