diff --git a/.github/workflows/api-docs.yml b/.github/workflows/api-docs.yml
index 145aedc0d7..9a3625f2d5 100644
--- a/.github/workflows/api-docs.yml
+++ b/.github/workflows/api-docs.yml
@@ -2,7 +2,7 @@ name: Build and publish API docs
on:
push:
- branches: [main]
+ branches: [main, develop, v2_develop]
jobs:
generate-docs:
@@ -30,6 +30,8 @@ jobs:
# https://stackoverflow.com/questions/56726429/how-to-run-multiple-commands-in-one-github-actions-docker
run: |
rm ../docs -Recurse -Force -ErrorAction SilentlyContinue
+ rm ../api -Recurse -Force -ErrorAction SilentlyContinue
+ $env:DOCFX_SOURCE_BRANCH_NAME="${{ github.ref_name }}""
docfx docfx.json
continue-on-error: false
diff --git a/Terminal.Gui/Text/TextFormatter.cs b/Terminal.Gui/Text/TextFormatter.cs
index b98b0ff7bc..8d24fd262a 100644
--- a/Terminal.Gui/Text/TextFormatter.cs
+++ b/Terminal.Gui/Text/TextFormatter.cs
@@ -929,15 +929,15 @@ public static Rect CalcRect (int x, int y, string text, TextDirection direction
}
///
- /// Finds the hotkey and its location in text.
+ /// Finds the hot key and its location in text.
///
/// The text to look in.
- /// The hotkey specifier (e.g. '_') to look for.
- /// If true the legacy behavior of identifying the first upper case character as the hotkey will be enabled.
+ /// The hot key specifier (e.g. '_') to look for.
+ /// If true the legacy behavior of identifying the first upper case character as the hot key will be enabled.
/// Regardless of the value of this parameter, hotKeySpecifier takes precedence.
/// Outputs the Rune index into text.
/// Outputs the hotKey.
- /// true if a hotkey was found; false otherwise.
+ /// true if a hot key was found; false otherwise.
public static bool FindHotKey (string text, Rune hotKeySpecifier, bool firstUpperCase, out int hotPos, out Key hotKey)
{
if (string.IsNullOrEmpty (text) || hotKeySpecifier == (Rune)0xFFFF) {
@@ -996,11 +996,11 @@ public static bool FindHotKey (string text, Rune hotKeySpecifier, bool firstUppe
///
/// Replaces the Rune at the index specified by the hotPos parameter with a tag identifying
- /// it as the hotkey.
+ /// it as the hot key.
///
- /// The text to tag the hotkey in.
- /// The Rune index of the hotkey in text.
- /// The text with the hotkey tagged.
+ /// The text to tag the hot key in.
+ /// The Rune index of the hot key in text.
+ /// The text with the hot key tagged.
///
/// The returned string will not render correctly without first un-doing the tag. To undo the tag, search for
///
@@ -1015,12 +1015,12 @@ public string ReplaceHotKeyWithTag (string text, int hotPos)
}
///
- /// Removes the hotkey specifier from text.
+ /// Removes the hot key specifier from text.
///
/// The text to manipulate.
/// The hot-key specifier (e.g. '_') to look for.
/// Returns the position of the hot-key in the text. -1 if not found.
- /// The input text with the hotkey specifier ('_') removed.
+ /// The input text with the hot key specifier ('_') removed.
public static string RemoveHotKeySpecifier (string text, int hotPos, Rune hotKeySpecifier)
{
if (string.IsNullOrEmpty (text)) {
diff --git a/Terminal.Gui/View/ViewKeyboard.cs b/Terminal.Gui/View/ViewKeyboard.cs
index 6f98942389..84b91e66fa 100644
--- a/Terminal.Gui/View/ViewKeyboard.cs
+++ b/Terminal.Gui/View/ViewKeyboard.cs
@@ -189,6 +189,9 @@ public bool TabStop {
///
/// Overrides must call into the base and return if the base returns .
///
+ ///
+ /// See for an overview of Terminal.Gui keyboard APIs.
+ ///
///
///
/// Contains the details about the key that produced the event.
@@ -230,6 +233,9 @@ public virtual bool OnKeyDown (KeyEventArgs keyEvent)
///
/// Overrides must call into the base and return if the base returns .
///
+ ///
+ /// See for an overview of Terminal.Gui keyboard APIs.
+ ///
///
///
/// Contains the details about the key that produced the event.
@@ -268,6 +274,9 @@ public virtual bool OnKeyUp (KeyEventArgs keyEvent)
/// If the view is enabled, processes a key pressed event and returns if the event was handled.
///
/// Calls and .
+ ///
+ /// See for an overview of Terminal.Gui keyboard APIs.
+ ///
///
///
///
@@ -310,6 +319,9 @@ public bool ProcessKeyPressed (KeyEventArgs keyEvent)
/// Not all terminals support key distinct down/up notifications, Applications should avoid
/// depending on distinct KeyDown and KeyUp events and instead should use .
///
+ ///
+ /// See for an overview of Terminal.Gui keyboard APIs.
+ ///
///
///
/// Contains the details about the key that produced the event.
@@ -349,6 +361,9 @@ public virtual bool OnKeyPressed (KeyEventArgs keyEvent)
///
/// Fires the event.
///
+ ///
+ /// See for an overview of Terminal.Gui keyboard APIs.
+ ///
///
///
/// Contains the details about the key that produced the event.
diff --git a/Terminal.Gui/Views/FileDialog.cs b/Terminal.Gui/Views/FileDialog.cs
index fa8fab0d76..82513ff4f7 100644
--- a/Terminal.Gui/Views/FileDialog.cs
+++ b/Terminal.Gui/Views/FileDialog.cs
@@ -485,27 +485,6 @@ private IFileSystemInfo [] GetFocusedFiles ()
.ToArray ();
}
-
-// ///
-// public override bool OnHotKey (KeyEventArgs keyEvent)
-// {
-//#if BROKE_IN_2927
-// // BUGBUG: Ctrl-F is forward in a TextField.
-// if (this.NavigateIf (keyEvent, Key.Alt | Key.F, this.tbFind)) {
-// return true;
-// }
-//#endif
-
-// ClearFeedback ();
-
-// if (allowedTypeMenuBar != null &&
-// keyEvent.Key == Key.Tab &&
-// allowedTypeMenuBar.IsMenuOpen) {
-// allowedTypeMenuBar.CloseMenu (false, false, false);
-// }
-
-// return base.OnHotKey (keyEvent);
-// }
private void RestartSearch ()
{
if (disposed || State?.Directory == null) {
diff --git a/Terminal.Gui/Views/Menu.cs b/Terminal.Gui/Views/Menu.cs
index 185b37ab9d..ceccfb5ad9 100644
--- a/Terminal.Gui/Views/Menu.cs
+++ b/Terminal.Gui/Views/Menu.cs
@@ -2079,40 +2079,7 @@ private void ProcessMenu (int i, MenuBarItem mi)
}
SetNeedsDisplay ();
}
-
- /////
- //public override bool OnHotKey (KeyEventArgs a)
- //{
- // if (a.Key == Key) {
- // if (Visible && !IsMenuOpen) {
- // OpenMenu ();
- // } else {
- // CloseAllMenus ();
- // }
- // return true;
- // }
-
- // a.Key
- // // To ncurses simulate a AltMask key pressing Alt+Space because
- // // it can't detect an alone special key down was pressed.
- // if (a.Key == Key.AltMask && _openMenu == null) {
- // OnKeyDown (a);
- // OnKeyUp (a);
- // return true;
- // } else if (((a.Key & Key.AltMask) != 0) || a.IsAlt && !a.IsCtrl && !a.IsShift) {
- // // BUGBUG: Note the test for BOTH AltMask and a.IsAlt above. This is because the
- // // unit test Separators_Does_Not_Throws_Pressing_Menu_Shortcut calls
- // // menu.OnHotKey(new KeyEventArgs (Key.AltMask | Key.Q))) which does not
- // // cause a.IsAlt to be set.
- // if (FindAndOpenMenuByHotkey (a)) {
- // return true;
- // }
- // }
- // //var kc = a.KeyValue;
-
- // return base.OnHotKey (a);
- //}
-
+
///
public override bool OnKeyPressed (KeyEventArgs a)
{
@@ -2232,13 +2199,7 @@ void MoveLeft ()
OpenMenu (_selected);
SetNeedsDisplay ();
}
-
- /////
- //public override bool OnColdKey (KeyEventArgs a)
- //{
- // return FindAndOpenMenuByShortcut (a);
- //}
-
+
///
public override bool MouseEvent (MouseEvent me)
{
diff --git a/Terminal.Gui/Views/Toplevel.cs b/Terminal.Gui/Views/Toplevel.cs
index 2726f6b0e3..85467eacdf 100644
--- a/Terminal.Gui/Views/Toplevel.cs
+++ b/Terminal.Gui/Views/Toplevel.cs
@@ -468,20 +468,7 @@ private void QuitToplevel ()
Application.RequestStop ();
}
}
-
- /////
- //public override bool OnColdKey (KeyEventArgs keyEvent)
- //{
- // if (base.OnColdKey (keyEvent)) {
- // return true;
- // }
-
- // if (ShortcutHelper.FindAndOpenByShortcut (keyEvent, this)) {
- // return true;
- // }
- // return false;
- //}
-
+
View GetDeepestFocusedSubview (View view)
{
if (view == null) {
diff --git a/UnitTests/ConsoleDrivers/ConsoleDriverTests.cs b/UnitTests/ConsoleDrivers/ConsoleDriverTests.cs
index bcd0bb26ea..2033c83af0 100644
--- a/UnitTests/ConsoleDrivers/ConsoleDriverTests.cs
+++ b/UnitTests/ConsoleDrivers/ConsoleDriverTests.cs
@@ -125,62 +125,62 @@ public void FakeDriver_MockKeyPresses (Type driverType)
Application.Shutdown ();
}
- //[Theory]
- //[InlineData (typeof (FakeDriver))]
- //public void FakeDriver_MockKeyPresses_Press_AfterTimeOut (Type driverType)
- //{
- // var driver = (ConsoleDriver)Activator.CreateInstance (driverType);
- // Application.Init (driver);
-
- // // Simulating pressing of QuitKey after a short period of time
- // uint quitTime = 100;
- // Func closeCallback = (MainLoop loop) => {
- // // Prove the scenario is using Application.QuitKey correctly
- // output.WriteLine ($" {quitTime}ms elapsed; Simulating keypresses...");
- // FakeConsole.PushMockKeyPress (Key.F);
- // FakeConsole.PushMockKeyPress (Key.U);
- // FakeConsole.PushMockKeyPress (Key.C);
- // FakeConsole.PushMockKeyPress (Key.K);
- // return false;
- // };
- // output.WriteLine ($"Add timeout to simulate key presses after {quitTime}ms");
- // _ = Application.AddTimeout (TimeSpan.FromMilliseconds (quitTime), closeCallback);
-
- // // If Top doesn't quit within abortTime * 5 (500ms), this will force it
- // uint abortTime = quitTime * 5;
- // Func forceCloseCallback = (MainLoop loop) => {
- // Application.RequestStop ();
- // Assert.Fail ($" failed to Quit after {abortTime}ms. Force quit.");
- // return false;
- // };
- // output.WriteLine ($"Add timeout to force quit after {abortTime}ms");
- // _ = Application.AddTimeout (TimeSpan.FromMilliseconds (abortTime), forceCloseCallback);
-
- // Key key = Key.Unknown;
-
- // Application.Top.KeyPress += (e) => {
- // key = e.Key;
- // output.WriteLine ($" Application.Top.KeyPress: {key}");
- // e.Handled = true;
-
- // };
-
- // int iterations = 0;
- // Application.Iteration += (s, a) => {
- // output.WriteLine ($" iteration {++iterations}");
-
- // if (Console.MockKeyPresses.Count == 0) {
- // output.WriteLine ($" No more MockKeyPresses; RequestStop");
- // Application.RequestStop ();
- // }
- // };
+ [Theory]
+ [InlineData (typeof (FakeDriver))]
+ public void FakeDriver_MockKeyPresses_Press_AfterTimeOut (Type driverType)
+ {
+ var driver = (ConsoleDriver)Activator.CreateInstance (driverType);
+ Application.Init (driver);
+
+ // Simulating pressing of QuitKey after a short period of time
+ uint quitTime = 100;
+ Func closeCallback = () => {
+ // Prove the scenario is using Application.QuitKey correctly
+ output.WriteLine ($" {quitTime}ms elapsed; Simulating keypresses...");
+ FakeConsole.PushMockKeyPress (Key.F);
+ FakeConsole.PushMockKeyPress (Key.U);
+ FakeConsole.PushMockKeyPress (Key.C);
+ FakeConsole.PushMockKeyPress (Key.K);
+ return false;
+ };
+ output.WriteLine ($"Add timeout to simulate key presses after {quitTime}ms");
+ _ = Application.AddTimeout (TimeSpan.FromMilliseconds (quitTime), closeCallback);
+
+ // If Top doesn't quit within abortTime * 5 (500ms), this will force it
+ uint abortTime = quitTime * 5;
+ Func forceCloseCallback = () => {
+ Application.RequestStop ();
+ Assert.Fail ($" failed to Quit after {abortTime}ms. Force quit.");
+ return false;
+ };
+ output.WriteLine ($"Add timeout to force quit after {abortTime}ms");
+ _ = Application.AddTimeout (TimeSpan.FromMilliseconds (abortTime), forceCloseCallback);
+
+ Key key = Key.Unknown;
+
+ Application.Top.KeyPressed += (s, e) => {
+ key = e.Key;
+ output.WriteLine ($" Application.Top.KeyPressed: {key}");
+ e.Handled = true;
+
+ };
+
+ int iterations = 0;
+ Application.Iteration += (s, a) => {
+ output.WriteLine ($" iteration {++iterations}");
+
+ if (Console.MockKeyPresses.Count == 0) {
+ output.WriteLine ($" No more MockKeyPresses; RequestStop");
+ Application.RequestStop ();
+ }
+ };
+
+ Application.Run ();
- // Application.Run ();
+ // Shutdown must be called to safely clean up Application if Init has been called
+ Application.Shutdown ();
+ }
- // // Shutdown must be called to safely clean up Application if Init has been called
- // Application.Shutdown ();
- //}
-
[Theory]
[InlineData (typeof (FakeDriver))]
[InlineData (typeof (NetDriver))]
diff --git a/UnitTests/UICatalog/ScenarioTests.cs b/UnitTests/UICatalog/ScenarioTests.cs
index 40de0a8df5..f403162845 100644
--- a/UnitTests/UICatalog/ScenarioTests.cs
+++ b/UnitTests/UICatalog/ScenarioTests.cs
@@ -63,17 +63,11 @@ public void Run_All_Scenarios ()
// Press QuitKey
Assert.Empty (FakeConsole.MockKeyPresses);
- // BUGBUG: (#2474) For some reason ReadKey is not returning the QuitKey for some Scenarios
- // by adding this Space it seems to work.
- //FakeConsole.PushMockKeyPress (Key.Space);
FakeConsole.PushMockKeyPress (Application.QuitKey);
// The only key we care about is the QuitKey
Application.Top.KeyPressed += (object sender, KeyEventArgs args) => {
- output.WriteLine ($" Keypress: {args.Key}");
- // BUGBUG: (#2474) For some reason ReadKey is not returning the QuitKey for some Scenarios
- // by adding this Space it seems to work.
- // See #2474 for why this is commented out
+ output.WriteLine ($" Keypressed: {args.Key}");
Assert.Equal (Application.QuitKey, args.Key);
};
@@ -82,7 +76,6 @@ public void Run_All_Scenarios ()
Func forceCloseCallback = () => {
if (Application.Top.Running && FakeConsole.MockKeyPresses.Count == 0) {
Application.RequestStop ();
- // See #2474 for why this is commented out
Assert.Fail ($"'{scenario.GetName ()}' failed to Quit with {Application.QuitKey} after {abortTime}ms. Force quit.");
}
return false;
diff --git a/UnitTests/View/NavigationTests.cs b/UnitTests/View/NavigationTests.cs
index 4bcb67922c..1206ba21f5 100644
--- a/UnitTests/View/NavigationTests.cs
+++ b/UnitTests/View/NavigationTests.cs
@@ -891,7 +891,7 @@ public void CanFocus_Sets_To_False_On_Toplevel_Focus_View_On_Another_Toplevel ()
[Fact]
[AutoInitShutdown]
- public void ProcessHotKey_Will_Invoke_ProcessKey_Only_For_The_MostFocused_With_Top_KeyPress_Event ()
+ public void ProcessKeyPressed_Will_Invoke_KeyPressed_Only_For_The_MostFocused_With_Top_KeyPressed_Event ()
{
var sbQuiting = false;
var tfQuiting = false;
@@ -955,7 +955,7 @@ void Top_KeyPress (object sender, KeyEventArgs obj)
[Fact]
[AutoInitShutdown]
- public void ProcessHotKey_Will_Invoke_ProcessKey_Only_For_The_MostFocused_Without_Top_KeyPress_Event ()
+ public void ProcessKeyPressed_Will_Invoke_KeyPressed_Only_For_The_MostFocused_Without_Top_KeyPressed_Event ()
{
var sbQuiting = false;
var tfQuiting = false;