Bug 699079

Summary: Text selection uses wrong region (regression in 1.12) and immediately deselects (in master)
Product: MuPDF Reporter: scr2
Component: appsAssignee: MuPDF bugs <mupdf-bugs>
Status: RESOLVED FIXED    
Severity: major CC: tor.andersson
Priority: P4    
Version: 1.12.0   
Hardware: PC   
OS: Linux   
Customer: Word Size: ---

Description scr2 2018-02-27 19:37:56 UTC
Selecting text to copy to the X primary selection works as expected in 1.11 (as packaged by Arch Linux) but not 1.12. Within mupdf itself the behavior seems identical (selection region grows as expected) but no text is pasted when middle-clicking in other applications. Trying to copy with Ctrl+C and paste from the clipboard into other applications also seems broken in 1.12. I don't see any errors printed in the terminal from which I run mupdf. This behavior is shared by programs like zathura which embed mupdf.

After more investigation, it seems that the problem is actually that selection of text anywhere but the top-left of pages does not work, and selections act as if operating on a small version of the page aligned with the visible page's top-left corner. Selection does work if blindly performed in the top-left of a page, guessing which actual region of the page might correspond.

On master, text selection behavior seems different (the selection grabs individual lines rather than tracing out a rectangular region) but I seem unable to paste (via primary selection or via Ctrl+C and clipboard), and the selection is immediately cleared when I release the right mouse button. I'm not sure if the problem on master is related or not to the regression in 0.12.

Thanks!
Comment 1 Tor Andersson 2018-02-28 02:15:41 UTC
There are two separate viewers on linux: mupdf-x11 and mupdf-gl.

It appears that mupdf-x11 has a bug where what is highlighted isn't what is copied.

Selecting by lines is specific to mupdf-gl. This viewer only sets the clipboard at the moment, so ^V should paste the content, rather than middle-click. I think this is an oversight, we should also be setting the primary selection on X11.

However, since you mention not being able to copy the selection at all, you should be aware that you MUST build with OUR copy of FreeGLUT. The standard system FreeGLUT does NOT have copy & paste support. We have added clipboard support to our fork of FreeGLUT. I have tried to get our additions adopted upstream, but the maintainers are slow to respond, so please use our version of freeglut when building mupdf.
Comment 2 Tor Andersson 2018-03-07 03:50:30 UTC
Fixed in commit 4614c7472c7eb43bde8ffbbcf37e207e4c83a143
Author: Tor Andersson <tor.andersson@artifex.com>
Date:   Wed Mar 7 12:18:26 2018 +0100

    Fix 699081: Missing coordinate transformation when copying text.