Many undoable actions when changing the text of a title clip
@aleb
Submitted by Alex Băluț
Description
Type to edit the text of a title clip, notice for each letter you type an UndoableAction is created.
This happens because each time the text field is changed, a "changed" signal is emitted which is handled by _textChangedCb
in titleeditor.py, which calls self._setChildProperty("text", text)
, which adds a new operation to the undoable-action-log.
An operation is something which can be un-done or re-done. It is composed of actions which record various changes, for example when moving a clip from one layer to another at a different position, this operation would be the change of the clip position and the change of the original layer (clip removal), and the change of the new layer (clip addition).
We already have a mechanism for squashing "actions", it can be seen in TestPropertyChangedAction.test_expand
in test_undo.py.
A new mechanism should be created which allows squashing operations. For example UndoableActionLog.begin()
could have a new optional parameter: squash=False
, and when it's set to True
and the name of the operation is the same as the previous one, the last operation is reactivated to be edited.
Your work should start by adding a unittest.
While at it, as a preparatory commit, rename "action group" and "transaction" to "operation" in the undo*.py
files and the corresponding test_undo*.py
files.