Skip to content

Hex1b.Input ​

Assembly: Hex1b.dll

Classes ​

CharacterBinding ​

Represents a binding that matches text input based on a predicate. Used for handling arbitrary printable text input in widgets like TextBox. Supports both single characters and multi-char sequences like emojis.

csharp
public sealed class CharacterBinding

CharacterStepBuilder ​

Fluent builder for constructing character/text bindings.

csharp
public sealed class CharacterStepBuilder

ChordTrie ​

A trie (prefix tree) for efficient chord lookup. Each node represents a key step; leaf nodes contain actions.

csharp
public sealed class ChordTrie

DragBinding ​

A binding that initiates a drag operation on mouse down. The factory is called at drag start and returns a DragHandler that receives subsequent events.

csharp
public sealed class DragBinding

DragHandler ​

A handler for drag operations, returned by a drag binding's factory. Receives move and end events for the duration of the drag.

csharp
public sealed class DragHandler

DragStepBuilder ​

Fluent builder for constructing a drag binding.

csharp
public sealed class DragStepBuilder

FocusRing ​

Maintains a flat ring of all focusable nodes from the current render. Built after each render by traversing GetFocusableNodes() on the root. Provides efficient navigation between focusables regardless of tree structure. Also tracks which node (if any) has captured all input.

csharp
public sealed class FocusRing

Hex1bEvent ​

Base class for all Hex1b events. Events are categorized into:

  • Keyboard events: Routed to focused node via InputRouter
  • System events: Handled by app (resize, etc.)
  • Terminal events: Handled by app for terminal capability detection
csharp
public abstract record Hex1bEvent : IEquatable<Hex1bEvent>

Hex1bKeyEvent ​

A keyboard input event that gets routed to the focused node.

csharp
public sealed record Hex1bKeyEvent : Hex1bEvent, IEquatable<Hex1bEvent>, IEquatable<Hex1bKeyEvent>

Hex1bMouseEvent ​

A mouse input event.

csharp
public sealed record Hex1bMouseEvent : Hex1bEvent, IEquatable<Hex1bEvent>, IEquatable<Hex1bMouseEvent>

Hex1bPasteEvent ​

Event emitted when a bracketed paste sequence (ESC[200~ ... ESC[201~) is detected. The context provides streaming access to the paste data.

csharp
public sealed record Hex1bPasteEvent : Hex1bEvent, IEquatable<Hex1bEvent>, IEquatable<Hex1bPasteEvent>

Hex1bResizeEvent ​

A terminal resize event. Handled by the app to trigger re-layout.

csharp
public sealed record Hex1bResizeEvent : Hex1bEvent, IEquatable<Hex1bEvent>, IEquatable<Hex1bResizeEvent>

Hex1bTerminalEvent ​

A terminal capability response event (e.g., DA1 response for Sixel detection). Handled by the app to update terminal capabilities.

csharp
public sealed record Hex1bTerminalEvent : Hex1bEvent, IEquatable<Hex1bEvent>, IEquatable<Hex1bTerminalEvent>

InputBinding ​

Represents a key binding that matches a sequence of key steps and executes an action. Supports both single-key bindings and multi-step chords.

csharp
public sealed class InputBinding

InputBindingActionContext ​

Context passed to input binding action handlers and widget event handlers. Provides app-level services for focus navigation, cancellation, and other common operations.

csharp
public sealed class InputBindingActionContext

InputBindingsBuilder ​

Fluent builder for constructing input bindings for a widget. Pre-populated with widget defaults, allowing inspection and modification.

csharp
public sealed class InputBindingsBuilder

InputResultExtensions ​

Extension methods for InputResult.

csharp
public static class InputResultExtensions

InputRouter ​

Routes input through the node tree to the focused node using layered chord tries.

csharp
public static class InputRouter

InputRouterState ​

Holds the chord state for an input router instance. Each Hex1bApp has its own state, ensuring test isolation and multi-app support.

csharp
public sealed class InputRouterState

KeyMapper ​

Maps between System.ConsoleKey and Hex1bKey. This centralizes the dependency on System.Console types.

csharp
public static class KeyMapper

KeyStepBuilder ​

Fluent builder for constructing key steps in an input binding. Supports chaining modifiers, keys, and multi-step chords.

csharp
public sealed class KeyStepBuilder

MouseBinding ​

A binding that triggers an action on a mouse event.

csharp
public sealed class MouseBinding

MouseParser ​

Parses mouse escape sequences from the terminal. Supports SGR extended mouse mode (\e[<...M/m) which is the most portable.

csharp
public static class MouseParser

MouseStepBuilder ​

Fluent builder for constructing a mouse binding.

csharp
public sealed class MouseStepBuilder

PasteContext ​

Provides streaming access to bracketed paste data. Created when a paste start marker (ESC[200~) is detected, data is written as it arrives, and completed when the end marker (ESC[201~) is received.

csharp
public sealed class PasteContext : IAsyncDisposable

Structs ​

ActionId ​

A strongly typed identifier for a rebindable action. Used to tag keybindings so they can be referenced by action rather than by key.

csharp
public readonly record struct ActionId : IEquatable<ActionId>

ChordLookupResult ​

Result of looking up a key step in a chord trie.

csharp
public readonly struct ChordLookupResult

KeyStep ​

Represents a single key press with modifiers in a key binding sequence.

csharp
public readonly record struct KeyStep : IEquatable<KeyStep>

Enums ​

Hex1bKey ​

Platform-independent key identifiers for Hex1b input handling. This abstraction removes the dependency on System.ConsoleKey.

csharp
public enum Hex1bKey

Hex1bModifiers ​

Modifier keys for input events.

csharp
[Flags]
public enum Hex1bModifiers

InputResult ​

The result of input handling, indicating whether the input was consumed.

csharp
public enum InputResult

MouseAction ​

The type of mouse action.

csharp
public enum MouseAction

MouseButton ​

The type of mouse button involved in a mouse event.

csharp
public enum MouseButton

Released under the MIT License.