Bug 497152 - Multi-line editing, with multiple cursors possible per line
Summary: Multi-line editing, with multiple cursors possible per line
Status: RESOLVED DUPLICATE of bug 487644
Alias: None
Product: kate
Classification: Applications
Component: part (show other bugs)
Version: 24.08.3
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-12-07 07:36 UTC by nomot16750
Modified: 2024-12-23 17:49 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description nomot16750 2024-12-07 07:36:17 UTC
I'm a long time Kate user and first of all big thanks to entire community for making and maintaining this great piece of software.

In Sublime Text and Visual Studio Code this:

```
a b
aa    bb
aaa       bbb

1
2
3
```

Can be converted to this:

```
a1 1b
aa2    2bb
aaa3       3bbb
```

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, use `Ctrl-Right` to put cursor behind all `a`'s , make paste, use `Ctrl-Right` to put cursor behind all `b`'s, use `Ctrl-Left` to put cursor in front of all `b`'s and make paste.

Kate is missing two features to be able to do that.

First is multi line paste with the same number of lines.

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

Video example of what is possible with multi line paste:
https://www.youtube.com/watch?v=fz3wSuCw1zQ

Here is related discussion: https://discuss.kde.org/t/multiline-paste-with-the-same-number-of-lines/26128

Second is specific cursor movement by a word.

In Sublime Text and Visual Studio Code moving cursor with `Ctrl-Right` puts it behind the word. For example, if cursor is just before `bbb` using `Ctrl-Right` will put it behind `bbb`, Kate 24.08.3 puts it before `ccc`:

```
aaaaaa      bbb         ccc
aaa             bbb     ccc
aaaaaa      bbb         ccc
```

By splitting selection to multiple lines Sublime Text like motion makes it possible to select empty space between `bbb` and `ccc` by using `Ctrl-Shift-Left` and `Ctrl-Shift-Right`.

Here is related discussion: https://discuss.kde.org/t/cursor-movement-by-a-word/26126
Comment 1 John Kizer 2024-12-17 04:20:20 UTC
Moving to confirmed wishlist - ultimately a similar request to https://bugs.kde.org/show_bug.cgi?id=316663 if reference there is helpful for anyone.
Comment 2 Waqar Ahmed 2024-12-17 05:33:11 UTC
First is possible if "number of copies" == "number of cursors". You need to copy with multiple cursors, and then paste with multiple cursors. Read the docs https://docs.kde.org/stable5/en/kate/katepart/kate-part-multiple-cursors.html The relevant shortcut is Alt+Shift+I

Second is a duplicate of https://bugs.kde.org/show_bug.cgi?id=487644

Thus I am marking the bug as duplicate.

*** This bug has been marked as a duplicate of bug 487644 ***
Comment 3 nomot16750 2024-12-23 10:40:54 UTC
(In reply to Waqar Ahmed from comment #2)
> First is possible if "number of copies" == "number of cursors". You need to
> copy with multiple cursors, and then paste with multiple cursors. Read the
> docs
> https://docs.kde.org/stable5/en/kate/katepart/kate-part-multiple-cursors.
> html The relevant shortcut is Alt+Shift+I

Hello Waqar,

What if you want to paste lines from another application?

It is not ideal that you need to paste them in separate location in Kate, convert selection to multiple cursors, make copy and then paste at multiple cursors.
Comment 4 nomot16750 2024-12-23 11:01:56 UTC
> Second is a duplicate of https://bugs.kde.org/show_bug.cgi?id=487644
> 
> Thus I am marking the bug as duplicate.

I fail to see how these two bugs are the same. This one is about cursor movement with `Ctrl-Right`, they might be related internally somehow, so I might be wrong.

Bug https://bugs.kde.org/show_bug.cgi?id=487644 is described as hard to solve.

Could cursor movement with `Ctrl-Right` be solved by adding option to `Editing > Text Navigation`?

Long time users who prefer classic behavior don't need to use the option.
Comment 5 nomot16750 2024-12-23 11:54:52 UTC
My main point is that in Sublime Text and Visual Studio Code this:

```
a b
aa    bb
aaa       bbb

1
2
3
```

Can be converted to this:

```
a1 1b
aa2    2bb
aaa3       3bbb
```

Notice numbers after every `a`. In Kate we can add them before every `b` but not after every `a`. Moving cursor with `Ctrl-Right` which puts it behind the word enables that.

In my opinion that is a separate issue from deleting with `Ctrl-Delete`.

Kate already has options for cursor movement `Smart home and smart end`, `PageUp/PageDown moves cursor` and `Enable camel case cursor movement`.

Is it possibility to add something similar for movement with `Ctrl-Right`?
Comment 6 Waqar Ahmed 2024-12-23 17:49:43 UTC
It is the same issue. Its about our word movement, word deletion etc works on top of basic word movement. As suggested by elsewhere, you can easily emulate the needed behavior in a kate script.

Fixing this is not trivial, it requires a lot of changes aka a lot of time.