added basic heredoc function

Some things are broken:
navigation in multiline inputs
history buffer for multiline inputs
some things not been noticed yet
This commit is contained in:
prozessorkern
2019-07-29 01:30:16 +02:00
parent fc8a34dd1c
commit 280e512746
4 changed files with 126 additions and 44 deletions

View File

@@ -91,6 +91,7 @@ typedef struct
char *buffer; /**< input buffer */
uint32_t bufferSize; /**< size of the input buffer */
uint32_t inputCount; /**< offset of the current write operation */
uint32_t lastNewlineIdx; /**< index of the lest newline */
uint32_t cursor; /**< offset where the cursor is at */
char *historyBuffer; /**< buffer to store the last commands */
uint32_t historyBufferSize; /**< size of the history buffer */
@@ -100,7 +101,9 @@ typedef struct
bool historyReadUp; /**< flag to show the last history dir */
uint32_t tabCounter; /**< counts the tabulator key presses */
uint32_t escapeCounter; /**< counts the characters of an escape seq */
char escapeChars[4]; /**< buffer to save the escape characters */
char escapeChars[4u]; /**< buffer to save the escape characters */
char hereDelimiter[16u]; /**< heredoc delimiter */
uint32_t hereLength; /**< length of the heredoc delimiter */
bool echoEnabled; /**< if true the input is printed */
bool dirty; /**< dirty flag to show changes */
const char *prompt; /**< prompt is printed after every command */