SUMMARY When pasting to multiple cursors Kate should check if number of lines in the clipboard is the same as number of multiple cursors and split those lines to corresponding cursor, i.e. each cursor should get single line from the clipboard. With current implementation in Kate every cursor gets all the lines from the clipboard. This is example of similar implementation in Visual Studio Code: https://github.com/microsoft/vscode/blob/4fa5611d67dc84e105e9cd155a746f2d7813d9a0/src/vs/editor/common/cursor/cursorTypeEditOperations.ts#L676 STEPS TO REPRODUCE 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 to the clipboard, select lines with letters, do split to multiple lines, use Home to put cursor at line start, make paste and get this: EXPECTED RESULT ``` 1a 2b 3c ``` OBSERVED RESULT In Kate 24.08.3 we get this: ``` 1 2 3a 1 2 3b 1 2 3c ``` ADDITIONAL INFORMATION Original report: https://bugs.kde.org/show_bug.cgi?id=497152 Related discussion: https://discuss.kde.org/t/multiline-paste-with-the-same-number-of-lines/26128/4
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/ktexteditor/-/merge_requests/768
Git commit 7ab7eec2351275dbdfaf49cbac860e70023a5be7 by Waqar Ahmed. Committed on 25/12/2024 at 11:07. Pushed by waqar into branch 'master'. Try to split clipboard text across multiple cursors when pasting If the number of lines in clipboard text == number of cursors then paste each line of clipboard text at a cursor position instead of pasting all text at each cursor position. FIXED-IN: 6.10 M +12 -0 autotests/src/multicursortest.cpp M +1 -0 autotests/src/multicursortest.h M +11 -5 src/view/kateview.cpp https://invent.kde.org/frameworks/ktexteditor/-/commit/7ab7eec2351275dbdfaf49cbac860e70023a5be7
Will that work if text in the clipboard contains Windows or Mac line endings?
Someone needs to test that
If split is done on `\n` I guess it will not work with `\r` (Mac) line endings, and with `\r\n` (Windows) line endings it will produce new line when pasting.