ConsoleForge 0.3.0
Elm-architecture TUI framework for .NET 8
Loading...
Searching...
No Matches
ConsoleForge.Core.KeyPattern(ConsoleKey Key, bool? Shift=null, bool? Alt=null, bool? Ctrl=null) Struct Reference

Pattern for matching keyboard events. More...

Public Member Functions

bool Matches (KeyMsg msg)
 Returns true if msg matches this pattern.

Static Public Member Functions

static KeyPattern Of (ConsoleKey key)
 Match the key with any modifier combination.
static KeyPattern Plain (ConsoleKey key)
 Match the key with no modifiers pressed.
static KeyPattern WithAlt (ConsoleKey key)
 Match Alt + key (Shift and Ctrl are wildcards).
static KeyPattern WithCtrl (ConsoleKey key)
 Match Ctrl + key (Shift and Alt are wildcards).
static KeyPattern WithShift (ConsoleKey key)
 Match Shift + key (Alt and Ctrl are wildcards).

Detailed Description

Pattern for matching keyboard events.

Null modifier fields act as wildcards (match regardless of that modifier's state).

KeyPattern.Of(ConsoleKey.Q) // Q, any modifiers
KeyPattern.WithCtrl(ConsoleKey.S) // Ctrl+S
new KeyPattern(ConsoleKey.Tab, Shift: true) // Shift+Tab
Pattern for matching keyboard events.
Definition KeyPattern.cs:19
static KeyPattern WithCtrl(ConsoleKey key)
Match Ctrl + key (Shift and Alt are wildcards).
Definition KeyPattern.cs:33
static KeyPattern Of(ConsoleKey key)
Match the key with any modifier combination.
Definition KeyPattern.cs:30

The documentation for this struct was generated from the following file:
  • src/ConsoleForge/Core/KeyPattern.cs