Fixes #4250. Add a v2unix driver (#4251)

* 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:
BDisp
2025-10-02 15:51:05 +01:00
committed by GitHub
parent 4c6145cee9
commit 9d34e2792c
20 changed files with 700 additions and 63 deletions

View File

@@ -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