diff options
author | salad <fmoenne-@student.le-101.fr> | 2020-12-16 13:46:31 +0100 |
---|---|---|
committer | salad <fmoenne-@student.le-101.fr> | 2020-12-16 13:46:31 +0100 |
commit | b96c18b5a12dc3f581ee0050aa48b2b3d7df26ec (patch) | |
tree | 5871c8a1555aa107a00b6a7e7d98210f263d6e3f /src/c_utils_next.c | |
parent | c_keys_next is now c_utils_next (diff) | |
download | 42-minishell-b96c18b5a12dc3f581ee0050aa48b2b3d7df26ec.tar.gz 42-minishell-b96c18b5a12dc3f581ee0050aa48b2b3d7df26ec.tar.bz2 42-minishell-b96c18b5a12dc3f581ee0050aa48b2b3d7df26ec.tar.xz 42-minishell-b96c18b5a12dc3f581ee0050aa48b2b3d7df26ec.tar.zst 42-minishell-b96c18b5a12dc3f581ee0050aa48b2b3d7df26ec.zip |
check for leaks.......again
Diffstat (limited to 'src/c_utils_next.c')
-rw-r--r-- | src/c_utils_next.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/c_utils_next.c b/src/c_utils_next.c index c57ab1d..27a88db 100644 --- a/src/c_utils_next.c +++ b/src/c_utils_next.c @@ -16,8 +16,18 @@ #include "c_init.h" #include "c_keys.h" +#include "c_utils.h" #include "d_define.h" +short c_set_key(char *buf) +{ + if (((*((unsigned int *)buf)) == UP_K) || + ((*((unsigned int *)buf)) == CTRL_P)) + return (-1); + else + return (1); +} + t_msh *c_get_msh(int mode, t_msh *src) { static t_msh *msh; @@ -29,14 +39,17 @@ t_msh *c_get_msh(int mode, t_msh *src) return (msh); } -void c_key_up_down(char *line[], t_caps *tcaps, char *ptr) +void c_key_up_down(char *line[], t_caps *tcaps, t_msh *msh) { char tmp[ARG_MAX]; + char *ptr; + ptr = c_set_ptr(FALSE, tcaps->key, msh); c_home_key(tcaps->plen, tcaps); ft_substr_s(tmp, ptr, 0, ft_strclen(ptr, '\n')); ft_memdel((void*)&(*line)); tputs(tgetstr("ce", NULL), 1, ft_putchar); *line = ft_strdup(tmp); tcaps->cpos = ft_strlen(*line); + c_redraw_line(*line, tcaps); } |