Bug 256001 - Undo in lists is broken
Summary: Undo in lists is broken
Status: RESOLVED FIXED
Alias: None
Product: frameworks-ktextwidgets
Classification: Frameworks and Libraries
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Unlisted Binaries Linux
: NOR normal
Target Milestone: ---
Assignee: Stephen Kelly
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-03 23:25 UTC by Anders Lund
Modified: 2020-04-14 22:38 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Anders Lund 2010-11-03 23:25:03 UTC
Version:           0.4
OS:                Linux

Undoing changes to lists that involves creating or deleting list items works very bad.

Create a list

1. something
2. more
3. last
4. point

Then delete item 2. then undo, and you'd espect point 2. to come back, but you have to undo several times for that to happen.

Seems like internal changes are registered, which should be grouped into a sligle undo step.

Reproducible: Always

Steps to Reproduce:
see above



OS: Linux (i686) release 2.6.35-ARCH
Compiler: gcc
Comment 1 Christoph Feck 2010-11-19 17:59:27 UTC
Bug is in KRichTextEdit. Either that class, or the NestedListHelper should use beginEditBlock/endEditBlock calls.
Comment 2 Igor Poboiko 2020-04-14 22:38:22 UTC
Git commit 1d1eb6feb7f85d5e09e00f75114f671eceff1598 by Igor Poboiko.
Committed on 14/04/2020 at 22:38.
Pushed by poboiko into branch 'master'.

[KRichTextEdit] Always treat key press as single modification in undo stack

Summary:
If my cursor is on a bullet list, and I press Enter to create a new element,
it registers as 5-7 actions in an undo stack, mostly margins adjustments. So to
rewind it, user has to press `Ctrl+Z` 5+ times, which is quite frustrating.

Instead this patch suggests to treat _any_ change that is a result of a single
key press as a single event, so user has to press `Ctrl+Z` just once to undo it

Test Plan:
 1) Open KMail -> New Mail, enable Rich Text mode (or, say, open KJots)
 2) Create a bullet list with couple of elements
 3) Put cursor on the last element, press Enter to create a new element
 4) Try to undo this action with Ctrl+Z
 5) (without patch) One has to press Ctrl+Z 5-7 times to undo it.
 6) (with patch) A single Ctrl+Z is enough

Reviewers: #frameworks, mlaurent, dfaure

Reviewed By: dfaure

Subscribers: ahmadsamir, kde-frameworks-devel

Tags: #frameworks

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

M  +2    -0    src/widgets/krichtextedit.cpp

https://commits.kde.org/ktextwidgets/1d1eb6feb7f85d5e09e00f75114f671eceff1598