GNOME Bugzilla – Bug 703024
Overlapping text selections hide each other
Last modified: 2013-06-27 13:06:37 UTC
Created attachment 247700 [details] PDF with closely spaced lines of text The attached PDF has closely spaced lines of text. When you use the mouse to select text, the overlapping selection regions cause evince to draw some weird stuff. This fixes itself when the page is redrawn, either by scrolling, zooming, or changing focus. I recently submitted and had accepted a patch to poppler to fix a similar issue - see poppler bug <https://bugs.freedesktop.org/show_bug.cgi?id=65989>. If you test this, you should use a recent poppler master. This might be the same as bug 649601. I'm not really sure because I couldn't reproduce something that looked like the example in that bug.
Created attachment 247701 [details] image of PDF rendered by evince If you select text with the mouse, moving slowly from the top left to the bottom right, you will get something like in the attached images where the selections hide each other.
Created attachment 247702 [details] [review] Invalidate union of old and new selection In ev-view.c, function merge_selection_region xor's the previous and current region to find what needs to be redrawn. So only a region that was selected and currently isn't, or is now selected and previously wasn't will be drawn. But this doesn't work with overlapping selections because anything that is currently selected may need to be redrawn. The easiest way I know to fix this is to change cairo_region_xor to cairo_region_union.
Review of attachment 247702 [details] [review]: Yes, I guess there's no other option. ::: libview/ev-view.c @@ +7240,2 @@ region = cairo_region_copy (old_sel->covered_region); + cairo_region_union (region, new_sel->covered_region); The new selection already contains the previous one, so I think it would be enough to use new_sel->covered_region
I actually meant old_sel->covered_region, but when they olverlap we indeed need the union.
Comment on attachment 247702 [details] [review] Invalidate union of old and new selection Ok, pushed to git master and added some more improvements in follow up patches. Thanks!