D23674: Use QString::count(QChar)+1 over QString::splitRef().length()

Aleix Pol Gonzalez noreply at phabricator.kde.org
Mon Sep 2 14:10:24 BST 2019


apol added inline comments.

INLINE COMMENTS

> normalvimode.cpp:3848
>      } else {
> -        cAfter.setColumn(textLines.last().length() - 0);
> -        cAfter.setLine(cAfter.line() + textLines.length() - 1);
> +        const int lastLineLength = pastedText.size() - pastedText.lastIndexOf(QLatin1Char('\n')) + 1;
> +        cAfter.setColumn(lastLineLength);

oh I see, how about just using splitRef? This way we don't have to allocate all the strings but the code still is more readable.

REPOSITORY
  R39 KTextEditor

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

To: kossebau, #kate
Cc: apol, kwrite-devel, kde-frameworks-devel, LeGast00n, GB_2, domson, michaelh, ngraham, bruns, demsking, cullmann, sars, dhaumann
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kwrite-devel/attachments/20190902/0fff0a6e/attachment-0001.html>


More information about the KWrite-Devel mailing list