Browse Source

Disabled unix key bindings for TextView. Unit test fix

Tig 10 months ago
parent
commit
8cec593067
2 changed files with 10 additions and 10 deletions
  1. 2 2
      Terminal.Gui/Views/TextView.cs
  2. 8 8
      UnitTests/Views/TextViewTests.cs

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

@@ -2453,8 +2453,6 @@ public class TextView : View
 
 
         KeyBindings.Add (Key.Delete.WithCtrl.WithShift, Command.CutToEndLine); // kill-to-end
         KeyBindings.Add (Key.Delete.WithCtrl.WithShift, Command.CutToEndLine); // kill-to-end
 
 
-        KeyBindings.Add (Key.K.WithAlt, Command.CutToStartLine); // kill-to-start
-
         KeyBindings.Add (Key.Backspace.WithCtrl.WithShift, Command.CutToStartLine); // kill-to-start
         KeyBindings.Add (Key.Backspace.WithCtrl.WithShift, Command.CutToStartLine); // kill-to-start
 
 
         KeyBindings.Add (Key.Y.WithCtrl, Command.Paste); // Control-y, yank
         KeyBindings.Add (Key.Y.WithCtrl, Command.Paste); // Control-y, yank
@@ -2496,6 +2494,8 @@ public class TextView : View
         KeyBindings.Add (Key.W.WithAlt, Command.Cut);
         KeyBindings.Add (Key.W.WithAlt, Command.Cut);
         KeyBindings.Add (Key.V.WithAlt, Command.PageUp);
         KeyBindings.Add (Key.V.WithAlt, Command.PageUp);
         KeyBindings.Add (Key.F.WithAlt, Command.WordRight);
         KeyBindings.Add (Key.F.WithAlt, Command.WordRight);
+        KeyBindings.Add (Key.K.WithAlt, Command.CutToStartLine); // kill-to-start
+
 #endif
 #endif
 
 
         _currentCulture = Thread.CurrentThread.CurrentUICulture;
         _currentCulture = Thread.CurrentThread.CurrentUICulture;

+ 8 - 8
UnitTests/Views/TextViewTests.cs

@@ -4900,7 +4900,7 @@ This is the second line.
         Assert.True (tv.NewKeyDownEvent (Key.PageUp));
         Assert.True (tv.NewKeyDownEvent (Key.PageUp));
         Assert.Equal (24, tv.GetCurrentLine ().Count);
         Assert.Equal (24, tv.GetCurrentLine ().Count);
         Assert.Equal (new Point (24, 1), tv.CursorPosition);
         Assert.Equal (new Point (24, 1), tv.CursorPosition);
-        Assert.True (tv.NewKeyDownEvent (new Key (Key.V.WithAlt)));
+        Assert.True (tv.NewKeyDownEvent (new Key (Key.PageUp)));
         Assert.Equal (23, tv.GetCurrentLine ().Count);
         Assert.Equal (23, tv.GetCurrentLine ().Count);
         Assert.Equal (new Point (23, 0), tv.CursorPosition);
         Assert.Equal (new Point (23, 0), tv.CursorPosition);
         Assert.True (tv.NewKeyDownEvent (Key.PageDown));
         Assert.True (tv.NewKeyDownEvent (Key.PageDown));
@@ -5092,7 +5092,7 @@ This is the second line.
         Assert.Equal ("", tv.SelectedText);
         Assert.Equal ("", tv.SelectedText);
         Assert.False (tv.Selecting);
         Assert.False (tv.Selecting);
         Assert.Equal ("is is the first lin", Clipboard.Contents);
         Assert.Equal ("is is the first lin", Clipboard.Contents);
