From b6806c73f4ae94dd76ad7a51ad25255b3493e9c9 Mon Sep 17 00:00:00 2001 From: salad Date: Mon, 14 Sep 2020 15:59:30 +0200 Subject: quelques additions --- src/c_init.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/c_init.c') diff --git a/src/c_init.c b/src/c_init.c index ee6782d..2bc0be3 100644 --- a/src/c_init.c +++ b/src/c_init.c @@ -10,12 +10,12 @@ /* */ /* ************************************************************************** */ - #include #include #include #include #include +#include #include #include "c_init.h" @@ -71,15 +71,17 @@ int16_t i = -1; if (line == NULL) - if (!(line = ft_calloc(2, sizeof(char)))) - return (0); + { + if (!(line = ft_calloc(1, sizeof(char)))) + return (-1); + } if (ft_isprint(buf[0])) { if (tcaps->cpos == ft_strlen(line)) line = ft_strjoin(line, buf); else line = c_insert_char(line, buf[0], tcaps); - c_redraw_line(line, tcaps->cpos, msh); + c_redraw_line(line, tcaps, msh); tcaps->cpos++; } else @@ -116,6 +118,8 @@ int16_t { return (c_new_line(buf, &line, msh, tcaps)); } + else + return (0); } return (0); } -- cgit v1.2.3