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

List:       kwrite-devel
Subject:    Re: Review Request 115443: Added a "Relative line numbers" option.
From:       Miquel_Sabaté_Solà <mikisabate () gmail ! com>
Date:       2014-03-05 18:37:38
Message-ID: 20140305183738.30951.84930 () probe ! kde ! org
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


> On March 5, 2014, 5:10 p.m., Michal Humpula wrote:
> > Love it. Just a few micro-issues.
> > 
> > We don't have to stick with precise Vim functionality, so what are you saying \
> > about prefixing the numbers before current line with minus sign? Do you think it \
> > would make more sense? In vim case it would waste one terminal column, but in \
> > kate it's few pixels. 
> > Hate the checkbox, we realy need the ":set numbers" like functionality in kate. \
> > But for now it will have to do. 
> > Don't like another vi-mode specific switch in kateview. In long term I would like \
> > to cut out vi-mode specific code from the rest of the codebase as much as \
> > possible. But that's for KF5. So go ahead with this. Let's see what will happen \
> > in KF5 at the end. 
> > I agree that for non-vi-mode users this feature doesn't make much sense, so \
> > putting it to vi-mode only makes sense. 
> > Since everything I've described is optional, I'm giving the ship it.

I don't like the minus sign idea. My way of thinking is "2 lines above", not "-2 \
lines". I guess that I'm too used to how vim handles this :) And for mere aesthetics, \
I also prefer vim's way :P

I agree with the rest of your comment.


> On March 5, 2014, 5:10 p.m., Michal Humpula wrote:
> > part/view/kateviewinternal.cpp, line 1884
> > <https://git.reviewboard.kde.org/r/115443/diff/2/?file=252241#file252241line1884>
> > 
> > use {} here, though it's kate master, so you don't have to:) But someone will \
> > have to port it to ktexteditor so less work with coding style issues. Same goes \
> > everywhere else in this patch (the spaces will be pain:(

Don't worry, I'll do the porting myself and I'll behave with the spaces and \
everything :P


> On March 5, 2014, 5:10 p.m., Michal Humpula wrote:
> > part/view/kateviewhelpers.cpp, line 1705
> > <https://git.reviewboard.kde.org/r/115443/diff/2/?file=252239#file252239line1705>
> > 
> > this is just a personal taste - do you think it could be refactored to separate \
> > private function? The KateIconBorder::paintBorder is getting quite long and \
> > unreadable.

Ok, I've tried this one but then it just happened that this private method turns out \
to have 6 arguments (z, realLine, currentLine, lnX, lnWidth, p), and I don't like \
that :)


- Miquel


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


On March 5, 2014, 6:31 p.m., Miquel Sabaté Solà wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/115443/
> -----------------------------------------------------------
> 
> (Updated March 5, 2014, 6:31 p.m.)
> 
> 
> Review request for Kate.
> 
> 
> Repository: kate
> 
> 
> Description
> -------
> 
> Ok, here it goes a "crazy" idea :) In vim there's the "relativenumber" option. In \
> short, this means that in the left border we no longer have absolute line numbers \
> but line numbers relative to the current cursor (see the "relative.png" \
> attachment). This is useful since in vim all commands accept an optional number \
> (that is relative to the current cursor). This feature is, of course, configurable \
> and set to false by default. Moreover since this is a feature that, in my opinion, \
> only makes sense in vim, I've added this option under the "Vi Input Mode" tab in \
> the configuration (see the "relative1.png" attachment). 
> This is cool and everything, but it's not fully working yet :( We don't want to be \
> updating the left border all the time (otherwise the CPU usage goes kind of crazy, \
> 20% more or less with KWrite). I'm only updating the left border when the user \
> moves up or down. However, in some situations the line numbering does not update. \
> An example of this is opening a large file, going in the middle of the file and \
> then starting to move up and down. For some reason in this situation the left \
> border is not updated. Since I'm kind of new to the KateView code, I'd like to hear \
> suggestions and tips so we can fix this issue :P 
> Thanks for your time :) !
> 
> 
> Diffs
> -----
> 
> part/dialogs/katedialogs.cpp 4de0628 
> part/dialogs/viinputmodeconfigwidget.ui 29a5257 
> part/utils/kateconfig.h d5f085b 
> part/utils/kateconfig.cpp 20c4494 
> part/view/kateview.h fc15b94 
> part/view/kateview.cpp f5c8d6f 
> part/view/kateviewhelpers.h 7f76ed3 
> part/view/kateviewhelpers.cpp 80eebb67 
> part/view/kateviewinternal.h 5d7c2f4 
> part/view/kateviewinternal.cpp 505cb93 
> 
> Diff: https://git.reviewboard.kde.org/r/115443/diff/
> 
> 
> Testing
> -------
> 
> Manual testing. It's not working properly yet, take a look at the "Description" \
> section above. 
> 
> File Attachments
> ----------------
> 
> A snapshot
> https://git.reviewboard.kde.org/media/uploaded/files/2014/02/03/09554ab4-fc68-4044-8629-3aa6c65e0f10__relative.png
>  Option
> https://git.reviewboard.kde.org/media/uploaded/files/2014/02/03/88e089f9-a3ab-4622-b9a0-d017ab57b349__relative1.png
>  
> 
> 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/115443/">https://git.reviewboard.kde.org/r/115443/</a>
  </td>
    </tr>
   </table>
   <br />





