mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 07:47:54 +01:00
* Implement Unix driver
* Add more sequences related with macOS
* Helper method to map char to control keys
* Add DriverName property
* Fix error on Unix unit tests
* Fix Non-nullable property 'DriverName' must contain a non-null value when exiting constructor.
* Fix Ctrl being ignored in the range \u0001-\u001a
* Add unit test for the MapChar method
* Fix cursor visibility and cursor styles
* Avoid sometimes error when running gnome-terminal
* Captures Ctrl+Shift+Alt+D7
* Captures Ctrl+D4, Ctrl+D5, Ctrl+D6 and Ctrl+D7
* Add unit test for Ctrl+Shift+Alt+7
* Fix issue on Windows where sending AltGr+some key fail assertion
* Exclude Oem1 from assertion
* Fix regex pattern
* Remove driverName from the constructor
* Revert "Remove driverName from the constructor"
This reverts commit 004e9f9588.
* Remove driverName from the constructor
* Add generic CreateSubcomponents method avoiding redundancy
* Add v2unix profiles
* Replace with hexadecimal values
---------
Co-authored-by: Tig <tig@users.noreply.github.com>
This commit is contained in:
@@ -30,6 +30,7 @@ public class SyncrhonizationContextTests
|
||||
[InlineData (typeof (CursesDriver))]
|
||||
[InlineData (typeof (ConsoleDriverFacade<WindowsConsole.InputRecord>), "v2win")]
|
||||
[InlineData (typeof (ConsoleDriverFacade<ConsoleKeyInfo>), "v2net")]
|
||||
[InlineData (typeof (ConsoleDriverFacade<char>), "v2unix")]
|
||||
public void SynchronizationContext_Post (Type driverType, string driverName = null)
|
||||
{
|
||||
lock (_lockPost)
|
||||
|
||||
@@ -103,16 +103,27 @@ public class AnsiKeyboardParserTests
|
||||
yield return new object [] { "\u001b[1;2P", Key.F1.WithShift };
|
||||
yield return new object [] { "\u001b[1;3Q", Key.F2.WithAlt };
|
||||
yield return new object [] { "\u001b[1;5R", Key.F3.WithCtrl };
|
||||
|
||||
|
||||
// Keys with Alt modifiers
|
||||
yield return new object [] { "\u001ba", Key.A.WithAlt, true };
|
||||
yield return new object [] { "\u001bA", Key.A.WithShift.WithAlt, true };
|
||||
yield return new object [] { "\u001b1", Key.D1.WithAlt, true };
|
||||
|
||||
// Keys with Ctrl and Alt modifiers
|
||||
yield return new object [] { "\u001b\u0001", Key.A.WithCtrl.WithAlt, true };
|
||||
yield return new object [] { "\u001b\u001a", Key.Z.WithCtrl.WithAlt, true };
|
||||
|
||||
// Keys with Ctrl, Shift and Alt modifiers
|
||||
yield return new object [] { "\u001b\u001f", Key.D7.WithCtrl.WithShift.WithAlt, true };
|
||||
}
|
||||
|
||||
// Consolidated test for all keyboard events (e.g., arrow keys)
|
||||
[Theory]
|
||||
[MemberData (nameof (GetKeyboardTestData))]
|
||||
public void ProcessKeyboardInput_ReturnsCorrectKey (string? input, Key? expectedKey)
|
||||
public void ProcessKeyboardInput_ReturnsCorrectKey (string? input, Key? expectedKey, bool isLastMinute = false)
|
||||
{
|
||||
// Act
|
||||
Key? result = _parser.IsKeyboard (input)?.GetKey (input);
|
||||
Key? result = _parser.IsKeyboard (input, isLastMinute)?.GetKey (input);
|
||||
|
||||
// Assert
|
||||
Assert.Equal (expectedKey, result); // Verify the returned key matches the expected one
|
||||
|
||||
@@ -1538,6 +1538,22 @@ public class EscSeqUtilsTests
|
||||
Assert.Equal (expected, actual);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData ('\u001B', KeyCode.Esc)]
|
||||
[InlineData ('\r', KeyCode.Enter)]
|
||||
[InlineData ('1', KeyCode.D1)]
|
||||
[InlineData ('!', (KeyCode)'!')]
|
||||
[InlineData ('a', KeyCode.A)]
|
||||
[InlineData ('A', KeyCode.A | KeyCode.ShiftMask)]
|
||||
public void MapChar_Returns_Modifiers_If_Needed (char ch, KeyCode keyCode)
|
||||
{
|
||||
ConsoleKeyInfo cki = EscSeqUtils.MapChar (ch);
|
||||
Key key = EscSeqUtils.MapKey (cki);
|
||||
Key expectedKey = keyCode;
|
||||
|
||||
Assert.Equal (key, expectedKey);
|
||||
}
|
||||
|
||||
private void ClearAll ()
|
||||
{
|
||||
EscSeqRequests.Clear ();
|
||||
|
||||
Reference in New Issue
Block a user