-        Assert.True (tv.NewKeyDownEvent (Key.K.WithAlt));
+        Assert.True (tv.NewKeyDownEvent (Key.Backspace.WithCtrl.WithShift));
 
 
         Assert.Equal (
         Assert.Equal (
                       $"{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.first",
                       $"{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.first",
@@ -5151,7 +5151,7 @@ This is the second line.
         Assert.Equal (19, tv.SelectionStartColumn);
         Assert.Equal (19, tv.SelectionStartColumn);
         Assert.Equal (0, tv.SelectionStartRow);
         Assert.Equal (0, tv.SelectionStartRow);
         tv.SelectionStartColumn = 0;
         tv.SelectionStartColumn = 0;
-        Assert.True (tv.NewKeyDownEvent (new Key (Key.C.WithAlt)));
+        Assert.True (tv.NewKeyDownEvent (Key.C.WithCtrl));
 
 
         Assert.Equal (
         Assert.Equal (
                       $"is is the first lin{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.first",
                       $"is is the first lin{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.first",
@@ -5175,7 +5175,7 @@ This is the second line.
         Assert.True (tv.Selecting);
         Assert.True (tv.Selecting);
         Assert.Equal (0, tv.SelectionStartColumn);
         Assert.Equal (0, tv.SelectionStartColumn);
         Assert.Equal (0, tv.SelectionStartRow);
         Assert.Equal (0, tv.SelectionStartRow);
-        Assert.True (tv.NewKeyDownEvent (new Key (Key.W.WithAlt)));
+        Assert.True (tv.NewKeyDownEvent (Key.X.WithCtrl));
 
 
         Assert.Equal (
         Assert.Equal (
                       $"{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.first",
                       $"{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.first",
@@ -5244,7 +5244,7 @@ This is the second line.
         Assert.Equal (6, tv.SelectedLength);
         Assert.Equal (6, tv.SelectedLength);
         Assert.Equal ("third ", tv.SelectedText);
         Assert.Equal ("third ", tv.SelectedText);
         Assert.True (tv.Selecting);
         Assert.True (tv.Selecting);
-        Assert.True (tv.NewKeyDownEvent (new Key (Key.B.WithAlt)));
+        Assert.True (tv.NewKeyDownEvent (Key.CursorLeft.WithCtrl));
 
 
         Assert.Equal (
         Assert.Equal (
                       $"{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.first",
                       $"{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.first",
@@ -5274,7 +5274,7 @@ This is the second line.
         Assert.Equal (6, tv.SelectedLength);
         Assert.Equal (6, tv.SelectedLength);
         Assert.Equal ("third ", tv.SelectedText);
         Assert.Equal ("third ", tv.SelectedText);
         Assert.True (tv.Selecting);
         Assert.True (tv.Selecting);
-        Assert.True (tv.NewKeyDownEvent (new Key (Key.F.WithAlt)));
+        Assert.True (tv.NewKeyDownEvent (Key.CursorRight.WithCtrl));
 
 
         Assert.Equal (
         Assert.Equal (
                       $"{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.first",
                       $"{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.first",
@@ -5284,7 +5284,7 @@ This is the second line.
         Assert.Equal (0, tv.SelectedLength);
         Assert.Equal (0, tv.SelectedLength);
         Assert.Equal ("", tv.SelectedText);
         Assert.Equal ("", tv.SelectedText);
         Assert.False (tv.Selecting);
         Assert.False (tv.Selecting);
-        Assert.True (tv.NewKeyDownEvent (new Key (Key.F.WithAlt)));
+        Assert.True (tv.NewKeyDownEvent (Key.CursorRight.WithCtrl));
 
 
         Assert.Equal (
         Assert.Equal (
                       $"{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.first",
                       $"{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.first",
@@ -5294,7 +5294,7 @@ This is the second line.
         Assert.Equal (0, tv.SelectedLength);
         Assert.Equal (0, tv.SelectedLength);
         Assert.Equal ("", tv.SelectedText);
         Assert.Equal ("", tv.SelectedText);
         Assert.False (tv.Selecting);
         Assert.False (tv.Selecting);
-        Assert.True (tv.NewKeyDownEvent (new Key (Key.F.WithAlt)));
+        Assert.True (tv.NewKeyDownEvent (Key.CursorRight.WithCtrl));
 
 
         Assert.Equal (
         Assert.Equal (
                       $"{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.first",
                       $"{Environment.NewLine}This is the second line.{Environment.NewLine}This is the third line.first",