Undo/Redo in commands with text and translations must consider if the translation was reloaded
Commands that only affect translation are cleared if the translation is unloaded.
However, commands affecting text and translation need to take into account that:
- A translation may not be present when the command is executed, but may have been loaded (Translation > Open) afterwards. When undoing, that translation needs to be taken into account. Example: Subtitles (with text only) were split. Then translation was opened (which does not generate undo/redo because it's a file open). Undoing the split command will revert the original text (which means the subtitles that were split will now be merged). In this case, the translation needs to be merged for those subtitles, and not just set to their previous values (because there were none). Additionally, Redo should always apply the Split command again in order to do a new split that takes into account the existing translation text.
- A translation may be present when the command is executed, but may have been changed / loaded with a new file afterwards. This means a ClearTarget event will be triggered in order to clear the translation data inside this command. However, this needs to be taken into account later when Undoing / Redoing.
This issue fixes the following commands in respect to what was mentioned above:
- SplitSubtitlesCommand
- MergeSubtitlesCommand
- DeleteSubtitlesCommand
- ReplaceAllCommand
Edited by Pedro Castro