[prev in list] [next in list] [prev in thread] [next in thread]
List: kwrite-devel
Subject: Re: Review Request 117618: vimode: cleaning up the KateViReplaceMode class.
From: Miquel_Sabaté_Solà <mikisabate () gmail ! com>
Date: 2014-04-17 20:51:28
Message-ID: 20140417205128.3409.36057 () probe ! kde ! org
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
> On April 17, 2014, 8:35 p.m., Michal Humpula wrote:
> > src/vimode/katevireplacemode.h, line 38
> > <https://git.reviewboard.kde.org/r/117618/diff/1/?file=266689#file266689line38>
> >
> > if you are doing clenaup, you can use explicit here, can you not?:)
sure ;)
> On April 17, 2014, 8:35 p.m., Michal Humpula wrote:
> > src/vimode/katevireplacemode.h, line 84
> > <https://git.reviewboard.kde.org/r/117618/diff/1/?file=266689#file266689line84>
> >
> > why another space here? Was it intentional?:)
Intentional. Note also that after the line: #define KATE_VI_REPLACE_MODE_INCLUDED \
there are 2 blank lines. I do this in the headers :)
> On April 17, 2014, 8:35 p.m., Michal Humpula wrote:
> > src/vimode/katevireplacemode.cpp, line 59
> > <https://git.reviewboard.kde.org/r/117618/diff/1/?file=266690#file266690line59>
> >
> > this is strange, I don't see that characterAt method would account for different \
> > tabwidth. Are the tests missing for different tabwidth or was the implementation \
> > wrong in this detail?
I've tested this both manually and in the tests. The thing here is that when we fetch \
characters, we don't care about the tab width, we just care that it's a tab character \
('\t'). That is, regardless of the tab width, you want to copy a '\t'. This can be \
done with the doc()->characterAt, so probably the getCharAtVirtualColumn function was \
an overkill here :)
- Miquel
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/117618/#review55994
-----------------------------------------------------------
On April 17, 2014, 8:40 p.m., Miquel Sabaté Solà wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/117618/
> -----------------------------------------------------------
>
> (Updated April 17, 2014, 8:40 p.m.)
>
>
> Review request for Kate, Michal Humpula and Simon St James.
>
>
> Repository: ktexteditor
>
>
> Description
> -------
>
> This patch cleans up the KateViReplaceMode class a bit. In particular:
>
> - Added documentation.
> - Added proper class access modifiers for the diferent functions implemented by \
> this class (not everything has to be public :P).
> - In the commandInsertFromLine method I've replaced the getCharAtVirtualColumn call \
> for doc()->characterAt. It's cleaner and less cumbersome :)
> - Cleaned up the includes.
>
>
> Diffs
> -----
>
> src/vimode/katevireplacemode.h cf67ebb
> src/vimode/katevireplacemode.cpp 5b3018c
>
> Diff: https://git.reviewboard.kde.org/r/117618/diff/
>
>
> Testing
> -------
>
> All 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/117618/">https://git.reviewboard.kde.org/r/117618/</a>
</td>
</tr>
</table>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;"> <p style="margin-top: 0;">On April 17th, 2014, 8:35 p.m. UTC, <b>Michal \
Humpula</b> wrote:</p> <blockquote style="margin-left: 1em; border-left: 2px solid \
#d0d0d0; padding-left: 10px;">
<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="https://git.reviewboard.kde.org/r/117618/diff/1/?file=266689#file266689line38" \
style="color: black; font-weight: bold; text-decoration: \
underline;">src/vimode/katevireplacemode.h</a> <span style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">37</font></th> <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">KateViReplaceMode</span><span class="p">(</span><span \
class="n">KateViInputModeManager</span> <span class="o">*</span><span \
class="n">viInputModeManager</span><span class="p">,</span><span class="hl"> \
</span><span class="n"><span class="hl">KTextEditor</span></span><span \
class="o"><span class="hl">::</span></span><span class="n"><span \
class="hl">ViewPrivate</span></span><span class="hl"> </span><span class="o"><span \
class="hl">*</span></span><span class="n"><span class="hl">view</span></span><span \
class="p"><span class="hl">,</span></span><span class="hl"> </span><span \
class="n"><span class="hl">KateViewInternal</span></span><span class="hl"> \
</span><span class="o"><span class="hl">*</span></span><span class="n"><span \
class="hl">viewInternal</span></span><span class="p"><span \
class="hl">);</span></span></pre></td> <th bgcolor="#e9eaa8" style="border-left: 1px \
solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font \
size="2">35</font></th> <td bgcolor="#fdfebc" width="50%"><pre style="font-size: \
8pt; line-height: 140%; margin: 0; "> <span \
class="n">KateViReplaceMode</span><span class="p">(</span><span \
class="n">KateViInputModeManager</span> <span class="o">*</span><span \
class="n">viInputModeManager</span><span class="p">,</span></pre></td> </tr>
</tbody>
</table>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">if you are doing \
clenaup, you can use explicit here, can you not?:)</pre> </blockquote>
</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">sure \
;)</pre> <br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;"> <p style="margin-top: 0;">On April 17th, 2014, 8:35 p.m. UTC, <b>Michal \
Humpula</b> wrote:</p> <blockquote style="margin-left: 1em; border-left: 2px solid \
#d0d0d0; padding-left: 10px;">
<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="https://git.reviewboard.kde.org/r/117618/diff/1/?file=266689#file266689line84" \
style="color: black; font-weight: bold; text-decoration: \
underline;">src/vimode/katevireplacemode.h</a> <span style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">57</font></th> <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "><span \
class="cp">#endif</span></pre></td> <th bgcolor="#e9eaa8" style="border-left: 1px \
solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font \
size="2">78</font></th> <td bgcolor="#fdfebc" width="50%"><pre style="font-size: \
8pt; line-height: 140%; margin: 0; "></pre></td> </tr>
</tbody>
</table>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">why another space here? \
Was it intentional?:) </pre> </blockquote>
</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">Intentional. Note also that after the line: #define \
KATE_VI_REPLACE_MODE_INCLUDED there are 2 blank lines. I do this in the headers :) \
</pre> <br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;"> <p style="margin-top: 0;">On April 17th, 2014, 8:35 p.m. UTC, <b>Michal \
Humpula</b> wrote:</p> <blockquote style="margin-left: 1em; border-left: 2px solid \
#d0d0d0; padding-left: 10px;">
<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="https://git.reviewboard.kde.org/r/117618/diff/1/?file=266690#file266690line59" \
style="color: black; font-weight: bold; text-decoration: \
underline;">src/vimode/katevireplacemode.cpp</a> <span style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">50</font></th> <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">QChar</span> <span class="n">ch</span> <span class="o">=</span> <span \
class="n">getCharAtVirtualColumn</span><span class="p">(</span><span \
class="n">line</span><span class="p">,</span> <span class="n">m_view</span><span \
class="o">-></span><span class="n">virtualCursorColumn</span><span \
class="p">(),</span> <span class="n">tabWidth</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">53</font></th> <td bgcolor="#fdfebc" width="50%"><pre style="font-size: \
8pt; line-height: 140%; margin: 0; "> <span class="n">QChar</span> <span \
class="n">ch</span> <span class="o">=</span> <span class="n">doc</span><span \
class="p">()</span><span class="o">-></span><span \
class="n">characterAt</span><span class="p">(</span><span \
class="n">target</span><span class="p">);</span></pre></td> </tr>
</tbody>
</table>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">this is strange, I \
don't see that characterAt method would account for different tabwidth. Are the \
tests missing for different tabwidth or was the implementation wrong in this \
detail?</pre> </blockquote>
</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I've \
tested this both manually and in the tests. The thing here is that when we fetch \
characters, we don't care about the tab width, we just care that it's a tab \
character ('\t'). That is, regardless of the tab width, you want to copy a \
'\t'. This can be done with the doc()->characterAt, so probably the \
getCharAtVirtualColumn function was an overkill here :)</pre> <br />
<p>- Miquel</p>
<br />
<p>On April 17th, 2014, 8:40 p.m. UTC, Miquel Sabaté Solà wrote:</p>
<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>
<p style="color: grey;"><i>Updated April 17, 2014, 8:40 p.m.</i></p>
<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;">This patch cleans up the KateViReplaceMode class a bit. In particular:
- Added documentation.
- Added proper class access modifiers for the diferent functions implemented by this \
class (not everything has to be public :P).
- In the commandInsertFromLine method I've replaced the getCharAtVirtualColumn \
call for doc()->characterAt. It's cleaner and less cumbersome \
:)
- Cleaned up the includes.</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;">All 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>src/vimode/katevireplacemode.h <span style="color: grey">(cf67ebb)</span></li>
<li>src/vimode/katevireplacemode.cpp <span style="color: grey">(5b3018c)</span></li>
</ul>
<p><a href="https://git.reviewboard.kde.org/r/117618/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