File wsh_shell_io.c
FileList > src > wsh_shell_io.c
Go to the source code of this file
#include "wsh_shell_io.h"
Public Static Attributes
| Type | Name |
|---|---|
| const WshShell_Char_t * | WshShellIO_InsertStringTemplate = /* multi line expression */ |
Public Functions
| Type | Name |
|---|---|
| void | WshShellIO_ClearInterBuff (WshShellIO_CommandLine_t * pCommandLine) Clears the interaction buffer. |
| void | WshShellIO_InsertSymbol (WshShellIO_CommandLine_t * pCommandLine, WshShell_Char_t ch, WshShell_Bool_t starsOrChars) Inserts a symbol at the current cursor position in the input buffer. |
| void | WshShellIO_PrintInterBuff (WshShellIO_CommandLine_t * pCommandLine) Prints the current interaction buffer to the terminal. |
| void | WshShellIO_RefreshConsoleFromInterBuff (WshShellIO_CommandLine_t * pCommandLine) Refreshes the terminal display using the interaction buffer. |
| void | WshShellIO_RemoveLeftSymbol (WshShellIO_CommandLine_t * pCommandLine) Removes the symbol to the left of the cursor in the input buffer. |
| void | WshShellIO_WriteToInterBuff (WshShellIO_CommandLine_t * pCommandLine, WshShell_Char_t symbol) Writes a character into the interaction buffer at the cursor position. |
Public Static Attributes Documentation
variable WshShellIO_InsertStringTemplate
Public Functions Documentation
function WshShellIO_ClearInterBuff
Clears the interaction buffer.
Resets buffer contents, cursor position, and line length.
Parameters:
pCommandLinePointer to the interaction buffer.
function WshShellIO_InsertSymbol
Inserts a symbol at the current cursor position in the input buffer.
This function handles character insertion into the interaction buffer:
* If the cursor is in the middle of the line (not at the end), it shifts existing characters to the right to make space for the new symbol.
* The character is then written into the buffer at the cursor position using WshShellIO_WriteToInterBuff.
* The terminal is updated to reflect the insertion, printing either the actual symbol or an asterisk (*) if starsOrChars is true (used for password masking).
Cursor position and buffer length are updated internally. Asserts that pCommandLine is valid and that CursorPos >= 1 before printing.
Parameters:
pCommandLinePointer to the interaction buffer.chThe symbol to insert.starsOrCharsIf true, prints*instead of the actual character.
function WshShellIO_PrintInterBuff
Prints the current interaction buffer to the terminal.
Parameters:
pCommandLinePointer to the interaction buffer.
function WshShellIO_RefreshConsoleFromInterBuff
Refreshes the terminal display using the interaction buffer.
Clears the current line and reprints buffer contents.
Parameters:
pCommandLinePointer to the interaction buffer.
function WshShellIO_RemoveLeftSymbol
Removes the symbol to the left of the cursor in the input buffer.
This function handles backspace-like behavior: * If the cursor is not at the beginning of the line, it removes the symbol to the left of the cursor, shifts the rest of the line left, and updates both the buffer and terminal display. * If the cursor is beyond the line length (unexpected), only moves the cursor one position left.
Also updates the internal buffer length and uses ANSI escape sequences to visually update the terminal.
Parameters:
pCommandLinePointer to the interaction buffer.
function WshShellIO_WriteToInterBuff
Writes a character into the interaction buffer at the cursor position.
Increments cursor and line length accordingly.
Parameters:
pCommandLinePointer to the interaction buffer.symbolCharacter to write.
The documentation for this class was generated from the following file src/wsh_shell_io.c