Avoid using trimmed method
ClosedPublic

Authored by mlaurent on Feb 1 2019, 7:52 AM.

Details

Summary

We don't want to use trimmed() but we want to avoid to call sonnet code for empty text

Diff Detail

Repository
R246 Sonnet
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
mlaurent created this revision.Feb 1 2019, 7:52 AM
Restricted Application added a project: Frameworks. · View Herald TranscriptFeb 1 2019, 7:52 AM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
mlaurent requested review of this revision.Feb 1 2019, 7:52 AM
dfaure accepted this revision.Feb 2 2019, 10:57 AM

A better name would be "hasOnlySpaces" (with the opposite return value), but OK.

This revision is now accepted and ready to land.Feb 2 2019, 10:57 AM
This revision was automatically updated to reflect the committed changes.
apol added a subscriber: apol.Feb 2 2019, 3:42 PM
apol added inline comments.
src/ui/highlighter.cpp
299

how about hasSpaces?

bruns added a subscriber: bruns.Feb 4 2019, 9:59 PM
bruns added inline comments.
src/ui/highlighter.cpp
311
if (std::all_of(text.cbegin(), text.cend(),
    [](QString::const_iterator it) { return it->isSpace(); })
{
    return;
}