File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
src/Uno.UI/UI/Xaml/Controls/TextBox Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,44 @@ public TextBoxView(TextBox textBox)
25
25
Initialize ( ) ;
26
26
}
27
27
28
+ public override bool PerformKeyEquivalent ( NSEvent theEvent )
29
+ {
30
+ if ( theEvent . Type == NSEventType . KeyDown )
31
+ {
32
+ if ( ( theEvent . ModifierFlags & NSEventModifierMask . DeviceIndependentModifierFlagsMask ) == NSEventModifierMask . CommandKeyMask )
33
+ {
34
+ var selectorName = theEvent . CharactersIgnoringModifiers . ToLowerInvariant ( ) switch
35
+ {
36
+ "x" => "cut:" ,
37
+ "c" => "copy:" ,
38
+ "v" => "paste:" ,
39
+ "z" => "undo:" ,
40
+ "a" => "selectAll:" ,
41
+ _ => string . Empty ,
42
+ } ;
43
+
44
+ if ( ! string . IsNullOrWhiteSpace ( selectorName ) )
45
+ {
46
+ if ( NSApplication . SharedApplication . SendAction ( new ObjCRuntime . Selector ( selectorName ) , null , this ) )
47
+ {
48
+ return true ;
49
+ }
50
+ }
51
+ }
52
+ else if ( ( theEvent . ModifierFlags & NSEventModifierMask . DeviceIndependentModifierFlagsMask ) == ( NSEventModifierMask . CommandKeyMask | NSEventModifierMask . ShiftKeyMask ) )
53
+ {
54
+ if ( theEvent . CharactersIgnoringModifiers . ToLowerInvariant ( ) == "z" )
55
+ {
56
+ if ( NSApplication . SharedApplication . SendAction ( new ObjCRuntime . Selector ( "redo:" ) , null , this ) )
57
+ {
58
+ return true ;
59
+ }
60
+ }
61
+ }
62
+ }
28
63
64
+ return base . PerformKeyEquivalent ( theEvent ) ;
65
+ }
29
66
private void OnEditingChanged ( object sender , EventArgs e )
30
67
{
31
68
OnTextChanged ( ) ;
You can’t perform that action at this time.
0 commit comments