diff options
Diffstat (limited to 'src/c_init.c')
-rw-r--r-- | src/c_init.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/c_init.c b/src/c_init.c index ad18d92..effcc7d 100644 --- a/src/c_init.c +++ b/src/c_init.c @@ -21,6 +21,7 @@ #include "c_input.h" #include "c_utils.h" #include "s_struct.h" +#include "m_prompt.h" static char *ft_strjoin_m(char *s1, @@ -84,6 +85,8 @@ int16_t return (1); } +/* c_insert_char */ + int16_t c_process_key(char *buf, t_caps *tcaps, @@ -98,7 +101,10 @@ int16_t return (0); if (ft_isprint(buf[0])) { - line = ft_strjoin_m(line, buf); + if (tcaps->cpos == ft_strlen(line)) + line = ft_strjoin_m(line, buf); + else + line = c_insert_char(line, buf[0], tcaps); c_redraw_line(line, tcaps->cpos, msh); tcaps->cpos++; } @@ -140,6 +146,7 @@ int16_t tcaps.cpos = 0; c_set_term_raw(1); c_get_struct(1, &tcaps); + m_prompt_psx(1, msh); if (!(c_get_win_size(&tcaps.ws))) return (-1); while (1) |