Aptivi - Manual
ProjectsWebsiteBlog
Terminaux - Manual
Terminaux - Manual
  • Welcome!
  • Breaking changes
    • API v1.0
    • API v2.0
    • API v3.0
    • API v4.0
    • API v5.0
    • API v6.0
    • API v7.0
  • Usage
    • Preface
    • Console Tools
      • Console Checker
        • Console Size Requirements
      • Image Rendering
        • Icons
      • Console Writers
        • Individual Writers
        • Cyclic Writers
          • Geometric Shapes
          • Charts
          • Text
          • Artistic
          • Progress Bars
          • Lists and Calendars
          • Miscellaneous
        • Informational Boxes
      • Textual UI
        • Interactive TUI
        • Console Screen
        • Console Resize Listener
        • VT Sequences
      • Console Wrapper
      • Console Colors
      • Color Templates
      • Presentation System
      • Console Extensions
      • Nerd Fonts
      • Terminal Info
      • Test Fixtures
      • Terminal Structures
      • Console Logging
    • Input Reader
      • Shells
        • Shell Structure
          • Help System
          • Command Parsing
          • Command Information
          • Command Switches
          • Shell Presets
          • Command Aliasing
      • Other Input
        • Keybindings
        • Choice-based inputs
        • Editors and Viewers
        • Figlet Font Selector
        • Color Wheel
        • Spinner Selector
      • Reader State
      • Reader Settings
      • Syntax Highlighting
      • Pointer Events
    • 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

Reader Settings

In case you want to set things up

Last updated 5 months ago

The reader currently has a global settings instance session-wide. However, it can get overridden if you make a new instance of TermReaderSettings with some available properties mentioned below set. They get read each time you call this function or you activate a keybinding that uses one of these settings.

Here are the available settings that you can set:

  • PasswordMaskChar

    • Sets the password masking character.

  • HistoryEnabled

    • Whether the history is enabled or not.

  • HistoryName

    • Select what history to use

  • LeftMargin

    • Sets the left margin of the input.

  • RightMargin

    • Sets the right margin of the input.

  • InputForegroundColor

    • The foreground color for the input text, as well as the input prompt.

  • InputBackgroundColor

    • The background color for the input text, as well as the input prompt.

  • Suggestions

    • Sets a function that you could use to return an array of strings containing auto completion data.

  • SuggestionsDelimiters

    • Delimiters to split the current input within a function that returns a list of suggestions.

  • TreatCtrlCAsInput

    • Whether to treat Ctrl + C as input or not. If enabled, TermRead will process this keybinding as aborting the current input.

  • PlaceholderText

    • This is the text that the terminal reader shows when there is no input text. This is used to give users hints on what they should write to the prompt.

  • PrintDefaultValue

    • Whether to print the default value or not. Disables WriteDefaultValue.

  • WriteDefaultValue

    • Whether to make the default value part of the input or not. Disables PrintDefaultValue.

  • InitialPosition

    • Where to set the initial cursor position for the reader (only works when there is a default value and WriteDefaultValue is on)

  • DefaultValueFormat

    • The default value format to print if PrintDefaultValue is enabled and there is a prompt.

  • KeyboardCues

    • Whether to play keyboard cues for each keypress

  • BassBoomLibraryPath

    • In case of addons or other custom path for MPG123, specifies a root path to BassBoom's libraries. See for more info.

  • PlayWriteCue

    • Specifies whether to play a write cue (that is, plays a sound for each keypress). You can specify your custom write cue using the CueWrite property, but be sure to pass it a stream that contains an MP3 file content that can play.

  • PlayRuboutCue

    • Specifies whether to play a rubout cue (that is, plays a sound for every backspace press). You can specify your custom write cue using the CueRubout property, but be sure to pass it a stream that contains an MP3 file content that can play.

  • PlayEnterCue

    • Specifies whether to play an enter cue (that is, plays a sound for each "submit" key, such as Enter). You can specify your custom write cue using the CueEnter property, but be sure to pass it a stream that contains an MP3 file content that can play.

  • CueVolume

    • Specifies the cue volume in fractional number between 0.0 and 1.0 (or 3.0 with volume boost)

  • CueVolumeBoost

    • Allows the cue volume to go above 1.0 to the maximum of 3.0.

  • Bell

    • Specifies how to launch a console bell (audible for beep sounds, visual for flashing console, or none for nothing)

You can copy the above settings in one line using the overload of the TermReaderSettings constructor that allows you to specify another TermReaderSettings instance to copy the settings from that instance to the new one. This is useful if you want to use the global settings without affecting future reads. This is a simple example of how to copy the global settings and to set the password mask without affecting the global password mask:

// Doesn't affect future reads
var settings = new TermReaderSettings(TermReader.GlobalReaderSettings)
{
    PasswordMaskChar = '#'
};

// Affects future reads
TermReader.GlobalReaderSettings.PasswordMaskChar = '#';
here
BassBoom
BassBoom
BassBoom