• tapted's avatar
    MacViews: Merge single-character edits, map (and validate) undo and redo · 3d9bea97
    tapted authored
    Undo and redo are mapped in a similar way to cut/copy/paste on Mac, via
    the mainMenu's performKeyEquivalent, and the Cocoa responder chain.
    
    This CL adds responders for undo: and redo:
    
    Single-character editing commands were not being merged into a single
    edit. For example, typing {'c', 'a', 't', Cmd+Z} would only undo the 't'
    not the entire 'cat'. This CL fixes by detecting single-character
    inserts in response to a keyDown event.
    
    Then, for "redo", some of the textfield unittests would send both Ctrl+Y
    and Ctrl+Shift+Z. Cmd+Y for undo isn't supported on Mac (it's mapped to
    History -> Show Full History). So a wrapper is added that just sends
    Cmd+Shfit+Z again.
    
    Gets the following tests passing:
         TextfieldTest.DragAndDrop_ToTheLeft
         TextfieldTest.DragAndDrop_ToTheRight
         TextfieldTest.UndoRedoTest
    
    BUG=454353
    
    Review URL: https://codereview.chromium.org/923903002
    
    Cr-Commit-Position: refs/heads/master@{#316992}
    3d9bea97
textfield_unittest.cc 84 KB