Bug 385329 - Klipper preview does not display character before newline.
Summary: Klipper preview does not display character before newline.
Status: CONFIRMED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Clipboard (show other bugs)
Version: 5.15.3
Platform: Arch Linux Linux
: NOR minor
Target Milestone: 1.0
Assignee: Martin Flöser
URL:
Keywords:
: 450389 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-10-03 15:00 UTC by Kishore Gopalakrishnan
Modified: 2022-02-16 19:28 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Screenshot showing the preview (14.99 KB, image/png)
2017-10-03 15:00 UTC, Kishore Gopalakrishnan
Details
Screenshot showing the copied text, preview, and edit area. (84.50 KB, image/png)
2017-10-12 09:07 UTC, Kishore Gopalakrishnan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kishore Gopalakrishnan 2017-10-03 15:00:41 UTC
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.
Comment 1 Martin Flöser 2017-10-08 14:12:22 UTC
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.
Comment 2 Kishore Gopalakrishnan 2017-10-12 09:07:04 UTC
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.
Comment 3 Christoph Feck 2017-10-13 20:34:44 UTC
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)
Comment 4 austin 2018-08-30 21:34:17 UTC
Can confirm that this still occurs on Fedora 28 with Plasma 5.13 / frameworks 18.04- essentially as described in the initial bug description.
Comment 5 Christoph Feck 2018-09-13 17:56:42 UTC
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
Comment 6 Patrick Silva 2021-05-11 21:37:13 UTC
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
Comment 7 Patrick Silva 2022-02-16 19:27:21 UTC
*** Bug 450389 has been marked as a duplicate of this bug. ***