https://bugs.kde.org/show_bug.cgi?id=323262

            Bug ID: 323262
           Summary: "Find previous" fails at end of line
    Classification: Unclassified
           Product: okular
           Version: 0.17.60
          Platform: unspecified
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: okular-devel@kde.org
          Reporter: jaanvaja...@hot.ee

When clicking the "Previous" button and the search string is at the end of the
line, the search fails. Debugging shows that this is because in the function
TextPagePrivate::findTextInternalBackward in textpage.cpp the line

  if ( !comparer( str.midRef(offset, min ), query.midRef( j - min + 1, min ),
                            &resStrLen, &resQueryLen ) )

is buggy: e. g. if line in a  PDF file consists of letters "abc" and the search
string is also "abc", then str (the text for the last entity of the line) is
"c\n", offset=0, min=2, j=2, so the code cited above compares "c\n" to "bc" and
finds no match.

The similar line in findTextInternalForward is also buggy if it is possible for
entities to have multi-character texts of other forms than <single character> +
<newline>, but I don't know if that can happen.


Reproducible: Always

Steps to Reproduce:
1. Open the attached file lineEnd.pdf.
2. Press F3 and type "abc". Okular highlights the first "abc".
3. Click Next. Okular highlights the next "abc".
4. Click Previous.
Actual Results:  
Okular finds no match (the search box takes a reddish color).

Expected Results:  
Okular should highlight the first "abc".

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Okular-devel mailing list
Okular-devel@kde.org
https://mail.kde.org/mailman/listinfo/okular-devel

Reply via email to