GNOME Bugzilla – Bug 672893
bogus selection after undoing and redoing a cut operation
Last modified: 2014-11-22 14:49:41 UTC
Original report: https://bugs.launchpad.net/ubuntu/+source/gedit/+bug/964620 DistroRelease: Ubuntu 11.10 Package: gedit 3.2.3-0ubuntu0.1 Steps to reproduce: - open gedit - write the text: abcdefghijklmnopqrstuvwxyz - select the portion from "e" to "i" included (5 characters) - cut it e.g. by using ctrl+x => no text is selected now (ok) - undo with ctrl+z => the un-cutted text is selected now (ok) - redo with ctrl+shift+z Expected: after re-doing, no character should be selected Observed: => after redoing, the characters "jklmn" are selected, which are the one that occupy the positions previously occupied by the selected text.
I can confirm this. It is even more apparent (and annoying) with large chunks of multi-line text. After re-doing with SHIFT + CTRL + Z text selection is offset and expanded to lines further down. This means the document sometimes can even scroll up/down based on the size of the chunk that is cut and also the change in background color makes it much harder to determine what text was changes with the re-do operation.
This is a bug in gtksourceview undo manager. The bug can be reproduced with gtksourceview's test-widget program
Created attachment 274290 [details] [review] Fix selection on redo This fixes the selection on redo by storing the to-redo selection (i.e. current selection) on undo and vice versa. This keeps the selection state consistent with the selection whenever an undo/redo happens (since an undo can only be redone and vice versa)
Created attachment 274291 [details] [review] Fix selection on redo This fixes the selection on redo by storing the to-redo selection (i.e. current selection) on undo and vice versa. This keeps the selection state consistent with the selection whenever an undo/redo happens (since an undo can only be redone and vice versa)
Created attachment 274292 [details] [review] Fix selection on redo This fixes the selection on redo by storing the to-redo selection (i.e. current selection) on undo and vice versa. This keeps the selection state consistent with the selection whenever an undo/redo happens (since an undo can only be redone and vice versa)
Created attachment 274294 [details] [review] Fix selection on redo This fixes the selection on redo by storing the to-redo selection (i.e. current selection) on undo and vice versa. This keeps the selection state consistent with the selection whenever an undo/redo happens (since an undo can only be redone and vice versa)
Created attachment 274295 [details] [review] Fix selection on redo This fixes the selection on redo by storing the to-redo selection (i.e. current selection) on undo and vice versa. This keeps the selection state consistent with the selection whenever an undo/redo happens (since an undo can only be redone and vice versa)
Attachment 274295 [details] pushed as ee95815 - Fix selection on redo
For the record, there was a regression with this bug. - select some text and delete it - undo -> the selection is restored, ok - click somewhere else or select some text somewhere else - redo - undo -> the selection is not restored correctly, the "somewhere else" is restored instead, which can be far away from the deleted text. It's fixed in: https://git.gnome.org/browse/gtksourceview/commit/?id=0c634b42dcc5c773b24fd8437400c82dcf41193a (there has been a rewrite of the UndoManager in the meantime)