Bug 383390

Summary: Please move TextBlockUserData from syntaxhighlighter.cpp to the syntaxhighlighter.h
Product: [Frameworks and Libraries] frameworks-syntax-highlighting Reporter: Szyk Cech <szyk100>
Component: frameworkAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED INTENTIONAL    
Severity: wishlist    
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Patch moving TextBlockUserData from syntaxhighlighter.cpp to the syntaxhighlighter.h

Description Szyk Cech 2017-08-11 11:13:34 UTC
Hi
In connection to https://bugs.kde.org/show_bug.cgi?id=383350 problem.
I study KTextEditor sources and I found complex code for bookmark handling. I found easy way to avoid this in my code. How ever now my editor require KSyntaxhighlighter in order to compile. So maybe my solution is not acceptable for KTextEditor.
My solution is:
1. move TextBlockUserData from syntaxhighlighter.cpp to the syntaxhighlighter.h
2. inherit TextBlockUserData by LineInfo class used by my Editor class in order to add bookmark info (enabled and position in line).

Now it works as expected. But modularity hurts. But I think it is acceptable in simple editors like mine.

thanks and best regards
Szyk Cech
Comment 1 Dominik Haumann 2017-08-12 00:46:16 UTC
Please attach a patch of your changes so that we have a chance to investigate your solution. Based on this, we may find a good solution that works for everyone.
Comment 2 Szyk Cech 2017-08-12 04:50:06 UTC
Created attachment 107220 [details]
Patch moving TextBlockUserData from syntaxhighlighter.cpp to the syntaxhighlighter.h

Patch moving TextBlockUserData from syntaxhighlighter.cpp to the syntaxhighlighter.h
Comment 3 Dominik Haumann 2017-09-04 19:40:45 UTC
Again, looking at how this can be solved (see proposed solution in https://bugs.kde.org/show_bug.cgi?id=383350), this is a wont-fix, since this is simply not necessary.

The other solution, i.e. inheriting from AbstractHighlighter, is the way to go. This way you have 100% flexibility where you store the State variable.

I'll close as wont-fix. If you have further questions, please join the kwrite-devel@kde.org mailing list and I'm sure we'll fine a solution for you.
Comment 4 Dominik Haumann 2017-09-04 19:42:54 UTC
See also detailed documentation here:
https://api.kde.org/frameworks/syntax-highlighting/html/classKSyntaxHighlighting_1_1AbstractHighlighter.html