D29208: [NestedListHelper] Improve indentation code

Igor Poboiko noreply at phabricator.kde.org
Sun Apr 26 17:10:12 BST 2020


poboiko created this revision.
poboiko added reviewers: Frameworks, dfaure, mlaurent.
Herald added a project: Frameworks.
poboiko requested review of this revision.

REVISION SUMMARY
  The patch includes following improvements:
  
  1. `handleAfterKeyPressEvent` was only used to adjust margins. We don't do it anymore, so get rid of it.
  2. Add support for Tab key to increase indentation level (either at the beginning of a list item or with multiple lines selected)
  3. Fix `canIndent / canDedent` logic when cursor has a selection. `canIndent` should work with `topOfSelection`, and `canDedent` --- with `bottomOfSelection`.
  4. Enclose `handleOnIndentMore / Less` in `beginEditBlock / endEditBlock`, so they appear as a single event in Undo stack.
  5. A Return on an empty list element decreases the indentation (so double-Return terminates the list)

TEST PLAN
  1. Tab / Return keys now work as explained
  2. IndentMore / Less are undoable with single `Ctrl+Z`
  
  (this leads to cursor jumping around, which is probably beyond the scope of this patch)
  
  3. Increase / Decrease Indent actions now become enabled when they should if the selection is present
  
  (the behavior of `handleOnIndentMore / Less` when selection is present is slightly broken, which is also beyond the scope)

REPOSITORY
  R310 KTextWidgets

BRANCH
  unused (branched from master)

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

AFFECTED FILES
  src/widgets/krichtextedit.cpp
  src/widgets/nestedlisthelper.cpp
  src/widgets/nestedlisthelper_p.h

To: poboiko, #frameworks, dfaure, mlaurent
Cc: kde-frameworks-devel, LeGast00n, cblack, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20200426/b567de91/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list