nibags added a comment.
Some highlighters use endRegion+lookAhead to determine the end of a region when a new one starts, that is, they don't consider the text with endRegion+lookAhead as part of the fold region. This behavior was present before the implementation of KSyntaxHighlighting and, apparently, is no longer from the commit: c004f3f787b2 <https://phabricator.kde.org/R39:c004f3f787b2b6fd8a1c82a66410f5cb39febf18> This problem is noticeable when hiding/showing a region: when a region collapses, the first line of the next region is also included (for example, in the `.diff` files). By doing a search: `(endRegion="[^>]*lookAhead="true"|lookAhead="true"[^>]*endRegion=")` in "data/syntax/" I can see the affected files. I leave some examples attached. Perhaps another solution is better, such as adding some attribute, such as `lookAheadEndRegion="true"`, for the rules that need it. This way you can control the behavior in the C ++ preprocessor and in other languages. F6571368: folding-test.zip <https://phabricator.kde.org/F6571368> REPOSITORY R216 Syntax Highlighting REVISION DETAIL https://phabricator.kde.org/D18516 To: nibags, #framework_syntax_highlighting, cullmann, dhaumann Cc: andreasgr, kwrite-devel, kde-frameworks-devel, hase, michaelh, ngraham, bruns, demsking, cullmann, sars, dhaumann