[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kwrite-devel
Subject:    Review Request 117613: vimode: fixed a couple of crashes in replace mode.
From:       Miquel_Sabaté_Solà <mikisabate () gmail ! com>
Date:       2014-04-17 15:16:31
Message-ID: 20140417151631.11317.51909 () probe ! kde ! org
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/117613/
-----------------------------------------------------------

Review request for Kate, Michal Humpula and Simon St James.


Repository: ktexteditor


Description
-------

I started my "let's split all the tests into tinier pieces" adventure by writing more \
tests for the replace mode. The final result is this patch, that contains:

- More tests.
- Fixed a crash: when you typed Ctrl-E (or Ctrl-Y) in an empty document, it crashed. \
This is because in the first if statement of the commandInsertFromLine function, it \
                should be >= instead of > (such a classic fix :P).
- Fixed a crash: when you typed Ctrl-E (or Ctrl-Y) and the cursor was at the end of \
the line, it crashed. This was fixed by calling doc()->insertText() for this case. \
Moreover, I took the chance to clean up the commandInsertFromLine function a bit. \
Most notably, instead of calling the cumbersome getCharAtVirtualColumn function now \
                it will call the doc()->characterAt() function.
- I took the chance to clean up the whole KateViReplaceMode class (probably it \
should've been in another patch, sorry about that :P).


Diffs
-----

  autotests/src/vimode/modes.h 1380b47 
  autotests/src/vimode/modes.cpp ed7d45b 
  src/vimode/katevireplacemode.h cf67ebb 
  src/vimode/katevireplacemode.cpp 25ac320 

Diff: https://git.reviewboard.kde.org/r/117613/diff/


Testing
-------

I started by adding more tests to the ReplaceModeTest but I finally decided to split \
this function into three different functions:

- ReplaceBasicTests: for basic replace actions, moving the cursor with the Ctrl key, \
                etc.
- ReplaceUndoTests: for actions that want to undo a replacement (e.g. the backspace \
key). Notice the TODO's here: I'll (hopefully :P) provide another patch in the future \
                to support the Ctrl-W and the Ctrl-U actions. Right now I'm marking \
                this as a TODO.
- ReplaceInsertFromLineTests: for the Ctrl-Y and the Ctrl-E actions.

All the tests are passing.


Thanks,

Miquel Sabaté Solà 


[Attachment #5 (text/html)]

<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="https://git.reviewboard.kde.org/r/117613/">https://git.reviewboard.kde.org/r/117613/</a>
  </td>
    </tr>
   </table>
   <br />




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

<div>Review request for Kate, Michal Humpula and Simon St James.</div>
<div>By Miquel Sabaté Solà .</div>










<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
ktexteditor
</div>


<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;">I started my &quot;let&#39;s split all the tests into tinier \
pieces&quot; adventure by writing more tests for the replace mode. The final result \
is this patch, that contains:

- More tests.
- Fixed a crash: when you typed Ctrl-E (or Ctrl-Y) in an empty document, it crashed. \
This is because in the first if statement of the commandInsertFromLine function, it \
                should be &gt;= instead of &gt; (such a classic fix :P).
- Fixed a crash: when you typed Ctrl-E (or Ctrl-Y) and the cursor was at the end of \
the line, it crashed. This was fixed by calling doc()-&gt;insertText() for this case. \
Moreover, I took the chance to clean up the commandInsertFromLine function a bit. \
Most notably, instead of calling the cumbersome getCharAtVirtualColumn function now \
                it will call the doc()-&gt;characterAt() function.
- I took the chance to clean up the whole KateViReplaceMode class (probably it \
should&#39;ve been in another patch, sorry about that :P).</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;">I started by adding more tests to the ReplaceModeTest but I finally \
decided to split this function into three different functions:

- ReplaceBasicTests: for basic replace actions, moving the cursor with the Ctrl key, \
                etc.
- ReplaceUndoTests: for actions that want to undo a replacement (e.g. the backspace \
key). Notice the TODO&#39;s here: I&#39;ll (hopefully :P) provide another patch in \
the future to support the Ctrl-W and the Ctrl-U actions. Right now I&#39;m marking \
                this as a TODO.
- ReplaceInsertFromLineTests: for the Ctrl-Y and the Ctrl-E actions.

All the tests are passing.</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>autotests/src/vimode/modes.h <span style="color: grey">(1380b47)</span></li>

 <li>autotests/src/vimode/modes.cpp <span style="color: grey">(ed7d45b)</span></li>

 <li>src/vimode/katevireplacemode.h <span style="color: grey">(cf67ebb)</span></li>

 <li>src/vimode/katevireplacemode.cpp <span style="color: grey">(25ac320)</span></li>

</ul>

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







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




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



_______________________________________________
KWrite-Devel mailing list
KWrite-Devel@kde.org
https://mail.kde.org/mailman/listinfo/kwrite-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic