<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
    <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="http://git.reviewboard.kde.org/r/107621/">http://git.reviewboard.kde.org/r/107621/</a>
     </td>
    </tr>
   </table>
   <br />



 <p>Ship it!</p>



 <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Seems the proper fix to me, to match what the API dox promises.
For possible regressions from what I looked at and tried to imagine I could not yet see one, should be safe.

ToCGenerator::fetchBookmarkRef(...) using block.position() + block.length() to wrongly calculate the last position is a separate problem :)
KoDocumentRdf::findXmlId(...) is broken anyway (though I miss how your patch improves the situation here, follow-up on IRC for this).
KoTextWriter::Private::saveParagraph(...) looks safe as well to me.
DeleteCommand::doDelete(), hm, not sure where textEditor->selectionEnd() points to and if it is one-off? But separate problem.

BTW, as note for a general TODO for us: I have seen the last days that *To and *End have not always the same semantic, sometimes this refers to behind the last included position, sometimes to the last itself. Should cleaning this up be made a Junior Job bug item perhaps?</pre>
 <br />





<div>




<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
 <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
    <a href="http://git.reviewboard.kde.org/r/107621/diff/1/?file=97468#file97468line116" style="color: black; font-weight: bold; text-decoration: underline;">libs/kotext/KoTextRangeManager.cpp</a>
    <span style="font-weight: normal;">

     (Diff revision 1)

    </span>
   </th>
  </tr>
 </thead>

 <tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
  <tr>

   <td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">QHash<int, KoTextRange *> KoTextRangeManager::textRangesChangingWithin(int first, int last, int matchFirst, int matchLast) const</pre></td>

  </tr>
 </tbody>






 
 

 <tbody>

  <tr>
    <th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">116</font></th>
    <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">            <span class="k">if</span> <span class="p">(</span><span class="n">range</span><span class="o">-></span><span class="n">rangeStart</span><span class="p">()</span> <span class="o">>=</span> <span class="n">first</span> <span class="o">&&</span> <span class="n">range</span><span class="o">-></span><span class="n">rangeStart</span><span class="p">()</span> <span class="o"><=</span> <span class="n">last</span><span class="p">)</span> <span class="p">{</span></pre></td>
    <th bgcolor="#f0f0f0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">116</font></th>
    <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">            <span class="k">if</span> <span class="p">(</span><span class="n">range</span><span class="o">-></span><span class="n">rangeStart</span><span class="p">()</span> <span class="o">>=</span> <span class="n">first</span> <span class="o">&&</span> <span class="n">range</span><span class="o">-></span><span class="n">rangeStart</span><span class="p">()</span> <span class="o"><=</span> <span class="n">last</span><span class="p">)</span> <span class="p">{</span></pre></td>
  </tr>

  <tr>
    <th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">117</font></th>
    <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                <span class="k">if</span> <span class="p">(</span><span class="n">matchLast</span> <span class="o">==</span> <span class="o">-</span><span class="mi">1</span> <span class="o">||</span> <span class="n">range</span><span class="o">-></span><span class="n">rangeEnd</span><span class="p">()</span> <span class="o"><=</span> <span class="n">matchLast</span><span class="p">)</span> <span class="p">{</span></pre></td>
    <th bgcolor="#f0f0f0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">117</font></th>
    <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                <span class="k">if</span> <span class="p">(</span><span class="n">matchLast</span> <span class="o">==</span> <span class="o">-</span><span class="mi">1</span> <span class="o">||</span> <span class="n">range</span><span class="o">-></span><span class="n">rangeEnd</span><span class="p">()</span> <span class="o"><=</span> <span class="n">matchLast</span><span class="p">)</span> <span class="p">{</span></pre></td>
  </tr>

 </tbody>



 
 



 <tbody>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
    <th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">118</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                    <span class="k">if</span> <span class="p">(</span><span class="n">range</span><span class="o">-></span><span class="n">rangeEnd</span><span class="p">()</span> <span class="o">>=</span> <span class="n">matchFirst</span><span class="p">)</span> <span class="p">{</span></pre></td>
  </tr>

 </tbody>

</table>

<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">These three ifs could be merged as well.</pre>
</div>
<br />

<div>




<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
 <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
    <a href="http://git.reviewboard.kde.org/r/107621/diff/1/?file=97468#file97468line117" style="color: black; font-weight: bold; text-decoration: underline;">libs/kotext/KoTextRangeManager.cpp</a>
    <span style="font-weight: normal;">

     (Diff revision 1)

    </span>
   </th>
  </tr>
 </thead>

 <tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
  <tr>

   <td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">QHash<int, KoTextRange *> KoTextRangeManager::textRangesChangingWithin(int first, int last, int matchFirst, int matchLast) const</pre></td>

  </tr>
 </tbody>






 
 

 <tbody>

  <tr>
    <th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">117</font></th>
    <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                <span class="k">if</span> <span class="p">(</span><span class="n">matchLast</span> <span class="o">==</span> <span class="o">-</span><span class="mi">1</span> <span class="o">||</span> <span class="n">range</span><span class="o">-></span><span class="n">rangeEnd</span><span class="p">()</span> <span class="o"><=</span> <span class="n">matchLast</span><span class="p">)</span> <span class="p">{</span></pre></td>
    <th bgcolor="#f0f0f0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">117</font></th>
    <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                <span class="k">if</span> <span class="p">(</span><span class="n">matchLast</span> <span class="o">==</span> <span class="o">-</span><span class="mi">1</span> <span class="o">||</span> <span class="n">range</span><span class="o">-></span><span class="n">rangeEnd</span><span class="p">()</span> <span class="o"><=</span> <span class="n">matchLast</span><span class="p">)</span> <span class="p">{</span></pre></td>
  </tr>

 </tbody>

</table>

<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">While you are at it, could you also add a comment about the option to set matchLast to -1 to the API dox?</pre>
</div>
<br />

<div>




<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
 <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
    <a href="http://git.reviewboard.kde.org/r/107621/diff/1/?file=97468#file97468line123" style="color: black; font-weight: bold; text-decoration: underline;">libs/kotext/KoTextRangeManager.cpp</a>
    <span style="font-weight: normal;">

     (Diff revision 1)

    </span>
   </th>
  </tr>
 </thead>

 <tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
  <tr>

   <td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">QHash<int, KoTextRange *> KoTextRangeManager::textRangesChangingWithin(int first, int last, int matchFirst, int matchLast) const</pre></td>

  </tr>
 </tbody>






 
 

 <tbody>

  <tr>
    <th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">121</font></th>
    <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">            <span class="k">if</span> <span class="p">(</span><span class="n">range</span><span class="o">-></span><span class="n">rangeEnd</span><span class="p">()</span> <span class="o">>=</span> <span class="n">first</span> <span class="o">&&</span> <span class="n">range</span><span class="o">-></span><span class="n">rangeEnd</span><span class="p">()</span> <span class="o"><=</span> <span class="n">last</span><span class="p">)</span> <span class="p">{</span></pre></td>
    <th bgcolor="#f0f0f0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">123</font></th>
    <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">            <span class="k">if</span> <span class="p">(</span><span class="n">range</span><span class="o">-></span><span class="n">rangeEnd</span><span class="p">()</span> <span class="o">>=</span> <span class="n">first</span> <span class="o">&&</span> <span class="n">range</span><span class="o">-></span><span class="n">rangeEnd</span><span class="p">()</span> <span class="o"><=</span> <span class="n">last</span><span class="p">)</span> <span class="p">{</span></pre></td>
  </tr>

 </tbody>


 
 




 <tbody>

  <tr>
    <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">122</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                <span class="k">if</span> <span class="p">(</span><span class="n">match<span class="hl">Fir</span>st</span> <span class="o">==</span> <span class="o">-</span><span class="mi">1</span> <span class="o">||</span> <span class="n">range</span><span class="o">-></span><span class="n">rangeStart</span><span class="p">()</span> <span class="o"><span class="hl">></span>=</span> <span class="n">match<span class="hl">Fir</span>st</span><span class="p">)</span> <span class="p">{</span></pre></td>
    <th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">124</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                <span class="k">if</span> <span class="p">(</span><span class="n">match<span class="hl">La</span>st</span> <span class="o">==</span> <span class="o">-</span><span class="mi">1</span> <span class="o">||</span> <span class="n">range</span><span class="o">-></span><span class="n">rangeStart</span><span class="p">()</span> <span class="o"><span class="hl"><</span>=</span> <span class="n">match<span class="hl">La</span>st</span><span class="p">)</span> <span class="p">{</span></pre></td>
  </tr>

 </tbody>



 
 



 <tbody>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
    <th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">125</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                    <span class="k">if</span> <span class="p">(</span><span class="n">range</span><span class="o">-></span><span class="n">rangeStart</span><span class="p">()</span> <span class="o">>=</span> <span class="n">matchFirst</span><span class="p">)</span> <span class="p">{</span></pre></td>
  </tr>

 </tbody>

</table>

<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">These three ifs could be merged into a single one.
</pre>
</div>
<br />



<p>- Friedrich W. H.</p>


<br />
<p>On December 7th, 2012, 1:58 a.m., C. Boemann wrote:</p>






<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('http://git.reviewboard.kde.org/media/rb/images/review_request_box_top_bg.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
 <tr>
  <td>

<div>Review request for Calligra and Friedrich W. H. Kossebau.</div>
<div>By C. Boemann.</div>


<p style="color: grey;"><i>Updated Dec. 7, 2012, 1:58 a.m.</i></p>






<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Make the textRangesChangingWithin method actually check all that it's supposed to check
    
Normally we don't use this method in a too complex way so there should be no regressions,
but still if bugs come up with saving too few textranges, this will be a patch to investigate
    
Basically we were only checking the matching tag against one of the parameters while we should be
checking against both. I most case the our use is to have global match limits, so that is why we
have not noticed the bug.
</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">None, except the skf test case, and some debug utput to see the method actually does what I want it to.

However there may be some regressions (espcialy in saving), because of changed behavour</pre>
  </td>
 </tr>
</table>




<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>libs/kotext/KoTextRangeManager.cpp <span style="color: grey">(0940fda)</span></li>

</ul>

<p><a href="http://git.reviewboard.kde.org/r/107621/diff/" style="margin-left: 3em;">View Diff</a></p>




  </td>
 </tr>
</table>








  </div>
 </body>
</html>