D17949: ViewPrivate: Make applyWordWrap() more comfortable

Milian Wolff noreply at phabricator.kde.org
Tue Jan 15 14:03:01 GMT 2019


mwolff requested changes to this revision.
mwolff added a comment.
This revision now requires changes to proceed.


  I like what I'm seeing in the screenshot, but please add proper tests for this functionality

INLINE COMMENTS

> kateview.cpp:2355
> +    // Because we shrink and expand lines, we need a powerful "Moving Cursor"
> +    KTextEditor::MovingCursor *curr = doc()->newMovingCursor(KTextEditor::Cursor(selectionRange().start()));
> +

store in a std::unique_ptr and remove the manual `delete` further down below

> kateview.cpp:2359
> +    for (int line = first; line <= selectionRange().end().line(); ++line) {
> +        // Is our first line a somehow filled line?
> +        while(doc()->plainKateTextLine(first)->firstChar() < 0) {

bool shouldWrap = true;

> kateview.cpp:2366
> +            // C++ can only continue the inner loop, but we need here to continue our "for" loop
> +            goto NextLine;
> +        }

shouldWrap = false;
break;

> kateview.cpp:2370
> +        // Is our current line a somehow filled line? If not, wrap the paragraph
> +        if (doc()->plainKateTextLine(line)->firstChar() < 0) {
> +            curr->setPosition(line, 0); // Set on empty line

if (!shouldWrap) {
      continue;
  }

REPOSITORY
  R39 KTextEditor

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

To: loh.tar, #ktexteditor, mwolff
Cc: mwolff, kwrite-devel, kde-frameworks-devel, #ktexteditor, hase, michaelh, ngraham, bruns, demsking, cullmann, sars, dhaumann
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kwrite-devel/attachments/20190115/5e79ffc5/attachment.html>


More information about the KWrite-Devel mailing list