mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-01-02 01:03:29 +01:00
Nuked AlternateFwd/BkKeys.
Added Next/PrevTabGroupKey. Fixed tests.
This commit is contained in:
@@ -6,55 +6,55 @@ namespace Terminal.Gui;
|
||||
|
||||
public static partial class Application // Keyboard handling
|
||||
{
|
||||
private static Key _alternateForwardKey = Key.Empty; // Defined in config.json
|
||||
private static Key _nextTabGroupKey = Key.Empty; // Defined in config.json
|
||||
|
||||
/// <summary>Alternative key to navigate forwards through views. Ctrl+Tab is the primary key.</summary>
|
||||
[SerializableConfigurationProperty (Scope = typeof (SettingsScope))]
|
||||
[JsonConverter (typeof (KeyJsonConverter))]
|
||||
public static Key AlternateForwardKey
|
||||
public static Key NextTabGroupKey
|
||||
{
|
||||
get => _alternateForwardKey;
|
||||
get => _nextTabGroupKey;
|
||||
set
|
||||
{
|
||||
if (_alternateForwardKey != value)
|
||||
if (_nextTabGroupKey != value)
|
||||
{
|
||||
Key oldKey = _alternateForwardKey;
|
||||
_alternateForwardKey = value;
|
||||
Key oldKey = _nextTabGroupKey;
|
||||
_nextTabGroupKey = value;
|
||||
|
||||
if (_alternateForwardKey == Key.Empty)
|
||||
if (_nextTabGroupKey == Key.Empty)
|
||||
{
|
||||
KeyBindings.Remove (_alternateForwardKey);
|
||||
KeyBindings.Remove (_nextTabGroupKey);
|
||||
}
|
||||
else
|
||||
{
|
||||
KeyBindings.ReplaceKey (oldKey, _alternateForwardKey);
|
||||
KeyBindings.ReplaceKey (oldKey, _nextTabGroupKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static Key _alternateBackwardKey = Key.Empty; // Defined in config.json
|
||||
private static Key _prevTabGroupKey = Key.Empty; // Defined in config.json
|
||||
|
||||
/// <summary>Alternative key to navigate backwards through views. Shift+Ctrl+Tab is the primary key.</summary>
|
||||
[SerializableConfigurationProperty (Scope = typeof (SettingsScope))]
|
||||
[JsonConverter (typeof (KeyJsonConverter))]
|
||||
public static Key AlternateBackwardKey
|
||||
public static Key PrevTabGroupKey
|
||||
{
|
||||
get => _alternateBackwardKey;
|
||||
get => _prevTabGroupKey;
|
||||
set
|
||||
{
|
||||
if (_alternateBackwardKey != value)
|
||||
if (_prevTabGroupKey != value)
|
||||
{
|
||||
Key oldKey = _alternateBackwardKey;
|
||||
_alternateBackwardKey = value;
|
||||
Key oldKey = _prevTabGroupKey;
|
||||
_prevTabGroupKey = value;
|
||||
|
||||
if (_alternateBackwardKey == Key.Empty)
|
||||
if (_prevTabGroupKey == Key.Empty)
|
||||
{
|
||||
KeyBindings.Remove (_alternateBackwardKey);
|
||||
KeyBindings.Remove (_prevTabGroupKey);
|
||||
}
|
||||
else
|
||||
{
|
||||
KeyBindings.ReplaceKey (oldKey, _alternateBackwardKey);
|
||||
KeyBindings.ReplaceKey (oldKey, _prevTabGroupKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -372,16 +372,14 @@ public static partial class Application // Keyboard handling
|
||||
KeyBindings.Add (Key.CursorDown, KeyBindingScope.Application, Command.NextView);
|
||||
KeyBindings.Add (Key.CursorLeft, KeyBindingScope.Application, Command.PreviousView);
|
||||
KeyBindings.Add (Key.CursorUp, KeyBindingScope.Application, Command.PreviousView);
|
||||
|
||||
KeyBindings.Add (Key.Tab, KeyBindingScope.Application, Command.NextView);
|
||||
KeyBindings.Add (Key.Tab.WithShift, KeyBindingScope.Application, Command.PreviousView);
|
||||
KeyBindings.Add (Key.Tab.WithCtrl, KeyBindingScope.Application, Command.NextViewOrTop);
|
||||
KeyBindings.Add (Key.Tab.WithShift.WithCtrl, KeyBindingScope.Application, Command.PreviousViewOrTop);
|
||||
|
||||
KeyBindings.Add (Application.NextTabGroupKey, KeyBindingScope.Application, Command.NextViewOrTop); // Needed on Unix
|
||||
KeyBindings.Add (Application.PrevTabGroupKey, KeyBindingScope.Application, Command.PreviousViewOrTop); // Needed on Unix
|
||||
|
||||
// TODO: Refresh Key should be configurable
|
||||
KeyBindings.Add (Key.F5, KeyBindingScope.Application, Command.Refresh);
|
||||
KeyBindings.Add (Application.AlternateForwardKey, KeyBindingScope.Application, Command.NextViewOrTop); // Needed on Unix
|
||||
KeyBindings.Add (Application.AlternateBackwardKey, KeyBindingScope.Application, Command.PreviousViewOrTop); // Needed on Unix
|
||||
|
||||
if (Environment.OSVersion.Platform == PlatformID.Unix)
|
||||
{
|
||||
|
||||
@@ -142,8 +142,8 @@ public static partial class Application
|
||||
UnGrabbedMouse = null;
|
||||
|
||||
// Keyboard
|
||||
AlternateBackwardKey = Key.Empty;
|
||||
AlternateForwardKey = Key.Empty;
|
||||
PrevTabGroupKey = Key.Empty;
|
||||
NextTabGroupKey = Key.Empty;
|
||||
QuitKey = Key.Empty;
|
||||
KeyDown = null;
|
||||
KeyUp = null;
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
// to throw exceptions.
|
||||
"ConfigurationManager.ThrowOnJsonErrors": false,
|
||||
|
||||
"Application.AlternateBackwardKey": "Ctrl+PageUp",
|
||||
"Application.AlternateForwardKey": "Ctrl+PageDown",
|
||||
"Application.NextTabGroupKey": "F6",
|
||||
"Application.PrevTabGroupKey": "Shift+F6",
|
||||
"Application.QuitKey": "Esc",
|
||||
|
||||
"Theme": "Default",
|
||||
|
||||
@@ -818,10 +818,10 @@ public partial class View // Focus and cross-view navigation management (TabStop
|
||||
/// focus even if this property is set and vice-versa.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// The default <see cref="TabBehavior.TabStop"/> keys are <c>Key.Tab</c> and <c>Key>Tab.WithShift</c>.
|
||||
/// The default <see cref="TabBehavior.TabStop"/> keys are <see cref="Application.NextTabKey"/> (<c>Key.Tab</c>) and <see cref="Application.PrevTabKey"/> (<c>Key>Tab.WithShift</c>).
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// The default <see cref="TabBehavior.TabGroup"/> keys are <c>Key.Tab.WithCtrl</c> and <c>Key>Key.Tab.WithCtrl.WithShift</c>.
|
||||
/// The default <see cref="TabBehavior.TabGroup"/> keys are <see cref="Application.NextTabGroupKey"/> (<c>Key.F6</c>) and <see cref="Application.PrevTabGroupKey"/> (<c>Key>Key.F6.WithShift</c>).
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public TabBehavior? TabStop
|
||||
|
||||
Reference in New Issue
Block a user