After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 703024 - Overlapping text selections hide each other
Overlapping text selections hide each other
Status: RESOLVED FIXED
Product: evince
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Evince Maintainers
Evince Maintainers
Depends on:
Blocks:
 
 
Reported: 2013-06-25 04:45 UTC by Jason Crain
Modified: 2013-06-27 13:06 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
PDF with closely spaced lines of text (888 bytes, application/pdf)
2013-06-25 04:45 UTC, Jason Crain
  Details
image of PDF rendered by evince (17.44 KB, image/png)
2013-06-25 04:47 UTC, Jason Crain
  Details
Invalidate union of old and new selection (1.55 KB, patch)
2013-06-25 04:49 UTC, Jason Crain
committed Details | Review

Description Jason Crain 2013-06-25 04:45:56 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.
Comment 1 Jason Crain 2013-06-25 04:47:42 UTC
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.
Comment 2 Jason Crain 2013-06-25 04:49:31 UTC
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.
Comment 3 Carlos Garcia Campos 2013-06-26 17:50:59 UTC
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
Comment 4 Carlos Garcia Campos 2013-06-26 19:19:21 UTC
I actually meant old_sel->covered_region, but when they olverlap we indeed need the union.
Comment 5 Carlos Garcia Campos 2013-06-27 13:06:24 UTC
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!