Handle standard Cmd-{Y,Z} key combinations in Mac wxTextCtrl

Use them to undo and redo, as expected.
This commit is contained in:
Dan Korn
2021-08-18 23:07:42 +02:00
committed by Vadim Zeitlin
parent 4fcd18e6ea
commit 9b27eaad43

View File

@@ -342,7 +342,7 @@ void wxTextCtrl::OnDropFiles(wxDropFilesEvent& event)
void wxTextCtrl::OnKeyDown(wxKeyEvent& event) void wxTextCtrl::OnKeyDown(wxKeyEvent& event)
{ {
if ( event.GetModifiers() == wxMOD_CONTROL ) if ( event.ControlDown() )
{ {
switch( event.GetKeyCode() ) switch( event.GetKeyCode() )
{ {
@@ -361,6 +361,18 @@ void wxTextCtrl::OnKeyDown(wxKeyEvent& event)
if ( CanCut() ) if ( CanCut() )
Cut() ; Cut() ;
return; return;
case 'Z':
if ( !event.ShiftDown() )
{
if ( CanUndo() )
Undo() ;
return;
}
// else fall through to Redo
case 'Y':
if ( CanRedo() )
Redo() ;
return;
default: default:
break; break;
} }