D19123: Added option to search for whole words only

Albert Astals Cid noreply at phabricator.kde.org
Mon Apr 22 00:01:37 BST 2019


aacid added inline comments.

INLINE COMMENTS

> page.h:192
> +                                   const bool wholeWords) const;
> +        // To be merged with wholeWords = false, not forget to initialize lastRect with nullptr
> +        RegularAreaRect* findText( int id, const QString & text, SearchDirection direction,

Both functions need to have proper documentation. And the new one needs a since marker (same for all the other "public" functions) in core/*.h you added/changed

And the "to be merged" should be marked with a TODO so maybe we see it when we decided to break BC

> textpage.cpp:850
> +
> +bool TextPagePrivate::isWholeWord( const TextList::ConstIterator &start,
> +                                   const TextList::ConstIterator &end,

can this function be marked as const? seems like it could/should

> textpage.cpp:858
> +    // If I'm at the beginning/end of the text, I don't need to check after/before
> +    if( start == m_words.constBegin() && start_offset == 0) 
> +        part1 = true;

add {} if you're going to have an else with {}

> textpage.cpp:875
> +            const QString& str = curEntity->text();
> +            int len = stringLengthAdaptedWithHyphen( str, before, m_words.constEnd() );
> +            if( !str[len-1].isLetterOrNumber() ) part1 = true;

Make this const
Are we sure this is never going to be 0? I had a look at the strignLengthAdapatedWithHyphens and i'm not 100% sure :D

> textpage.cpp:887
> +
> +    int realEndStrSize = stringLengthAdaptedWithHyphen( endStr, after, m_words.constEnd() );
> +

const

> textpage.cpp:998
> +                            j = 0;
> +                            queryLeft=query.length();
> +                            it = it_begin;

spaces around =

> textpage.cpp:1000
> +                            it = it_begin;
> +                            offset = offset_begin+1;
> +                            it_begin = TextList::ConstIterator();

spaces around +

REPOSITORY
  R223 Okular

REVISION DETAIL
  https://phabricator.kde.org/D19123

To: joaonetto, #okular, aacid
Cc: davidhurka, yurchor, aacid, ngraham, okular-devel, joaonetto, tfella, darcyshen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/okular-devel/attachments/20190421/a98cf555/attachment.html>


More information about the Okular-devel mailing list