Bug 56935 - Implement column mode editing (typing on all selected lines in block selection mode)
Summary: Implement column mode editing (typing on all selected lines in block selectio...
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR wishlist
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
: 94784 142377 146572 160277 211251 301842 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-04-07 06:34 UTC by Travers Carter
Modified: 2013-09-10 08:36 UTC (History)
17 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.12


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Travers Carter 2003-04-07 06:34:25 UTC
Version:            (using KDE KDE 3.1)
Installed from:    Unlisted Binary Package
OS:          Linux

It would be nice to be able to type on multiple lines at once while in block selection mode, ie rather than simply inserting the typed characters at the beginning of the selection on the first line selected, insert a copy of each typed character on all selected lines.

If 'Overwrite selection' is on, the first character should replace the selection on all lines, otherwise the characters should just be inserted before the selection on all lines.
Comment 1 Colin Macdonald 2003-06-17 21:23:03 UTC
*** This bug has been confirmed by popular vote. ***
Comment 2 Hamish Rodda 2003-12-03 16:09:40 UTC
How is this supposed to work? Once you type the first key, the selection disappears, correct? So this should only work with the first keypress?

I'm confused...
Comment 3 Travers Carter 2003-12-03 23:16:23 UTC
I first saw the idea in Ultraedit (www.ultraedit.com), a windows text editor, it works something like this, imagine that the '|' represents the edges of the selection in the following block of text

1) Starting text

text
text
text

2) Select the e's on the first two lines.

t|e|xt
t|e|xt
text

3) type 'a', it overwrites the selection on both selected lines and collapses the selection to zero characters wide, after the insert point, but still spaning both lines

ta|xt
ta|xt
text

4) type 'b', it is inserted on both lines before the selection

tab|xt
tab|xt
text

Comment 4 Lars Termansen 2003-12-04 00:18:54 UTC
Anoher way could be to implement a command/shortcut to fill a selection with a  character. Again using | as the edge of the selection
1) starting text

text
text
text

2) select e and x's

t|ex|t
t|ex|t
t|ex|t

3) command to fill selection with one character, eg. a's

t|aa|t
t|aa|t
t|aa|t
t|aa|t

The only command I've seen that does a little of this is the 'comment/uncomment'
under the tools menu. This could be kind of a generic version of that. It's neat for for example inserting &'s in a latex table.

Cheers,
Lars
Comment 5 Ricardo Ferreira 2005-02-16 20:21:36 UTC
Another editor that implements this is SourceEdit (http://www.brixoft.net/prodinfo.asp?id=1), which is free to use.

This is a VERY useful feature. Imagine the help this is when for example you want to add echo's to a file of raw HTML for example. You do it once and its done for all lines.

This gets 20 votes from me :)
Comment 6 Mathieu Jobin 2005-08-13 02:00:50 UTC
you can also look at MacroMates TextMate on Apple OS-X for the greatest example of this.

I definitely want to see this in kate/kdevelop/etc.

so it should be part of kwritepart IMHO

Comment 7 Dominik Haumann 2006-05-03 22:55:28 UTC
*** Bug 94784 has been marked as a duplicate of this bug. ***
Comment 8 Mathieu Jobin 2006-05-05 16:20:41 UTC
I am so missing this feature, its crazy ! I so need it.
and shortcuts to automatically comment code will in most case become useless.
except for <!-- --> and /* */ most comment function like // # or " can be done with column editing.

as for examples. as it has been said before in the bug #94784 
Ultraedit column editing function is not the best and KatePart could definitely do much better. but just to state another example you guys could get inspiration from. its TextMate on OS-X. If you ever have a chance to give it a try.

you can select a bloc, and move it around with the mouse. the text transformation being done, is rather crazy. and, at the time I was using it. yes I did found use for this feature.

when a bloc-selection is overwritten, kate should remembers how many lines was selected, so the typing is still done in column.

anyway, pretty awesome stuff for programming.

thanks

Comment 9 Mathieu Jobin 2006-05-05 16:21:23 UTC
any chance this could hit 3.5.3 ?
Comment 10 Hamish Rodda 2006-05-05 16:40:19 UTC
Not really, 1) we need a patch and 2) the 3.5.x policy is "features developed for  4.0 + backported to 3.5"

I hope to find a decent way to represent it in the UI so it might be possible in 4.0... but I have quite a few other goals in front of this one at the moment.
Comment 11 Dominik Haumann 2007-03-04 17:12:25 UTC
*** Bug 142377 has been marked as a duplicate of this bug. ***
Comment 12 Maciej Pilichowski 2008-04-03 19:17:21 UTC
I think the aim is the same or similar, but the way to achieve it is quite different, here is my wish -- spreadsheet-like paste:
https://bugs.kde.org/show_bug.cgi?id=160277
Comment 13 Dario Ghilardi 2008-10-23 17:58:44 UTC
+1 on this feature.
Comment 14 FiNeX 2009-08-07 22:11:06 UTC
I'm used to write small scripts to accomplish this type of tasks...
Comment 15 Malix 2010-02-16 14:53:30 UTC
+10 votes on this feature.

