diff options
Diffstat (limited to 'src/c_utils.c')
-rw-r--r-- | src/c_utils.c | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/src/c_utils.c b/src/c_utils.c index 2b2f8e4..d5a45e0 100644 --- a/src/c_utils.c +++ b/src/c_utils.c @@ -24,10 +24,12 @@ /* ** TODO: -** term(0) on exit -** cursor on char insert DONE ** quotes ** leaks +** C-c +** tests varies +** term(0) on exit DONE +** cursor on char insert DONE */ int16_t @@ -47,13 +49,17 @@ int16_t tcaps->CL[1] = 0; tcaps->CL[2] = 0; tcaps->CL[3] = 0; + tcaps->CC[0] = 3; + tcaps->CC[1] = 0; + tcaps->CC[2] = 0; + tcaps->CC[3] = 0; tcaps->HM[0] = 27; tcaps->HM[1] = 91; tcaps->HM[2] = 72; tcaps->HM[3] = 0; tcaps->ND[0] = 27; tcaps->ND[1] = 91; - tcaps->ND[2] = 70; + tcaps->ND[2] = -103; tcaps->ND[3] = 0; return (1); } @@ -74,6 +80,27 @@ uint16_t return (1); } +int16_t + c_new_line(char *buf, + char **line, + t_msh *msh, + t_caps *tcaps) +{ + write(1, buf, ft_strlen(buf)); + tputs(tgetstr("cr", NULL), 1, ft_putchar); + c_set_term_raw(0); + if (line != NULL) + { + m_parse_and_run_line(*line, msh); + *line = NULL; + } + tcaps->cpos = 0; + tputs(tgetstr("cr", NULL), 1, ft_putchar); + c_set_term_raw(1); + m_prompt_psx(1, msh); + return (1); +} + char *c_insert_char(char *str, char c, |