adobe/brackets — pull request #2190 by njx (2012-11-21 23:22:36+00:00)
Title: Add one-step undo/redo to color editor

For #2183, make it so you can do a one-step undo/redo in the color editor. Hitting Undo will revert back to the original color when the editor was first opened. Hitting Redo will switch to the color you had when you hit Undo. Making an edit after undoing kills redo.

Some caveats:
* This is hardcoded to Ctrl/Cmd-Z for undo and Ctrl/Cmd-Shift-Z and Ctrl/Cmd-Y for redo. Eventually, we need a more general way to do contextual keybindings for pieces of UI like this (where it doesn't make sense to create an app-global command).
* It might have been a little better to just pass undos/redos through to CodeMirror, but in our current inline editor implementation those undos actually cause the editor to collapse, since they destroy the underlying bookmark that tracks the position of the editor. This could be a viable option in v3, but changes to the way undos are batched there will probably mean that we'd need to request an API for control over undo batching across separate real edits.
* Eventually, we should have a more sophisticated multi-step undo system for inline editors like this that tries to be smart about when we record undos and integrates properly with the CodeMirror undo system.