Aptivi - Stable Manuals
ProjectsWebsiteBlog
Terminaux 5.x - Manual
Terminaux 5.x - Manual
  • Welcome!
  • Breaking changes
    • API v1.0
    • API v2.0
    • API v3.0
    • API v4.0
    • API v5.0
  • Usage
    • Preface
    • Console Tools
      • Console Checker
        • Console Size Requirements
      • Image Rendering
        • Icons
      • Console Writers
        • Informational Boxes
      • Console Wrapper
      • Console Colors
      • Color Templates
      • Console Screen
      • Console Resize Listener
      • Presentation System
      • VT Sequences
      • Console Extensions
      • Interactive TUI
      • Geometric Shapes
      • Nerd Fonts
      • Terminal Info
      • Wide Characters
    • Input Reader
      • Custom Bindings
      • Reader State
      • Reader Settings
      • Syntax Highlighting
      • Pointer Events
      • Other Input
        • Keybindings
        • Choice-based inputs
        • Editors and Viewers
        • Figlet Font Selector
        • Color Wheel
    • Color Sequences
      • Color Model Conversions
      • Color Model Parsing
      • Interop with System.Drawing.Color
  • Report an issue
  • Source code
  • API Reference
Powered by GitBook
On this page
Edit on GitHub
  1. Usage
  2. Input Reader
  3. Other Input

Keybindings

Press any key!

Individual keybindings are defined using the Keybinding class found in the Terminaux.Writers.MiscWriters.Tools namespace. They define what key or key combination, whether it's a mouse or a keyboard event, corresponds to what action that is described using text. You can define them using one of the following constructors:

  • Console key without any modifiers

    • string bindingName, ConsoleKey bindingKeyName

  • Console key with modifiers

    • string bindingName, ConsoleKey bindingKeyName, ConsoleModifiers bindingKeyModifiers

  • Mouse pointer button without button press state and modifier

    • string bindingName, PointerButton bindingPointerButton

  • Mouse pointer button with button press state, but without modifier

    • string bindingName, PointerButton bindingPointerButton, PointerButtonPress bindingPointerButtonPress

  • Mouse pointer button with button press state and modifier

    • string bindingName, PointerButton bindingPointerButton, PointerButtonPress bindingPointerButtonPress, PointerModifiers bindingButtonModifiers

These keybindings have no action, as it's mostly for informational purposes, but you can also use it to define keybindings with the appropriate actions. However, a user might want to know what are the available keybindings in your interactive applications. We've implemented the KeybindingsWriter that contains the following functions:

  • One-line keybindings list

    • WriteKeybindings()

    • RenderKeybindings()

  • Keybindings list in an infobox

    • ShowKeybindingInfoboxPlain()

    • ShowKeybindingInfobox()

    • ShowKeybindingInfoboxColor()

    • ShowKeybindingInfoboxColorBack()

    • RenderKeybindingHelpText()

The Render function variant returns a string that you can either write to the terminal or add as part of the screen buffer if you're planning to write a complex application.