Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 403231 - app-text/mupdf-0.9 copy adds a newline character
Summary: app-text/mupdf-0.9 copy adds a newline character
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Michael Weber (RETIRED)
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2012-02-12 02:41 UTC by Horst Prote
Modified: 2012-03-18 10:35 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch to remove extra newline at end of copied text (mupdf-0.9-copy-adds-newline.patch,301 bytes, patch)
2012-02-12 22:28 UTC, Horst Prote
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Horst Prote 2012-02-12 02:41:41 UTC
The same problem as for evince (Bug 402071) and epdfview (Bug 403229):
Copy paste from a PDF document using epdfview 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 evince.
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.
Comment 1 Horst Prote 2012-02-12 22:28:37 UTC
Created attachment 301699 [details, diff]
Patch to remove extra newline at end of copied text

Here a patch that works for me.
Comment 2 Horst Prote 2012-02-12 22:30:32 UTC
Ahh, forgot to say that I did not test this on windows.
Comment 3 Michael Weber (RETIRED) gentoo-dev 2012-02-14 22:06:10 UTC
Can you please report this upstream? http://mupdf.com/

My suggested snipplet (w/o looking at the rest of the code).

+	// remove the last newline of the copied text
+#ifdef _WIN32
+	if (p >= 2 && ucsbuf[p-2]=='\r' && ucsbuf[p-1]=='\n')
+	{
+		ucsbuf[p-2] = 0;
+	}
+#else
+	if (p >= 1 && ucsbuf[p-1]=='\n')
+	{
+		ucsbuf[p-1] = 0;
+	}
+#endif
Comment 4 Horst Prote 2012-02-20 16:07:45 UTC
(In reply to comment #3)
> Can you please report this upstream? http://mupdf.com/

http://bugs.ghostscript.com/show_bug.cgi?id=692866
Comment 5 Horst Prote 2012-03-18 10:35:52 UTC
Upstream patched this in a git commit:
http://git.ghostscript.com/?p=mupdf.git;a=commit;h=22bbb6e6d3bcd01b164e91ecf500dc9d7305269e