瀏覽代碼

Fixes #1967. New keys for DeleteAll on TextField and TextView. (#1968)

* Fixes #1967. New keys for DeleteAll on TextField and TextView.

* Changing unit test for the new keys.
BDisp 2 年之前
父節點
當前提交
2594706a69
共有 3 個文件被更改,包括 31 次插入27 次删除
  1. 2 0
      Terminal.Gui/Views/TextField.cs
  2. 2 0
      Terminal.Gui/Views/TextView.cs
  3. 27 27
      UnitTests/ContextMenuTests.cs

+ 2 - 0
Terminal.Gui/Views/TextField.cs

@@ -203,6 +203,8 @@ namespace Terminal.Gui {
 			AddKeyBinding (Key.X | Key.CtrlMask, Command.Cut);
 			AddKeyBinding (Key.V | Key.CtrlMask, Command.Paste);
 			AddKeyBinding (Key.T | Key.CtrlMask, Command.SelectAll);
+
+			AddKeyBinding (Key.R | Key.CtrlMask, Command.DeleteAll);
 			AddKeyBinding (Key.D | Key.CtrlMask | Key.ShiftMask, Command.DeleteAll);
 
 			currentCulture = Thread.CurrentThread.CurrentUICulture;

+ 2 - 0
Terminal.Gui/Views/TextView.cs

@@ -1372,6 +1372,8 @@ namespace Terminal.Gui {
 
 			AddKeyBinding (Key.Z | Key.CtrlMask, Command.Undo);
 			AddKeyBinding (Key.R | Key.CtrlMask, Command.Redo);
+
+			AddKeyBinding (Key.G | Key.CtrlMask, Command.DeleteAll);
 			AddKeyBinding (Key.D | Key.CtrlMask | Key.ShiftMask, Command.DeleteAll);
 
 			currentCulture = Thread.CurrentThread.CurrentUICulture;

+ 27 - 27
UnitTests/ContextMenuTests.cs

@@ -592,27 +592,27 @@ namespace Terminal.Gui.Core {
 			Assert.Equal (new Point (9, 3), tf.ContextMenu.Position);
 			Application.Top.Redraw (Application.Top.Bounds);
 			var expected = @"
-  File   Edit                         
-                                      
-                                      
-  Label: TextField                    
-         ┌───────────────────────────
-         │ Select All         Ctrl+T │
-         │ Delete All   Ctrl+Shift+D
-         │ Copy               Ctrl+C │
-         │ Cut                Ctrl+X │
-         │ Paste              Ctrl+V │
-         │ Undo               Ctrl+Z │
-         │ Redo               Ctrl+Y │
-         └───────────────────────────
-                                      
-                                      
-                                      
- F1 Help │ ^Q Quit                    
+  File   Edit                   
+                                
+                                
+  Label: TextField              
+         ┌─────────────────────┐
+         │ Select All   Ctrl+T │
+         │ Delete All   Ctrl+R
+         │ Copy         Ctrl+C │
+         │ Cut          Ctrl+X │
+         │ Paste        Ctrl+V │
+         │ Undo         Ctrl+Z │
+         │ Redo         Ctrl+Y │
+         └─────────────────────┘
+                                
+                                
+                                
+ F1 Help │ ^Q Quit              
 ";
 
 			var pos = GraphViewTests.AssertDriverContentsWithFrameAre (expected, output);
-			Assert.Equal (new Rect (2, 0, 38, 17), pos);
+			Assert.Equal (new Rect (2, 0, 32, 17), pos);
 		}
 
 		[Fact, AutoInitShutdown]
@@ -663,15 +663,15 @@ namespace Terminal.Gui.Core {
 │                                          │
 │                                          │
 │  Label: TextField                        │
-│         ┌───────────────────────────┐    │
-│         │ Select All         Ctrl+T │    │
-│         │ Delete All   Ctrl+Shift+D │
-│         │ Copy               Ctrl+C │    │
-│         │ Cut                Ctrl+X │    │
-│         │ Paste              Ctrl+V │    │
-│         │ Undo               Ctrl+Z │    │
-│         │ Redo               Ctrl+Y │    │
-│         └───────────────────────────┘    │
+│         ┌─────────────────────┐      
+│         │ Select All   Ctrl+T │      
+│         │ Delete All   Ctrl+R │      
+│         │ Copy         Ctrl+C │      
+│         │ Cut          Ctrl+X │      
+│         │ Paste        Ctrl+V │      
+│         │ Undo         Ctrl+Z │      
+│         │ Redo         Ctrl+Y │      
+│         └─────────────────────┘      
 └──────────────────────────────────────────┘
  F1 Help │ ^Q Quit                          
 ";