Another example of good editor that support block typing is Notepad++ ( http://notepad-plus.sourceforge.net/ ). Where is the point of code where this can be done? The katepart under kdelibs?

Thanks
Massimo
Comment 16 Milian Wolff 2010-02-16 14:58:19 UTC
Yes, it will have to be implemented there.
Comment 17 airfullbete 2010-05-04 19:14:41 UTC
+20 on this missing feature.

It is equivalent to allowing "ctrl-v" vi command which is not currently accessible via kate.
Comment 18 Andreas Pakulat 2010-12-23 10:04:27 UTC
I have to wonder what I have to do with this feature request. Or are you simply adding as many people to cc as possible?
Comment 19 Milian Wolff 2010-12-23 13:05:51 UTC
stop this Malix, it won't help anyone - if at all it achieves the opposite.
Comment 20 Dominik Haumann 2011-08-12 13:57:40 UTC
*** Bug 160277 has been marked as a duplicate of this bug. ***
Comment 21 Dominik Haumann 2011-08-12 13:58:23 UTC
*** Bug 146572 has been marked as a duplicate of this bug. ***
Comment 22 Malix 2012-09-03 15:41:11 UTC
Did last development of ViEdit mode cover this request?
Comment 23 gilbert.drew 2012-09-03 23:00:00 UTC
This is not fixed in Kate Version 3.9.0 (at least I can't find a way to do it)

The "ctrl-v" command mentioned above is actually a vim command, so I would not expect it to be available in ViEdit mode.  It would be a great feature to have in the standard edit mode.
Comment 24 Alejandro Moreno Calvo 2012-09-04 09:33:25 UTC
QScintilla2 supports the functionality and can be a good code to take as an example.
Comment 25 Malix 2012-09-04 13:09:28 UTC
Scintilla also support selection using Alt + Shift + <Cursor key> and
permit a null selection. For example:

apple
pear
banana

after selection (| is the caret)

|apple
|pear
|banana

then pressing comma you will get

,apple
,pear
,banana

This will be nice to have.



2012/9/4 Alejandro Moreno Calvo <almorca@gmail.com>:
> https://bugs.kde.org/show_bug.cgi?id=56935
>
> Alejandro Moreno Calvo <almorca@gmail.com> changed:
>
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                  CC|                            |almorca@gmail.com
>
> --- Comment #24 from Alejandro Moreno Calvo <almorca@gmail.com> ---
> QScintilla2 supports the functionality and can be a good code to take as an
> example.
>
> --
> You are receiving this mail because:
> You voted for the bug.
> You are on the CC list for the bug.
Comment 26 Christoph Cullmann 2012-11-01 22:00:53 UTC
*** Bug 301842 has been marked as a duplicate of this bug. ***
Comment 27 Malix 2013-02-05 13:21:03 UTC
Which is the status of this bug? Vim support the insertion of text on multiple lines when in visual mode a block is selected. Is this feature available on kate via VI mode?

Regards
Massimo
Comment 28 Malix 2013-03-20 14:07:38 UTC
Hi,

I want to try to fix this bug. I think that the place to look in is the method TextBlock::insertText in kate/part/buffer/katetextblock.cpp source file. Is this right? Can someone drive me to the right place?

Thanks
Massimo
Comment 29 Christoph Feck 2013-04-24 00:09:12 UTC
Malix, for questions related to Kate development, please use the mailing list.

For more information, see http://kate-editor.org/2012/10/28/contribute-to-kate/ and http://kate-editor.org/join-us/
Comment 30 gilbert.drew 2013-09-09 22:56:21 UTC
Just saw this announcement - 
http://kate-editor.org/2013/09/09/multi-line-text-editing-in-kate/

Looks like I should have been following bug 211251 (https://bugs.kde.org/show_bug.cgi?id=211251) instead.

Great work!
Comment 31 Dominik Haumann 2013-09-10 08:34:23 UTC
Fixed by Andrey for Kate in KDE 4.12 in commit
http://commits.kde.org/kate/7dc070ed3d1b3e6c6e2b901b252b5b25c9d50dfb
Comment 32 Dominik Haumann 2013-09-10 08:34:57 UTC
*** Bug 211251 has been marked as a duplicate of this bug. ***
Comment 33 Dominik Haumann 2013-09-10 08:36:31 UTC
Example: http://kate-editor.org/2013/09/09/multi-line-text-editing-in-kate/