Console Extensions
How can you extend your console?
How can you extend your console?
Terminaux not only provides basic console tools to make building your console applications easier, but you can also rely on the extensions provided below to maximize your productivity. Below are the extensions that you can use. Any extension that is not documented can be referred to in the API documentation below:
The ConsoleCursor
class contains extensions that allow you to change the cursor in the terminal, including making the cursor visible or hidden and changing the cursor shape. The following tools are available:
CursorVisible
: Specifies whether the cursor is visible or not.
CursorType
: Specifies the cursor type, like blinking or steady block, underscore, or vertical bar.
ConsoleClearing
provides you with tools to ease clearing the console and resetting its state. You can use the following functions:
ClearLineToRight()
: Allows you to clear the line to the right using the current background color in the current position.
GetClearLineToRightSequence()
: Gets a sequence that clears the line to the right using the current background color in the current position.
ResetAll()
: Resets the entire console.
GetClearWholeScreenSequence()
: Gets a sequence that clears the whole display, including the scrollback buffer.
In the ConsolePositioning
class, you can manipulate with the cursor position in various ways, such as calling the below functions that do different things:
ClearKeepPosition()
: Allows you to clear the console and keep the cursor position.
GetFilteredPositions()
: Allows you to get the filtered positions (X, Y) after filtering the specified text from the VT sequence in the current cursor position by simulating write operation.
The ConsoleFormatting
class provides you with text formatting tools, including making the text bold, italicize it, and more. This affects all text that have been written to the console inside and outside Terminaux. Fortunately, we have two modes:
Dry setting: You'll have to call the function GetFormattingSequences()
in the text sequence that you want to write to any writer. After that, you'll have to reset the formatting by hand.
Non-dry setting: You'll have to call the function SetFormatting()
to affect all text writes. If you want to reset all formatting, you'll have to call ResetFormatting()
.
You can also manipulate with the console characters using the following functions:
GetCharWidth()
EstimateCellWidth()
EstimateZeroWidths()
EstimateFullWidths()
GetCharWidthType()
The following extensions that don't fit in any of the categories can be used in your applications:
SetTitle()
PercentRepeat()
PercentRepeatTargeted()
FilterVTSequences()
GetWrappedSentences()
GetWrappedSentencesByWords()
Truncate()
ShowMainBuffer()
ShowAltBuffer()
IsOnAltBuffer