GNOME Bugzilla – Bug 588098
Undo/Redo breaks with bulleted lists
Last modified: 2011-02-13 16:52:04 UTC
Please describe the problem: Undo/Redo breaks with bulleted lists. Steps to reproduce: 1. it should be so easy that I don't need to attach anything 2. Enable bulleted lists 3. Create simple list in two lines or more, for example * Do work * Read wikipedia 4. Now make a multi-line selection in the list, copy, insert anywhere, so that you in have a duplicate of the list 5. Now use Undo twice, Redo twice, repeat in cycles one or two or three or more, see that nothing makes sense. Undo enough until gnote crashes. Actual results: Some iterator or something points wrong, because Undo doesn't undo what was done. Expected results: Does this happen every time? yes Other information: gnote version is debian 0.5.2-1
Created attachment 172372 [details] [review] Fix redo with new bulletted row. This patch solves part of the problem - redo starts to work for enter key in bulleted row. Multi-line paste is still an issue (looks like the same issue exists in Tomboy).
Comment on attachment 172372 [details] [review] Fix redo with new bulletted row. nice catch. looks good.
Review of attachment 172372 [details] [review]: Committed.
The problem with multi-line paste still remains, so I leave this bug open. I found this: 1. Multi-line paste is split to pieces, so many small text inserts happen. 2. New line is pasted as separate text insert. 3. Bullet is pasted as text entry. 4. The (2) and (3) become separate undo actions. Doing redo a depth tag is lost and bulletted item becomes simple text. My suggestion would be to improve bullet insertion undo action to have a flag, whether to insert new line. The during paste, a bullet insertion can be identified and appropriate undo action can be added. Also, when adding new bullet insert action without new line, it could be merged with preceding new line insertion.
Corresponding Tomboy Bug 632828.
Created attachment 173135 [details] [review] Add is_bullet method to NoteBuffer. Used by next patch and might be useful for something else.
Created attachment 173136 [details] [review] Patch to fix the bug. Not perfect solution, but at least seems to work right. 1. Emit "increase depth" signal instead of "insert text", when bullet is pasted. 2. For text paste, emit appropriate number of "increase depth" signals. There probably are bugs in this patch, so any help is appreciated.
Created attachment 179322 [details] [review] Add is_bullet method to NoteBuffer. Fixed error in patch.
Created attachment 180112 [details] [review] Fix for the bug. Updated the patch. Some code refactoring, to make it more readable.
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.