Multiline paste with the same number of lines

Hello KDE community,

If we have text like this:

a
b
c

1
2
3

In Sublime Text and Visual Studio Code it is possible to cut three lines with numbers, select lines with letters, do split to multiple lines, use Home to put cursor at line start, make paste and get this:

1a
2b
3c

In Kate 24.08.3 we get this:

1
2
3a
1
2
3b
1
2
3c

I just tried this out in Kate 24.08.3 - if I set up the lines as you have it at the beginning, turn on Block Selection Mode, select the numbers, then position the cursor at the very beginning (in front of the ‘a’), I get the result you’re looking for - perhaps a matter of not pre-selecting all three target lines before pasting?

Hello @johnandmegh,

Thank you for pointing that out, but unfortunately Block Selection Mode is not quite the same as cursors on multiple lines.

With Sublime Text and Visual Studio Code you can transform this:

a
bb
ccc

1
2
3

Into this:

a1
bb2
ccc3

In Kate with Block Selection Mode you will get this:

a1
b2b
c3cc

With cursors on multiple lines you will get this:

a1
2
3
bb1
2
3
ccc1
2
3

Sublime Text produces similar result when number of lines is mismatched. It probably uses special logic when number of lines is the same.

Actually, that example could also be made to work in Kate by putting cursor before the numbers.

Those are just contrived simple examples to demonstrate how multiple cursors work with paste in other popular editors which have similar feature.

Block Selection Mode will not work with irregularly shaped text not at the beginning of the line or when selected lines are not continuous.

Sublime Text was one of the first (if not the first) editors with multiple cursors editing and it had a long time to perfect it. It implements special logic for pasting when there are multiple cursors on the same number of lines. Bonus is that user doesn’t need to think if Block Selection Mode needs to be used for some operations and how. Current conversation proves that point.

Sublime Text doesn’t have separate Block Selection Mode because such feature is simplest use case for multiple cursors and it is not needed. Kate had Block Selection Mode for a very long time before introducing multiple cursors like in Sublime Text, in my humble opinion it should follow that editor with its implementation of similar feature.

In Sublime Text this:

a a
bb bb
ccc ccc

1
2
3

Can be converted to this:

a1 1a
bb2 2bb
ccc3 3ccc

But cursor movement by a word from another recent topic is also needed:

https://discuss.kde.org/t/cursor-movement-by-a-word/26126/1

Better example of what is possible with multi line paste:

https://www.youtube.com/watch?v=fz3wSuCw1zQ

Unless others have suggestions on plugins/other methods to address that particular use case, it sounds like what you’re looking for here would be a good candidate for a wishlist bug report for Kate so devs can assess?

Here is bug report:
https://bugs.kde.org/show_bug.cgi?id=497152