[NestedListHelper] Improve indentation code

Authored by poboiko on Apr 26 2020, 4:01 PM.

Description

[NestedListHelper] Improve indentation code

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)

  1. 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)

Reviewers: Frameworks, dfaure, mlaurent

Reviewed By: dfaure

Subscribers: kde-frameworks-devel

Tags: Frameworks

Differential Revision: https://phabricator.kde.org/D29208

Details

Committed
poboikoMay 2 2020, 2:01 PM
Reviewer
dfaure
Differential Revision
D29208: [NestedListHelper] Improve indentation code
Parents
R310:b5a59438a2b5: API dox: document Q_DECLARE_FLAGS-based flags
Branches
Unknown
Tags
Unknown