<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <p style="margin-top: 0;">On March 5th, 2014, 5:10 p.m. UTC, <b>Michal \
Humpula</b> wrote:</p>  <blockquote style="margin-left: 1em; border-left: 2px solid \
#d0d0d0; padding-left: 10px;">  <pre style="white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">Love it. Just a few micro-issues.

We don&#39;t have to stick with precise Vim functionality, so what are you saying \
about prefixing the numbers before current line with minus sign? Do you think it \
would make more sense? In vim case it would waste one terminal column, but in kate \
it&#39;s few pixels.

Hate the checkbox, we realy need the &quot;:set numbers&quot; like functionality in \
kate. But for now it will have to do.

Don&#39;t like another vi-mode specific switch in kateview. In long term I would like \
to cut out vi-mode specific code from the rest of the codebase as much as possible. \
But that&#39;s for KF5. So go ahead with this. Let&#39;s see what will happen in KF5 \
at the end.

I agree that for non-vi-mode users this feature doesn&#39;t make much sense, so \
putting it to vi-mode only makes sense.

Since everything I&#39;ve described is optional, I&#39;m giving the ship it.</pre>
 </blockquote>







</blockquote>

<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I don&#39;t like the \
minus sign idea. My way of thinking is &quot;2 lines above&quot;, not &quot;-2 \
lines&quot;. I guess that I&#39;m too used to how vim handles this :) And for mere \
aesthetics, I also prefer vim&#39;s way :P

I agree with the rest of your comment.</pre>
<br />







<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <p style="margin-top: 0;">On March 5th, 2014, 5:10 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/115443/diff/2/?file=252239#file252239line1705" \
style="color: black; font-weight: bold; text-decoration: \
underline;">part/view/kateviewhelpers.cpp</a>  <span style="font-weight: normal;">

     (Diff revision 2)

    </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; ">static \
void paintTriangle (QPainter &amp;painter, QColor c, int xOffset, int yOffset, int \
width, int height, bool open)</pre></td>

  </tr>
 </tbody>



 
 

 <tbody>

  <tr>
    <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">1679</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">m_<span \
class="hl">l</span>ineNumbersOn</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">1705</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">m_<span \
class="hl">viRelL</span>ineNumbersOn</span><span class="p">)</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 just a personal \
taste - do you think it could be refactored to separate private function? The \
KateIconBorder::paintBorder is getting quite long and unreadable.</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;">Ok, \
I&#39;ve tried this one but then it just happened that this private method turns out \
to have 6 arguments (z, realLine, currentLine, lnX, lnWidth, p), and I don&#39;t like \
that :)</pre> <br />

