<table><tr><td style="">nibags added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D18516">View Revision</a></tr></table><br /><div><div><p>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: <a href="https://phabricator.kde.org/R39:c004f3f787b2b6fd8a1c82a66410f5cb39febf18" style="background-color: #e7e7e7;
          border-color: #e7e7e7;
          border-radius: 3px;
          padding: 0 4px;
          font-weight: bold;
          color: black;text-decoration: none;">c004f3f787b2</a></p>

<p>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 <tt style="background: #ebebeb; font-size: 13px;">.diff</tt> files). By doing a search: <tt style="background: #ebebeb; font-size: 13px;">(endRegion="[^>]*lookAhead="true"|lookAhead="true"[^>]*endRegion=")</tt> in "data/syntax/" I can see the affected files. I leave some examples attached.</p>

<p>Perhaps another solution is better, such as adding some attribute, such as <tt style="background: #ebebeb; font-size: 13px;">lookAheadEndRegion="true"</tt>, for the rules that need it. This way you can control the behavior in the C ++ preprocessor and in other languages.</p>

<p><a href="https://phabricator.kde.org/F6571368" style="background-color: #e7e7e7;
          border-color: #e7e7e7;
          border-radius: 3px;
          padding: 0 4px;
          font-weight: bold;
          color: black;text-decoration: none;">F6571368: folding-test.zip</a></p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R216 Syntax Highlighting</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D18516">https://phabricator.kde.org/D18516</a></div></div><br /><div><strong>To: </strong>nibags, Framework: Syntax Highlighting, cullmann, dhaumann<br /><strong>Cc: </strong>andreasgr, kwrite-devel, kde-frameworks-devel, hase, michaelh, ngraham, bruns, demsking, cullmann, sars, dhaumann<br /></div>