Created attachment 108144 [details] Screenshot showing the preview The preview of copied text shown in the plasma widget cuts off characters before newlines which are not at the end of text sections. Steps to reproduce: 1. Copy the following text: "abcde\nfghij" (where '\n' is an actual newline). 2. Look at the preview shown in the plasma widget. It will display "abcd\nfghij" (Screenshot attached) 3. However, one can see that the text was actually copied correctly by either using the 'edit' button, or pasting the text into a text editor. Expected result: The preview should display the copied text correctly.
I just tried to edit a clipboard content and added a \n. But that was shown correctly. I'm currently running Plasma 5.11 with Qt 5.9. So it might be fixed with newer releases.
Created attachment 108297 [details] Screenshot showing the copied text, preview, and edit area. I am still able to reproduce this issue with Qt 5.9.2, and Plasma 5.11. I have attached a better screenshot showing the issue.
Issue also visible on openSUSE Krypton (Qt 5.9.2 + Plasma master) I copied three full lines 123 456 789 from KWrite into the clipboard. Opening the Klipper from systray, I see: 12 45 789< (where < is the trailing newline arrow)
Can confirm that this still occurs on Fedora 28 with Plasma 5.13 / frameworks 18.04- essentially as described in the initial bug description.
The issue is the last regexp. It also matches a single character preceeding the newline character, as long as it isn't a '>' or newline character. I do not understand why it does it, but replacing the regexp with a simple text = text.replace(/(\r\n|\n\r|\r|\n)/g, "<br>") works. I tried a negative lookbehind /(?<![^>\r\n])(\r\n|\n\r|\r|\n)/g but this did not work. https://cgit.kde.org/plasma-workspace.git/tree/applets/clipboard/contents/ui/TextItemDelegate.qml#n49
I have just noticed this bug on neon unstable. Operating System: KDE neon Unstable Edition KDE Plasma Version: 5.21.80 KDE Frameworks Version: 5.83.0 Qt Version: 5.15.2 Graphics Platform: X11
*** Bug 450389 has been marked as a duplicate of this bug. ***