Bug 342874

Summary: Copying text from Okular to Klipper adds a newline
Product: [Applications] okular Reporter: Sudhir Khanger <sudhir>
Component: generalAssignee: Okular developers <okular-devel>
Status: RESOLVED FIXED    
Severity: minor CC: aacid, dweeble01103, jillelaine01, kde, nate
Priority: NOR    
Version: 0.20.3   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Problem screencast
Sample PDF
another example

Description Sudhir Khanger 2015-01-15 14:16:29 UTC
When I copy, let's say, a line from a PDF it also copies a newline which is copies over to clipboard/Klipper. I then have to delete this newline in whichever external application I copy the text. 

Reproducible: Always

Steps to Reproduce:
1. Copy a line from PDF in Okular
2.
3.

Actual Results:  
Copies a newline along with the text

Expected Results:  
Copy the text but not the newline
Comment 1 Sudhir Khanger 2015-01-15 14:17:26 UTC
Created attachment 90426 [details]
Problem screencast
Comment 2 Sudhir Khanger 2015-01-15 14:21:28 UTC
Created attachment 90427 [details]
Sample PDF

If you copy a line until its end, it will add a newline. If you copy a text which is in middle of other text it won't copy newline.
Comment 3 bill p. (aka google01103) 2015-01-15 17:34:08 UTC
as this is different then the usual way copy works in KDE I would agree that this is a bug (imo)
Comment 4 Sudhir Khanger 2015-01-20 07:24:56 UTC
Created attachment 90535 [details]
another example

As you can see even when you copy a single line it adds them as new line.
Comment 5 Jill Elaine 2015-01-24 00:55:03 UTC
Confirmed here. Same line in same pdf creates new line in Okular but not in evince Document Viewer.
Comment 6 Justin Zobel 2021-03-09 23:59:26 UTC
Thank you for the bug report.

As this report hasn't seen any changes in 5 years or more, we ask if you can please confirm that the issue still persists.

If this bug is no longer persisting or relevant please change the status to resolved.
Comment 7 Max Mehl 2021-08-30 11:29:04 UTC
(In reply to Justin Zobel from comment #6)
> As this report hasn't seen any changes in 5 years or more, we ask if you can
> please confirm that the issue still persists.

The problem still persists. It is an annoying behaviour that often disturbs me as well, e.g. when copying single-line passwords, invoice numbers or other strings from PDF files.
Comment 8 Bug Janitor Service 2021-09-07 22:39:20 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/okular/-/merge_requests/478
Comment 9 Albert Astals Cid 2021-09-09 19:26:36 UTC
Git commit 376925a10d3ec125ab09d7a7f8fdbcb58e788f09 by Albert Astals Cid.
Committed on 09/09/2021 at 17:33.
Pushed by aacid into branch 'release/21.08'.

Remove \n if it's the last char of the selected text

M  +3    -3    autotests/parttest.cpp
M  +4    -0    part/pageview.cpp

https://invent.kde.org/graphics/okular/commit/376925a10d3ec125ab09d7a7f8fdbcb58e788f09