<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <p style="margin-top: 0;">On March 5th, 2014, 5:10 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/115443/diff/2/?file=252241#file252241line1884" \
style="color: black; font-weight: bold; text-decoration: \
underline;">part/view/kateviewinternal.cpp</a>  <span style="font-weight: normal;">

     (Diff revision 2)

    </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; ">void \
KateViewInternal::updateCursor( const KTextEditor::Cursor&amp; newCursor, bool force, \
bool center, bool calledExternally )</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">1884</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">m_cursor</span><span \
class="p">.</span><span class="n">line</span><span class="p">()</span> <span \
class="o">!=</span> <span class="n">newCursor</span><span class="p">.</span><span \
class="n">line</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;">use {} here, though \
it&#39;s kate master, so you don&#39;t have to:) But someone will have to port it to \
ktexteditor so less work with coding style issues. Same goes everywhere else in this \
patch (the spaces will be pain:(</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;">Don&#39;t \
worry, I&#39;ll do the porting myself and I&#39;ll behave with the spaces and \
everything :P</pre> <br />




<p>- Miquel</p>


<br />
<p>On March 5th, 2014, 6:31 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.</div>
<div>By Miquel Sabaté Solà .</div>


<p style="color: grey;"><i>Updated March 5, 2014, 6:31 p.m.</i></p>









<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
kate
</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;">Ok, here it goes a &quot;crazy&quot; idea :) In vim there&#39;s the \
&quot;relativenumber&quot; option. In short, this means that in the left border we no \
longer have absolute line numbers but line numbers relative to the current cursor \
(see the &quot;relative.png&quot; attachment). This is useful since in vim all \
commands accept an optional number (that is relative to the current cursor). This \
feature is, of course, configurable and set to false by default. Moreover since this \
is a feature that, in my opinion, only makes sense in vim, I&#39;ve added this option \
under the &quot;Vi Input Mode&quot; tab in the configuration (see the \
&quot;relative1.png&quot; attachment).

This is cool and everything, but it&#39;s not fully working yet :( We don&#39;t want \
to be updating the left border all the time (otherwise the CPU usage goes kind of \
crazy, 20% more or less with KWrite). I&#39;m only updating the left border when the \
user moves up or down. However, in some situations the line numbering does not \
update. An example of this is opening a large file, going in the middle of the file \
and then starting to move up and down. For some reason in this situation the left \
border is not updated. Since I&#39;m kind of new to the KateView code, I&#39;d like \
to hear suggestions and tips so we can fix this issue :P

Thanks for your time :) !</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;">Manual testing. It&#39;s not working properly yet, take a look at the \
&quot;Description&quot; section above.</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>part/dialogs/katedialogs.cpp <span style="color: grey">(4de0628)</span></li>

 <li>part/dialogs/viinputmodeconfigwidget.ui <span style="color: \
grey">(29a5257)</span></li>

 <li>part/utils/kateconfig.h <span style="color: grey">(d5f085b)</span></li>

 <li>part/utils/kateconfig.cpp <span style="color: grey">(20c4494)</span></li>

 <li>part/view/kateview.h <span style="color: grey">(fc15b94)</span></li>

 <li>part/view/kateview.cpp <span style="color: grey">(f5c8d6f)</span></li>

 <li>part/view/kateviewhelpers.h <span style="color: grey">(7f76ed3)</span></li>

 <li>part/view/kateviewhelpers.cpp <span style="color: grey">(80eebb67)</span></li>

 <li>part/view/kateviewinternal.h <span style="color: grey">(5d7c2f4)</span></li>

 <li>part/view/kateviewinternal.cpp <span style="color: grey">(505cb93)</span></li>

</ul>

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



<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">File Attachments \
</h1>

<ul>

 <li><a href="https://git.reviewboard.kde.org/media/uploaded/files/2014/02/03/09554ab4-fc68-4044-8629-3aa6c65e0f10__relative.png">A \
snapshot</a></li>

 <li><a href="https://git.reviewboard.kde.org/media/uploaded/files/2014/02/03/88e089f9-a3ab-4622-b9a0-d017ab57b349__relative1.png">Option</a></li>


</ul>





  </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