[KRichTextEdit] Make sure headings don't mess with undo stack

Authored by poboiko on Apr 18 2020, 10:53 PM.

Description

[KRichTextEdit] Make sure headings don't mess with undo stack

Summary:
This patch ensures that everything related to headings is undoable
with a single Ctrl+Z. It also adds tests for the following use cases
(ensuring those are undoable with a single undo command):

  1. Make line a heading
  2. Creating a newline after a heading
  3. Merging a heading and non-heading line with Delete key
  4. The same, with Backspace key

Test Plan: make && ctest

Reviewers: Frameworks, dfaure

Reviewed By: dfaure

Subscribers: kde-frameworks-devel

Tags: Frameworks

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