<table><tr><td style="">mwolff requested changes to this revision.<br />mwolff added inline comments.<br />This revision now requires changes to proceed.
</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/D9168" rel="noreferrer">View Revision</a></tr></table><br /><div><strong>INLINE COMMENTS</strong><div><div style="margin: 6px 0 12px 0;"><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D9168#inline-41302" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">katewordcompletion.cpp:316</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; ">    <span class="n">KTextEditor</span><span style="color: #aa2211">::</span><span class="n">Cursor</span> <span class="n">dcCursor</span><span class="p">;</span>     <span style="color: #74777d">// directional completion search cursor</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">    <span class="n">QReg<span class="bright">Exp</span></span> <span class="n">re</span><span class="p">;</span>           <span style="color: #74777d">// hrm</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="n">QReg<span class="bright">ularExpression</span></span> <span class="n">re</span><span class="p">;</span>           <span style="color: #74777d">// hrm</span>
</div><div style="padding: 0 8px; margin: 0 4px; ">    <span style="color: #aa4000">int</span> <span class="n">directionalPos</span><span class="p">;</span>   <span style="color: #74777d">// be able to insert "" at the correct time</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;"><tt style="background: #ebebeb; font-size: 13px;">hrm</tt> indeed :D wth? ;-)</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D9168#inline-41303" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">katewordcompletion.cpp:478</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; ">            <span style="color: #74777d">//qCDebug(LOG_KTE)<<"USABLE MATCH";</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">            <span class="n">QString</span> <span class="n">m</span> <span style="color: #aa2211">=</span> <span class="bright"></span><span class="n"><span class="bright">d</span></span><span class="bright"></span><span style="color: #aa2211"><span class="bright">-></span></span><span class="bright"></span><span class="n"><span class="bright">re</span></span><span class="p">.</span><span class="n">cap</span><span class="p">(</span><span style="color: #601200">1</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">            <span class="n">QString</span> <span class="n">m</span> <span style="color: #aa2211">=</span> <span class="bright"></span><span class="n"><span class="bright">match</span></span><span class="p">.</span><span class="n">cap<span class="bright">tured</span></span><span class="p">(</span><span style="color: #601200">1</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; ">            <span style="color: #aa4000">if</span> <span class="p">(</span><span class="n">m</span> <span style="color: #aa2211">!=</span> <span class="n">doc</span><span style="color: #aa2211">-></span><span class="n">text</span><span class="p">(</span><span style="color: #aa2211">*</span><span class="n">d</span><span style="color: #aa2211">-></span><span class="n">liRange</span><span class="p">)</span> <span style="color: #aa2211">&&</span> <span class="p">(</span><span class="n">d</span><span style="color: #aa2211">-></span><span class="n">dcCursor</span><span class="p">.</span><span class="n">line</span><span class="p">()</span> <span style="color: #aa2211">!=</span> <span class="n">d</span><span style="color: #aa2211">-></span><span class="n">dcRange</span><span class="p">.</span><span class="n">start</span><span class="p">().</span><span class="n">line</span><span class="p">()</span> <span style="color: #aa2211">||</span> <span class="n">pos</span> <span style="color: #aa2211">!=</span> <span class="n">d</span><span style="color: #aa2211">-></span><span class="n">dcRange</span><span class="p">.</span><span class="n">start</span><span class="p">().</span><span class="n">column</span><span class="p">()))</span> <span class="p">{</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">here and below: can you use capturedRef instead?</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D9168#inline-41301" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">katemodemanager.cpp:167</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; ">        <span class="n">QString</span> <span class="n">varLine</span> <span style="color: #aa2211">=</span> <span class="n">type</span><span style="color: #aa2211">-></span><span class="n">varLine</span><span class="p">;</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">        <span style="color: #aa4000">if</span> <span class="p">(</span><span class="n">QReg<span class="bright">Exp</span></span><span class="bright"></span><span class="p"><span class="bright">(</span></span><span class="bright"></span><span class="n"><span class="bright">QLatin1</span>String</span><span class="p">(</span><span style="color: #766510">"kate:(.*)"</span><span class="p">))<span class="bright">.</span></span><span class="bright"></span><span class="n"><span class="bright">indexIn</span></span><span class="bright"></span><span class="p"><span class="bright">(</span></span><span class="bright"></span><span class="n"><span class="bright">varLine</span></span><span class="p">)</span> <span style="color: #aa2211"><</span> <span style="color: #601200">0</span><span class="p">)</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span style="color: #aa4000">if</span> <span class="p">(<span class="bright"></span></span><span class="bright"></span><span class="n"><span class="bright">varLine</span></span><span class="bright"></span><span class="p"><span class="bright">.</span></span><span class="bright"></span><span class="n"><span class="bright">indexOf</span></span><span class="bright"></span><span class="p"><span class="bright">(</span></span><span class="n">QReg<span class="bright">ularExpression</span></span><span class="bright"></span><span class="p"><span class="bright">(</span></span><span class="bright"></span><span class="n"><span class="bright">Q</span>String<span class="bright">Literal</span></span><span class="p">(</span><span style="color: #766510">"kate:(.*)"</span><span class="p">)))</span> <span style="color: #aa2211"><</span> <span style="color: #601200">0</span><span class="p">)</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; ">            <span class="n">varLine</span><span class="p">.</span><span class="n">prepend</span><span class="p">(</span><span class="n">QLatin1String</span><span class="p">(</span><span style="color: #766510">"kate: "</span><span class="p">));</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">why is this using a regexp? the match group isn't used at all, and the .* can be anything, including empty. So this is the same as <tt style="background: #ebebeb; font-size: 13px;">varLine.contains(QLatin1String("kate:"))</tt></p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D9168#inline-41300" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">printpainter.cpp:289</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">        <span class="n">QReg<span class="bright">Exp</span></span> <span class="n">reTags</span><span class="p">(</span><span class="n">QStringLiteral</span><span class="p">(</span><span style="color: #766510">"%([dDfUhuyY])"</span><span class="p">));</span> <span style="color: #74777d">// TODO tjeck for "%%<TAG>"</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span class="n">QReg<span class="bright">ularExpression</span></span> <span class="n">reTags</span><span class="p">(</span><span class="n">QStringLiteral</span><span class="p">(</span><span style="color: #766510">"%([dDfUhuyY])"</span><span class="p">));</span> <span style="color: #74777d">// TODO tjeck for "%%<TAG>"</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">fix old typo: tjeck -> check</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D9168#inline-41299" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">katecmds.cpp:207</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; ">    <span style="color: #74777d">//create a list of args</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">    <span class="n">QStringList</span> <span class="n">args</span><span class="p">(</span><span class="n">_cmd</span><span class="p">.</span><span class="n">split</span><span class="p">(</span><span class="n">QReg<span class="bright">Exp</span></span><span class="p">(</span><span class="n">QLatin1String</span><span class="p">(</span><span style="color: #766510">"</span><span style="color: #bb6622">\\</span><span style="color: #766510">s+"</span><span class="p">)),</span> <span class="n">QString</span><span style="color: #aa2211">::</span><span class="n">SkipEmptyParts</span><span class="p">));</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="n">QStringList</span> <span class="n">args</span><span class="p">(</span><span class="n">_cmd</span><span class="p">.</span><span class="n">split</span><span class="p">(</span><span class="n">QReg<span class="bright">ularExpression</span></span><span class="p">(</span><span class="n">QLatin1String</span><span class="p">(</span><span style="color: #766510">"</span><span style="color: #bb6622">\\</span><span style="color: #766510">s+"</span><span class="p">)),</span> <span class="n">QString</span><span style="color: #aa2211">::</span><span class="n">SkipEmptyParts</span><span class="p">));</span>
</div><div style="padding: 0 8px; margin: 0 4px; ">    <span class="n">QString</span> <span style="color: #004012">cmd</span><span class="p">(</span><span class="n">args</span><span class="p">.</span><span class="n">takeFirst</span><span class="p">());</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">future cleanup: use splitRef instead, if possible.</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D9168#inline-41297" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">katecmds.cpp:502</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; ">    <span style="color: #74777d">// hex, octal, base 9+1</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">    <span class="n">QReg<span class="bright">Exp</span></span> <span style="color: #004012">num</span><span class="p">(</span><span class="n">QLatin1String</span><span class="p">(</span><span style="color: #766510">"^char *(0?x[0-9A-Fa-f]{1,4}|0[0-7]{1,6}|[0-9]{1,5})</span><span class="err">$</span><span style="color: #766510">"))</span><span class="p">;</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">    <span class="bright"></span><span style="color: #aa4000"><span class="bright">if</span></span><span class="bright"> </span><span class="p"><span class="bright">(</span></span><span class="n">num</span><span class="p">.<span class="bright"></span></span><span class="bright"></span><span class="n"><span class="bright">indexIn</span></span><span class="p">(</span><span class="n">cmd</span><span class="p">)<span class="bright"></span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">==</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">-</span></span><span class="bright"></span><span style="color: #601200"><span class="bright">1</span></span><span class="bright"></span><span class="p"><span class="bright">)</span></span><span class="bright"> </span><span class="p"><span class="bright">{</span></span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="n">QReg<span class="bright">ularExpression</span></span> <span style="color: #004012">num</span><span class="p">(</span><span class="n">QLatin1String</span><span class="p">(</span><span style="color: #766510">"^char *(0?x[0-9A-Fa-f]{1,4}|0[0-7]{1,6}|[0-9]{1,5})</span><span class="err">$</span><span style="color: #766510">"))</span><span class="p">;</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="bright"></span><span class="n"><span class="bright">QRegularExpressionMatch</span></span><span class="bright"> </span><span class="n"><span class="bright">match</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">=</span></span><span class="bright"> </span><span class="n">num</span><span class="p">.<span class="bright"></span></span><span class="bright"></span><span class="n"><span class="bright">match</span></span><span class="p">(</span><span class="n">cmd</span><span class="p">)<span class="bright">;</span></span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">static?</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D9168#inline-41298" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">katecmds.cpp:515</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; ">    <span style="color: #aa4000">if</span> <span class="p">(</span><span class="n">cmd</span><span class="p">[</span><span style="color: #601200">0</span><span class="p">]</span> <span style="color: #aa2211">==</span> <span class="n">QLatin1Char</span><span class="p">(</span><span style="color: #766510">'x'</span><span class="p">)</span> <span style="color: #aa2211">||</span> <span class="n">cmd</span><span class="p">.</span><span class="n">startsWith</span><span class="p">(</span><span class="n">QLatin1String</span><span class="p">(</span><span style="color: #766510">"0x"</span><span class="p">)))</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">        <span class="n">cmd</span><span class="p">.</span><span class="n">remove</span><span class="p">(</span><span class="n">QReg<span class="bright">Exp</span></span><span class="bright"></span><span class="p"><span class="bright">(</span></span><span class="bright"></span><span class="n"><span class="bright">QLatin1</span>String</span><span class="p">(</span><span style="color: #766510">"^0?x"</span><span class="p">)));</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span class="n">cmd</span><span class="p">.</span><span class="n">remove</span><span class="p">(</span><span class="n">QReg<span class="bright">ularExpression</span></span><span class="bright"></span><span class="p"><span class="bright">(</span></span><span class="bright"></span><span class="n"><span class="bright">Q</span>String<span class="bright">Literal</span></span><span class="p">(</span><span style="color: #766510">"^0?x"</span><span class="p">)));</span>
</div><div style="padding: 0 8px; margin: 0 4px; ">        <span class="n">base</span> <span style="color: #aa2211">=</span> <span style="color: #601200">16</span><span class="p">;</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">this should be split into two branches and then use <tt style="background: #ebebeb; font-size: 13px;">cmd.remove(0, 1)</tt> and <tt style="background: #ebebeb; font-size: 13px;">cmd.remove(0, 2)</tt> respectively</p></div></div></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R39 KTextEditor</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D9168" rel="noreferrer">https://phabricator.kde.org/D9168</a></div></div><br /><div><strong>To: </strong>dhaumann, cullmann, kfunk, mwolff<br /><strong>Cc: </strong>Frameworks, kevinapavew, ngraham, demsking, cullmann, sars, dhaumann<br /></div>