Save off command and buffer history, allow for resumption

This commit is contained in:
Aaron Cook 2022-06-10 11:43:29 -05:00
commit 17f268d78a
6 changed files with 93 additions and 50 deletions

View file

@ -11,6 +11,13 @@
/* https://en.wikipedia.org/wiki/Control_character#How_control_characters_map_to_keyboards */
#define CTRL(c) ((c)&31)
typedef struct bytenuts_state_struct {
char **history; /* commands from previous session */
int history_len;
char *buf; /* previous buffer */
size_t buf_len;
} bytenuts_state_t;
typedef struct bytenuts_config_struct {
int colors; /* enable terminal colors, default 1 */
int echo; /* echo user input to the output window, default 0 */
@ -38,6 +45,7 @@ typedef struct bytenuts_struct {
bytenuts_config_t config;
int config_overrides[4];
int resume;
bytenuts_state_t state;
WINDOW *status_win;
WINDOW *out_win;
WINDOW *in_win;