GNOME Bugzilla – Bug 790308
Add client-level command stack
Last modified: 2019-11-07 01:09:14 UTC
To support both decent undo/redo support (Bug 714233) and to provide a means of keeping track of command completion for in-app notifications (Bug 774442), we should introduce a client-side notion of a Command and a CommandStack. A Command would represent a specific end-user action like Archive, Move, Send or Trash, and there would be one subclass or interface implementation for each possible action. The command encapsulates all application state needed to execute the command (target account, folders, applicable conversations/messages) and provide methods that implement execute, undo and redo as needed for each, by making the appropriate calls to the engine's API. It would also hook into accounts/folders to receive notification of command completion or error, and notify the user of such. CommandStack is obviously a stack for Command instances that asynchronously executes the command when one is pushed on, uses a cursor to keep track of the current undo/redo point, and executes a Command's undo and redo methods as needed. Each MainWindow instance probably wants to have its own CommandStack, so Undo/Redo operations in the one window make sense. This is a pretty bog-standard notion of commands and a stack, so if there are resuable libraries out that there that support of the above we could look into it, but it's probably simple enough to roll our own — what could possibly go wrong?
An undo action which I often miss is when you accidentally hit Backspace to delete some quoted text, which instead results in removing the whole quoted text altogether. You cannot undo this action, so you have to delete the draft and reply again (and be careful to use Canc instead as first key to delete text).
Implementation note: This might want to be integrated somehow into Geary.App.EmailStore's existing operations (or vice-versa), especially if we want to provide some client-agnostic means of implementing such a stack based on the engine.
This will be fixed in 3.36 courtesy https://gitlab.gnome.org/GNOME/geary/merge_requests/359