[prev in list] [next in list] [prev in thread] [next in thread]
List: kwrite-devel
Subject: Re: Review Request 117660: vimode: make the S and C commands change the whole line in visual-line mo
From: Miquel_Sabaté_Solà <mikisabate () gmail ! com>
Date: 2014-04-21 11:08:45
Message-ID: 20140421110845.3533.36994 () probe ! kde ! org
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
> On April 20, 2014, 7:24 p.m., Michal Humpula wrote:
> > There is a precedence with normal mode "Y" command, i.e. it does the "correct" \
> > thing in kate but not in vim = yanking to the end of line, no the whole line. \
> > From my point of view, this applies here to. Having capitalized commands work on \
> > "from here to the end of line". I agree that visual line mode is a bordeline \
> > case, but I don't see the point of changing behaviour of this command in this one \
> > case, when the user can still use "c" to the the job.
>
> Miquel Sabaté Solà wrote:
> Yes, I agree with you. However, in my opinion, the current behavior in Kate of the \
> C and S commands in visual-line mode doesn't make any sense right now. For example, \
> if you type "lVCX" in the following text:
> Hello
> World
>
> You end up with:
>
> WXorld
>
> This doesn't make sense. Yes, the user should've used the c command to do the right \
> thing. But I got to this patch because by accident I typed C instead of c and I \
> ended up in an unexpected situation ;)
> So this patch basically says that in visual-line mode, C and S are the same as c \
> and s, because that's in my opinion the expected thing to happen in visual-line \
> mode :)
> Michal Humpula wrote:
> What about doing something like this
>
> HX
> World
>
> ?
>
> Miquel Sabaté Solà wrote:
> This would certainly make more sense than the current behavior, and it's the same \
> behavior as in normal mode. However, this is not normal mode, this is visual mode, \
> and therefore we have a certain text selected. Since this is visual-line mode, the \
> whole line is selected. Therefore, if you perform a "change" command, the change \
> should affect the selection, that is, the whole line. Therefore, the text should \
> imo end up like this (which is how it looks with my patch applied ;) ):
> X
> World
>
>
> Michal Humpula wrote:
> ok, then only way to delete to the end of line and jump to insert would be "Di", \
> right? And what about this example:
> start:
> aaaa
> bbbbbbb
> ccc
>
> input: 2lV2jCX
>
> expected:
> aaX
> bbX
> ccX
>
> wouldn't it make more sense? Please notice that you cann't use visual block mode to \
> "delete after second column" (it will not select the to the end of second line).
> Michal Humpula wrote:
> To put it differently: I was at the impression that vim selection is a way to give \
> a commands hint on area to operate on and it's up to the command to choose from \
> that hint what it needs. For example substition command, no matter how you do \
> selection, is interested only on first and last line selected so it knows where to \
> start substituting and where it should end. Column information is ignored in this \
> case. The "C" should in my opinion behave similarly.
> Miquel Sabaté Solà wrote:
> > ok, then only way to delete to the end of line and jump to insert would be "Di", \
> > right?
>
> Well, the current behavior is more like: "Da". Also note that in visual-line mode, \
> "d" and "D" are synonyms. Therefore, for consistency, it makes sense for us to make \
> c do the same as C, and the same goes for the s command ;)
> > wouldn't it make more sense?
>
> That would certainly be cooler, that's for sure :) However, in this case it would \
> be cooler that this is done in visual-block mode. Currently, for your example you \
> can do something like "2l<c-v>2jCX". This would lead to:
> aaX
> bb
> cc
>
> Certainly this is not exactly what you wanted though :P Anyways, inserting contents \
> in the same column at the same time in a range of selected lines sounds more like \
> Kate's Block selection mode, which is something that we lack in vi-mode :) For \
> example, (I'm just wondering around, don't take me very seriously here ;) ), we \
> could make the in visual-block mode when we press "i" or "c" we enter in Kate's \
> block selection mode, and so your problem would be resolved in a *much* powerful \
> way.
> Therefore, in my opinion, in visual-line block we have the following options for \
> the C and S commands:
> 1. We can say that since they are not useful, and they are not implemented, and \
> therefore the c and s commands should be used. 2. We can say that c, C, s and S are \
> synonyms in visual-line mode. This is what my patch goes after. 3. Another option, \
> (and I think that this is what you expect from your first question :) ), is that C \
> and S are the same as doing "DI". That is, delete the current line and go to the \
> first non-blank character of the next line.
> What do you think ?
>
> Michal Humpula wrote:
> we need a third person here:)
Definitely :) Let's see if Simon can take a look at this review request and give his \
opinion :)
- Miquel
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/117660/#review56089
-----------------------------------------------------------
On April 20, 2014, 5:31 p.m., Miquel Sabaté Solà wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/117660/
> -----------------------------------------------------------
>
> (Updated April 20, 2014, 5:31 p.m.)
>
>
> Review request for Kate, Michal Humpula and Simon St James.
>
>
> Repository: ktexteditor
>
>
> Description
> -------
>
> When in visual-line mode, the C command should behave exactly as the c command in \
> this case: change the whole line. This is because the purpose of visual-line mode \
> is to perform commands on lines, not in some parts of a line. The current behavior \
> doesn't make a lot of sense imho: it deletes the current line and goes to the \
> second column of the next line in insert mode. Plus, the behavior of the C command \
> in this patch matches the behavior in vim for this case. I know that we don't \
> *have* to mimic all the vim behavior, but in this case it makes much more sense \
> than the actual behavior in kate.
> So, why have I included also the S command in this patch? Well, before this patch \
> the S command behaved like the C command in this case in Kate. So, I think we \
> should apply the same logic as in the C's case. Vim does something that I don't \
> fully understand, so I guess we won't be mimicking vim here :P
>
> Diffs
> -----
>
> autotests/src/vimode/modes.cpp cf4705d
> src/vimode/katevivisualmode.cpp 25d4bd9
>
> Diff: https://git.reviewboard.kde.org/r/117660/diff/
>
>
> Testing
> -------
>
> All tests are passing. I've also added a couple of tests.
>
>
> 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/117660/">https://git.reviewboard.kde.org/r/117660/</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 20th, 2014, 7:24 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;">There is a precedence with normal mode "Y" command, i.e. it \
does the "correct" thing in kate but not in vim = yanking to the end of \
line, no the whole line. From my point of view, this applies here to. Having \
capitalized commands work on "from here to the end of line". I agree that \
visual line mode is a bordeline case, but I don't see the point of changing \
behaviour of this command in this one case, when the user can still use "c" \
to the the job.</pre> </blockquote>
<p>On April 20th, 2014, 7:38 p.m. UTC, <b>Miquel Sabaté Solà </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;">Yes, I agree with you. \
However, in my opinion, the current behavior in Kate of the C and S commands in \
visual-line mode doesn't make any sense right now. For example, if you type \
"lVCX" in the following text:
Hello
World
You end up with:
WXorld
This doesn't make sense. Yes, the user should've used the c command to do the \
right thing. But I got to this patch because by accident I typed C instead of c and I \
ended up in an unexpected situation ;)
So this patch basically says that in visual-line mode, C and S are the same as c and \
s, because that's in my opinion the expected thing to happen in visual-line mode \
:)</pre> </blockquote>
<p>On April 20th, 2014, 8:08 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;">What about doing \
something like this
HX
World
?</pre>
</blockquote>
<p>On April 20th, 2014, 8:19 p.m. UTC, <b>Miquel Sabaté Solà </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;">This would certainly \
make more sense than the current behavior, and it's the same behavior as in \
normal mode. However, this is not normal mode, this is visual mode, and therefore we \
have a certain text selected. Since this is visual-line mode, the whole line is \
selected. Therefore, if you perform a "change" command, the change should \
affect the selection, that is, the whole line. Therefore, the text should imo end up \
like this (which is how it looks with my patch applied ;) ):
X
World
</pre>
</blockquote>
<p>On April 20th, 2014, 8:30 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;">ok, then only way to \
delete to the end of line and jump to insert would be "Di", right? And what \
about this example:
start:
aaaa
bbbbbbb
ccc
input: 2lV2jCX
expected:
aaX
bbX
ccX
wouldn't it make more sense? Please notice that you cann't use visual block \
mode to "delete after second column" (it will not select the to the end of \
second line).</pre> </blockquote>
<p>On April 20th, 2014, 8:57 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;">To put it differently: I \
was at the impression that vim selection is a way to give a commands hint on area to \
operate on and it's up to the command to choose from that hint what it needs. For \
example substition command, no matter how you do selection, is interested only on \
first and last line selected so it knows where to start substituting and where it \
should end. Column information is ignored in this case. The "C" should in \
my opinion behave similarly.</pre> </blockquote>
<p>On April 20th, 2014, 8:59 p.m. UTC, <b>Miquel Sabaté Solà </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;">> ok, then only way \
to delete to the end of line and jump to insert would be "Di", right?
Well, the current behavior is more like: "Da". Also note that in \
visual-line mode, "d" and "D" are synonyms. Therefore, for \
consistency, it makes sense for us to make c do the same as C, and the same goes for \
the s command ;)
> wouldn't it make more sense?
That would certainly be cooler, that's for sure :) However, in this case it would \
be cooler that this is done in visual-block mode. Currently, for your example you can \
do something like "2l<c-v>2jCX". This would lead to:
aaX
bb
cc
Certainly this is not exactly what you wanted though :P Anyways, inserting contents \
in the same column at the same time in a range of selected lines sounds more like \
Kate's Block selection mode, which is something that we lack in vi-mode :) For \
example, (I'm just wondering around, don't take me very seriously here ;) ), \
we could make the in visual-block mode when we press "i" or "c" \
we enter in Kate's block selection mode, and so your problem would be resolved in \
a *much* powerful way.
Therefore, in my opinion, in visual-line block we have the following options for the \
C and S commands:
1. We can say that since they are not useful, and they are not implemented, and \
therefore the c and s commands should be used. 2. We can say that c, C, s and S are \
synonyms in visual-line mode. This is what my patch goes after. 3. Another option, \
(and I think that this is what you expect from your first question :) ), is that C \
and S are the same as doing "DI". That is, delete the current line and go \
to the first non-blank character of the next line.
What do you think ?</pre>
</blockquote>
<p>On April 21st, 2014, 11:01 a.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;">we need a third person \
here:)</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;">Definitely :) Let's \
see if Simon can take a look at this review request and give his opinion :)</pre> <br \
/>
<p>- Miquel</p>
<br />
<p>On April 20th, 2014, 5: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, Michal Humpula and Simon St James.</div>
<div>By Miquel Sabaté Solà .</div>
<p style="color: grey;"><i>Updated April 20, 2014, 5:31 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;">When in visual-line mode, the C command should behave exactly as the c \
command in this case: change the whole line. This is because the purpose of \
visual-line mode is to perform commands on lines, not in some parts of a line. The \
current behavior doesn't make a lot of sense imho: it deletes the current line \
and goes to the second column of the next line in insert mode. Plus, the behavior of \
the C command in this patch matches the behavior in vim for this case. I know that we \
don't *have* to mimic all the vim behavior, but in this case it makes much more \
sense than the actual behavior in kate.
So, why have I included also the S command in this patch? Well, before this patch the \
S command behaved like the C command in this case in Kate. So, I think we should \
apply the same logic as in the C's case. Vim does something that I don't \
fully understand, so I guess we won't be mimicking vim here :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;">All tests are passing. I've also added a couple of tests.</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.cpp <span style="color: grey">(cf4705d)</span></li>
<li>src/vimode/katevivisualmode.cpp <span style="color: grey">(25d4bd9)</span></li>
</ul>
<p><a href="https://git.reviewboard.kde.org/r/117660/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