<table><tr><td style="">nibags created this revision.<br />nibags added reviewers: Framework: Syntax Highlighting, dhaumann, cullmann.<br />Herald added projects: Kate, Frameworks.<br />Herald added subscribers: kde-frameworks-devel, kwrite-devel.<br />nibags requested review of this revision.
</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/D17891">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>BUG: 402720</p>
<p>In the <tt style="background: #ebebeb; font-size: 13px;">wml.xml</tt> file an infinite context switch between <tt style="background: #ebebeb; font-size: 13px;">section</tt> and <tt style="background: #ebebeb; font-size: 13px;">error</tt> is generated, through <tt style="background: #ebebeb; font-size: 13px;">lineEndContext</tt>: in a line break, the <tt style="background: #ebebeb; font-size: 13px;">section</tt> context sends to <tt style="background: #ebebeb; font-size: 13px;">error</tt> and then this is #poped in the line break, causing an infinite cycle. This causes that Kate freezes.</p>
<p>This is reproducible by typing the <tt style="background: #ebebeb; font-size: 13px;">[</tt> character and then a line break.</p>
<p>This bug is reproducible only in KSyntaxHighlighting, since in KF5.48 there is no problem. It's probably necessary to add a guard that avoids infinite context changes.</p>
<p>Also, the WML highlighter is a little old and I have seen some problems in sample files. The highlighter considers all content between <tt style="background: #ebebeb; font-size: 13px;">[</tt> and <tt style="background: #ebebeb; font-size: 13px;">]</tt> as tag. According to the documentation [1]:</p>
<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">Also, tag and key names follow a special format. They will contain only alphanumeric characters and underscores; in particular, they will not contain +, -, or whitespace.</pre></div>
<p>Considering this, and based on the VSCode highlighter, I modified the code so that only tags with valid names are highlighted.</p>
<p><strong>References:</strong></p>
<ul class="remarkup-list">
<li class="remarkup-list-item">[1] Wesnoth Wiki. SyntaxWML, Tag and Attribute Structures: <a href="https://wiki.wesnoth.org/SyntaxWML#Tag_and_Attribute_Structures" class="remarkup-link" target="_blank" rel="noreferrer">https://wiki.wesnoth.org/SyntaxWML#Tag_and_Attribute_Structures</a></li>
<li class="remarkup-list-item">[2] Wesnoth Markup Language syntax highlightning for VS Code: <a href="https://github.com/Byteron/wml" class="remarkup-link" target="_blank" rel="noreferrer">https://github.com/Byteron/wml</a> , <a href="https://marketplace.visualstudio.com/items?itemName=Bitron.wml" class="remarkup-link" target="_blank" rel="noreferrer">https://marketplace.visualstudio.com/items?itemName=Bitron.wml</a></li>
</ul></div></div><br /><div><strong>REPOSITORY</strong><div><div>R216 Syntax Highlighting</div></div></div><br /><div><strong>BRANCH</strong><div><div>fix-wml</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D17891">https://phabricator.kde.org/D17891</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>autotests/folding/test.pbl.fold<br />
autotests/html/test.pbl.html<br />
autotests/input/test.pbl<br />
autotests/reference/test.pbl.ref<br />
data/syntax/wml.xml</div></div></div><br /><div><strong>To: </strong>nibags, Framework: Syntax Highlighting, dhaumann, cullmann<br /><strong>Cc: </strong>kwrite-devel, kde-frameworks-devel, hase, michaelh, ngraham, bruns, demsking, cullmann, sars, dhaumann<br /></div>