Ver código fonte

removed un needed key handling code from TextView

Tig 1 ano atrás
pai
commit
22dcbc1a78

+ 8 - 4
Terminal.Gui/Application/Application.Keyboard.cs

@@ -358,9 +358,10 @@ public static partial class Application // Keyboard handling
                    );
 
         AddCommand (
-                    Command.NextView,    // TODO: Figure out how to move this to the View that is at the root of the view hierarchy (currently Application.Top)
+                    Command.NextView,    
                     () =>
                     {
+                        // TODO: Move this method to Application.Navigation.cs
                         Current.MoveNextView ();
 
                         return true;
@@ -368,9 +369,10 @@ public static partial class Application // Keyboard handling
                    );
 
         AddCommand (
-                    Command.PreviousView,// TODO: Figure out how to move this to the View that is at the root of the view hierarchy (currently Application.Top)
+                    Command.PreviousView,
                     () =>
                     {
+                        // TODO: Move this method to Application.Navigation.cs
                         Current.MovePreviousView ();
 
                         return true;
@@ -378,9 +380,10 @@ public static partial class Application // Keyboard handling
                    );
 
         AddCommand (
-                    Command.NextViewOrTop,// TODO: Figure out how to move this to the View that is at the root of the view hierarchy (currently Application.Top)
+                    Command.NextViewOrTop,
                     () =>
                     {
+                        // TODO: Move this method to Application.Navigation.cs
                         Current.MoveNextViewOrTop ();
 
                         return true;
@@ -388,9 +391,10 @@ public static partial class Application // Keyboard handling
                    );
 
         AddCommand (
-                    Command.PreviousViewOrTop,// TODO: Figure out how to move this to the View that is at the root of the view hierarchy (currently Application.Top)
+                    Command.PreviousViewOrTop,
                     () =>
                     {
+                        // TODO: Move this method to Application.Navigation.cs
                         Current.MovePreviousViewOrTop ();
 
                         return true;

+ 3 - 55
Terminal.Gui/Views/TextView.cs

@@ -2369,8 +2369,6 @@ public class TextView : View
                    );
         AddCommand (Command.Tab, () => ProcessTab ());
         AddCommand (Command.BackTab, () => ProcessBackTab ());
-        //AddCommand (Command.NextView, () => ProcessMoveNextView ());
-        //AddCommand (Command.PreviousView, () => ProcessMovePreviousView ());
 
         AddCommand (
                     Command.Undo,
@@ -2503,12 +2501,6 @@ public class TextView : View
         KeyBindings.Add (Key.Tab, Command.Tab);
         KeyBindings.Add (Key.Tab.WithShift, Command.BackTab);
 
-        //KeyBindings.Add (Key.Tab.WithCtrl, Command.NextView);
-        //KeyBindings.Add (Application.AlternateForwardKey, Command.NextView);
-
-        //KeyBindings.Add (Key.Tab.WithCtrl.WithShift, Command.PreviousView);
-        //KeyBindings.Add (Application.AlternateBackwardKey, Command.PreviousView);
-
         KeyBindings.Add (Key.Z.WithCtrl, Command.Undo);
         KeyBindings.Add (Key.R.WithCtrl, Command.Redo);
 
@@ -5365,16 +5357,6 @@ public class TextView : View
         DoNeededAction ();
     }
 
-    private bool MoveNextView ()
-    {
-        if (Application.OverlappedTop is { })
-        {
-            return SuperView?.FocusNext () == true;
-        }
-
-        return false;
-    }
-
     private void MovePageDown ()
     {
         int nPageDnShift = Viewport.Height - 1;
@@ -5431,16 +5413,6 @@ public class TextView : View
         DoNeededAction ();
     }
 
-    private bool MovePreviousView ()
-    {
-        if (Application.OverlappedTop is { })
-        {
-            return SuperView?.FocusPrev () == true;
-        }
-
-        return false;
-    }
-
     private void MoveRight ()
     {
         List<RuneCell> currentLine = GetCurrentLine ();
@@ -5617,7 +5589,7 @@ public class TextView : View
 
         if (!AllowsTab || _isReadOnly)
         {
-            return ProcessMovePreviousView ();
+            return false;
         }
 
         if (CurrentColumn > 0)
@@ -5889,21 +5861,7 @@ public class TextView : View
         StartSelecting ();
         MoveLeft ();
     }
-
-    private bool ProcessMoveNextView ()
-    {
-        ResetColumnTrack ();
-
-        return MoveNextView ();
-    }
-
-    private bool ProcessMovePreviousView ()
-    {
-        ResetColumnTrack ();
-
-        return MovePreviousView ();
-    }
-
+    
     private bool ProcessMoveRight ()
     {
         // if the user presses Right (without any control keys)
@@ -6163,7 +6121,7 @@ public class TextView : View
 
         if (!AllowsTab || _isReadOnly)
         {
-            return ProcessMoveNextView ();
+            return false;
         }
 
         InsertText (new Key ((KeyCode)'\t'));
@@ -6369,13 +6327,6 @@ public class TextView : View
     private void TextView_Initialized (object sender, EventArgs e)
     {
         Autocomplete.HostControl = this;
-
-        if (Application.Top is { })
-        {
-            Application.Top.AlternateForwardKeyChanged += Top_AlternateForwardKeyChanged!;
-            Application.Top.AlternateBackwardKeyChanged += Top_AlternateBackwardKeyChanged!;
-        }
-
         OnContentsChanged ();
     }
 
@@ -6393,9 +6344,6 @@ public class TextView : View
         _selectionStartRow = CurrentRow;
     }
 
-    private void Top_AlternateBackwardKeyChanged (object sender, KeyChangedEventArgs e) { KeyBindings.ReplaceKey (e.OldKey, e.NewKey); }
-    private void Top_AlternateForwardKeyChanged (object sender, KeyChangedEventArgs e) { KeyBindings.ReplaceKey (e.OldKey, e.NewKey); }
-
     // Tries to snap the cursor to the tracking column
     private void TrackColumn ()
     {