Bug 692866

Summary: mupdf-0.9 copy adds a newline character
Product: MuPDF Reporter: Horst Prote <prote>
Component: appsAssignee: MuPDF bugs <mupdf-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: robin.watts, tor.andersson
Priority: P4    
Version: unspecified   
Hardware: PC   
OS: Linux   
URL: http://bugs.gentoo.org/show_bug.cgi?id=403231
Customer: Word Size: ---

Description Horst Prote 2012-02-20 16:07:12 UTC
Copy paste from a PDF document using mupdf results in the addition of a
newline character to the end of the pasted text. This is possibly seen as a
convenient feature, but in reality more often than not results in the need to
delete the new line.

Reproducible: Always

Steps to Reproduce:
1. Open a PDF in mupdf.
2. Select some word.
3. Paste it somwhere
Actual Results:  
The pasted text is altered with the addition of a new line.

Expected Results:  
Copying and pasting text from a PDF document should result in the text selected
from the PDF being included in the new location without alteration.

Patch suggestion: See http://bugs.gentoo.org/show_bug.cgi?id=403231#c3
Comment 1 Robin Watts 2012-03-15 17:31:35 UTC
Fixed in:


commit 22bbb6e6d3bcd01b164e91ecf500dc9d7305269e
Author: Robin Watts <Robin.Watts@artifex.com>
Date:   Thu Mar 15 17:26:58 2012 +0000

    Bug 692866: Do not add a final newline when cutting/pasting.
    
    Previously MuPDF would add a newline at the end of every line.
    As requested in the bug, we here avoid adding a final newline.
    
    Unlike the suggested patch, we avoid adding one, rather than
    removing one.

Thanks!
Comment 2 Horst Prote 2012-03-18 10:32:34 UTC
(In reply to comment #1)
> commit 22bbb6e6d3bcd01b164e91ecf500dc9d7305269e
This is linked to project ghostpdl.git. Shouldn't it be to
http://git.ghostscript.com/?p=mupdf.git;a=commit;h=22bbb6e6d3bcd01b164e91ecf500dc9d7305269e ?
Comment 3 Robin Watts 2012-03-18 12:32:31 UTC
(In reply to comment #2)
> (In reply to comment #1)
> > commit 22bbb6e6d3bcd01b164e91ecf500dc9d7305269e
> This is linked to project ghostpdl.git. Shouldn't it be to
> http://git.ghostscript.com/?p=mupdf.git;a=commit;h=22bbb6e6d3bcd01b164e91ecf500dc9d7305269e
> ?

It should be. Sadly the hack I put into bugzilla to turn commit hashes into URLs is incapable of selecting by project, so they all point to ghostpdl.git. But the commit hash is indeed a MuPDF one.
Comment 4 Horst Prote 2012-05-29 12:31:30 UTC
Today I installed gentoo's mupdf-1.0 which includes your patch but I still get the extra newline at the end of a pasted text.
Comment 5 Horst Prote 2012-07-03 14:55:28 UTC
Today I made some more tests and found that
- with some PDF it works when I copy part of a headline but not in paragraphs
- with most PDFs it never works i.e. it always adds a newline
Comment 6 Horst Prote 2012-08-20 13:12:51 UTC
Bump?
Comment 7 Tor Andersson 2014-04-23 07:40:52 UTC
Fixed in commit d11b67fc8140105e1659e89b6aeec61fd5ccbf37
Author: Tor Andersson <tor.andersson@artifex.com>
Date:   Thu Apr 17 17:11:45 2014 +0200

    Fix 692866: improved handling of newlines when copying text.
    
    Only add newlines between selected lines of text.