D19621: ViewPrivate: Make deselection by arrow keys more handy

Dominik Haumann noreply at phabricator.kde.org
Sat Mar 9 21:03:13 GMT 2019


dhaumann added a comment.


  The unit test is good, but it does not yet test the right-to-left case (e.g. arabic text). Could you add one for this as well?
  
  Maybe you can even use KateViewTest::testDeselectByArrowKeys_data() along with QFETCH to reuse the same code in the test function (see other usage of QFETCH).

INLINE COMMENTS

> kateview.cpp:2793
>      if (m_viewInternal->m_view->currentTextLine().isRightToLeft()) {
> -        m_viewInternal->cursorNextChar();
> +        if (selection() && !config()->persistentSelection()) {
> +            m_viewInternal->updateCursor(selectionRange().end());

Since we have this line twice, I suggest to move this after line 2791 as follows:

  const bool moveToEndOfSelection = selection() && !config()->persistentSelection();

Then, you can use a simple `if (moveToEndOfSelection) {...}` which is a bit more readable.

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

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


More information about the Kde-frameworks-devel mailing list