Issue 120498 - Enhance user experience for editing text in draw shapes and/or tables when using undo/redo
Summary: Enhance user experience for editing text in draw shapes and/or tables when us...
Alias: None
Product: Draw
Classification: Application
Component: editing (show other issues)
Version: 4.0.0-dev
Hardware: All All
: P3 Normal (vote)
Target Milestone: 4.0.0
Assignee: Armin Le Grand
QA Contact:
Depends on:
Reported: 2012-08-08 11:53 UTC by Armin Le Grand
Modified: 2017-05-20 10:35 UTC (History)
2 users (show)

See Also:
Latest Confirmation in: ---
Developer Difficulty: ---


Note You need to log in before you can comment on or make changes to this issue.
Description Armin Le Grand 2012-08-08 11:53:23 UTC
ALG: We have some inconsistencies in Undo/Redo usages when editing text.

(a) For draw shapes:

After starting edit mode (by clicking or by selecting shape and start typing) Undo/Redo only covers text edit actions, the previous actions are no more shown in the undo control and/or it's dropdown list. It would be nice to be able to use undo without having to know that you are in edit mode. Most users do not understand that they need to exit this mode first to get their undos back. They end up in pressing undo in edit mode, all edit undos are done and nothing happens, they are stuck.
There is also the error for new shapes that two additional undo actions (apply styles/apply attributes) are created which are part of EditEngine/Outliner setup, but not of text edit; it leads to unwanted effects when undoing these. This does not happen with shapes which already have text.

(b) For tables:
Same as (a), but even worse when tabbing through the fields; only the currently edited field can be changed using Undo/Redo (e.g. type in 1st field, tab, type in 2nd, use undo: no more chance to undo changes in first field). Using Undo should step back over the fields and on the last change even step back to the non-edit undos.

Also nice to have: when ending text edit (whatever way) if there is user info in the current edit redo stack, save it and offer as redo action (not showing it, but keeping user input as valuable data). Users nowadays do not understand that data is applied to objects when explicitly ending edit modes (see edit fields in modern apps, no need to leave the current one).
Comment 1 Armin Le Grand 2012-08-08 11:57:14 UTC
ALG: Taking over. Base reason for this behaviour is that a new UndoManager is used by the EditEngine/Outliner for text edit, not the existing one from the document (which hold all the other undos and will get the text edit undo action when ending text edit. I will try to use the regular document undo manager for text edit, too. This will require to derive it from EditUndoManager, not from SfxUndoManager, to allow to set an own UndoManager in Outliner/EditEngine and other stuff. Also needed is a mechanism to detect that the edit undo actions are all undo(ne) and edit mode has to be left with the next triggered Undo and the last non-edit undo has to be triggered instead.
Comment 2 Armin Le Grand 2012-08-08 11:58:11 UTC
ALG: Changed to enhancement
Comment 3 Armin Le Grand 2012-08-09 08:51:41 UTC
ALG: Undo is patched stuff, hard to control. Have found a solution now which:
- adds an SdrUndoManager to svx to allow later sw and sc to use it, too
- SdrUndoManager derived from EditUndoManager, added Undo/Redo methods, added method to start/end text edit, added callback to signal that text edit shall be ended
- sd's UndoManager derived from SdrUndoManager to support new mechanism
- activate/deactivate text edit mode in SdrUndoManager on SdrBegin/EndTextEdit accordingly, if the given UndoManager is a SdrUndoManager, do needed corrections in SdrEndTextEdit
- many adaptions to handle this smoothly (some caveats with redo stack, etc where the standard SfxUndoManager is not too good with)
Comment 4 Armin Le Grand 2012-08-09 09:03:53 UTC
Behaviour for (a) is now:
- when starting text edit, the undo stack ui shows all undo actions (before, all previous seemed to be gone), text edit actions are added as expected
- when using Undo in text edit mode, text edits are undone as before. When all are undone, text edit mode is left smoothly and the next action of the undo stack is triggered; this is what users intuitively expect
- when there were redos left for text edit actions when text edit is ended, an extra undo action is created containing these and put on the redo stack. The principle is to never throw away user input when possible. A user using redo will get back his last changes as long as he has not done something else in between.

Behaviour for (b) is now:
- same as for (a) except that edit change is triggered when changing active cell, user can smoothly edit table as intuitively expected and Undo will undo the single cell edits (not the single char edits in each cell, these will be bundled when leaving edit mode, as before)
- as in (a), last edits in redo will be preserved

All in all: Users can now intuitively mix text edit and other actions and do not need to be aware that leaving edit mode is an active action. Undo works smoothly and intuitively, no longer blocking in an activated edit.

Example: New draw (or impress), insert table, edit fields as wanted. Without clicking or ESC for leaving edit mode, all actions can be undone, including inserting the table. All can then be redone, no already entered text is lost.
Comment 5 Armin Le Grand 2012-08-09 09:11:36 UTC
ALG: Invested some time to also do this for sw and sc, but found out that unfortunately each app is baking it's own version of undo handling. Lots of cleanups will be needed doing this, too dangerous to mix with this enhancement, so opening a new task for it.
Done, added #120515#.
Som emore tests/checks, removing started changes for sw/sc again.
Comment 6 SVN Robot 2012-08-09 09:42:51 UTC
"alg" committed SVN revision 1371123 into trunk:
#120498# Enhanced Undo/Redo and user experience when editing texts in graphic...
Comment 7 Armin Le Grand 2012-08-09 09:48:38 UTC
ALG: Works well, no drawbacks found (also checked with undo depth == 1). Checked in initial version, looking forward for people trying it out and comments/suggestions.
Comment 8 Armin Le Grand 2012-08-10 14:18:41 UTC
ALG: One drawback found, problems with one case: New object, enter text edit, add two words )two undo actions). Undo the first one, end text edit (esc or click). All text is removed, redo action for text with deleted part is created.
This is not acceptable, the mechanism for creating redo actions for deleted text can only be applied when the text edit end was triggered from the last text change undo; this will keep the enhancement. I see currently no possibility to 'split' the text undo actions to create another grouped redo from a partial undone text edit.
Adapted mechanisms, also simplified and added some basic support mechanism to use it with low danger for other apps (preps for #120515#).
Committing changes for svx.
Comment 9 SVN Robot 2012-08-10 14:19:26 UTC
"alg" committed SVN revision 1371711 into trunk:
#120498# fixed error with half text edit undone, extended as preparation for ...
Comment 10 Shenfeng Liu 2012-10-10 07:15:49 UTC
set Target Milestone to AOO 3.5.0 for PM purpose.
Comment 11 Andre 2014-02-13 13:48:45 UTC
See bug 123468 for a possible regression.