[poppler] [PATCH] Poppler: Fix line selection, dont check y for Line selection

Sam Liao phyomh at gmail.com
Mon Jan 17 01:28:23 PST 2011


Hi,

I encountered this problem in evince when selecting text, and there
always some blank lines with blue color(selected), quite easy to
reproduce
when select from down to up.  This error shows up for years since I
use evince and not fixed yet. So I tried to fix it and found it seems
to be a
problem of poppler.

This problem can be reproduce with poppler's glib demo, in the
selection part, when select a line, move up/down the mouse, you will
found the line
is render as selected while the text is hidden.  Attached the images.

I'm not sure if this is the best way to fix it, anyway it works. As
for the code, when I line is selected, I think it also means the words
in the x rangs also
be selected and that won't lead to rendering confliction.

Thanks,
-Sam

On Mon, Jan 17, 2011 at 5:26 PM, Sam Liao <phyomh at gmail.com> wrote:
> When a line is selected while the Y values of selection is
> not in the y range of words, the render will render the
> line with reverse color while the words does not show up.
>
> This fix neglect the Y vaules to make sure that the words
> also displayed when line is selected.
> ---
> poppler/TextOutputDev.cc |   16 ++++++++--------
> 1 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/poppler/TextOutputDev.cc b/poppler/TextOutputDev.cc
> index 576bcc9..71b946e 100644
> --- a/poppler/TextOutputDev.cc
> +++ b/poppler/TextOutputDev.cc
> @@ -4249,24 +4249,24 @@ void
> TextLine::visitSelection(TextSelectionVisitor *visitor,
>   current = NULL;
>   for (p = words; p != NULL; p = p->next) {
>     if (blk->page->primaryLR) {
> -      if ((selection->x1 < p->xMax && selection->y1 < p->yMax) ||
> -  (selection->x2 < p->xMax && selection->y2 < p->yMax))
> +      if ((selection->x1 < p->xMax) ||
> +  (selection->x2 < p->xMax))
>         if (begin == NULL)
>  begin = p;
>
> -      if (((selection->x1 > p->xMin && selection->y1 > p->yMin) ||
> -   (selection->x2 > p->xMin && selection->y2 > p->yMin)) && (begin != NULL)) {
> +      if (((selection->x1 > p->xMin) ||
> +   (selection->x2 > p->xMin)) && (begin != NULL)) {
>         end = p->next;
>         current = p;
>       }
>     } else {
> -      if ((selection->x1 > p->xMin && selection->y1 < p->yMax) ||
> -  (selection->x2 > p->xMin && selection->y2 < p->yMax))
> +      if ((selection->x1 > p->xMin) ||
> +  (selection->x2 > p->xMin))
>         if (begin == NULL)
>  begin = p;
>
> -      if (((selection->x1 < p->xMax && selection->y1 > p->yMin) ||
> -   (selection->x2 < p->xMax && selection->y2 > p->yMin)) && (begin != NULL)) {
> +      if (((selection->x1 < p->xMax) ||
> +   (selection->x2 < p->xMax)) && (begin != NULL)) {
>         end = p->next;
>         current = p;
>       }
> --
> 1.7.1
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 1.png
Type: image/png
Size: 31984 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/poppler/attachments/20110117/52941f1d/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2.png
Type: image/png
Size: 30165 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/poppler/attachments/20110117/52941f1d/attachment-0003.png>


More information about the poppler mailing list