summaryrefslogtreecommitdiffstats
path: root/src/c_init.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/c_init.c')
-rw-r--r--src/c_init.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/c_init.c b/src/c_init.c
index 7a1509c..358f145 100644
--- a/src/c_init.c
+++ b/src/c_init.c
@@ -58,7 +58,7 @@ short
}
static void
- c_add_char(char **line, char *buf, t_caps *tcaps, t_msh *msh)
+ c_add_char(char **line, char *buf, t_caps *tcaps)
{
*line = c_insert_char(*line, buf[0], tcaps);
tcaps->cpos++;
@@ -68,7 +68,7 @@ static void
write(STDOUT_FILENO, "\n\r", 2);
return ;
}
- c_redraw_line(*line, tcaps, msh);
+ c_redraw_line(*line, tcaps);
}
static short
@@ -166,23 +166,26 @@ static char
char *ptr;
if (line == NULL)
- if (!(line = ft_calloc(1, sizeof(char))))
+ {
+ ft_printf("\r\nline is NULL\r\n");
+ if (!(line = calloc(1, sizeof(char))))
return (NULL);
+ }
if (ft_isprint(buf[0]))
- c_add_char(&line, buf, tcaps, msh);
+ c_add_char(&line, buf, tcaps);
else if (((*((unsigned int *)buf)) == UP_K) ||
((*((unsigned int *)buf)) == CTRL_P))
{
ptr = c_set_ptr(FALSE, -1, msh);
c_key_up_down(&line, tcaps, ptr);
- c_redraw_line(line, tcaps, msh);
+ c_redraw_line(line, tcaps);
}
else if (((*((unsigned int *)buf)) == DOWN_K) ||
((*((unsigned int *)buf)) == CTRL_N))
{
ptr = c_set_ptr(FALSE, 1, msh);
c_key_up_down(&line, tcaps, ptr);
- c_redraw_line(line, tcaps, msh);
+ c_redraw_line(line, tcaps);
}
else if ((*((unsigned int *)buf)) == DEL_K)
{
@@ -192,7 +195,7 @@ static char
{
return (NULL);
}
- c_redraw_line(line, tcaps, msh);
+ c_redraw_line(line, tcaps);
}
else if ((*((unsigned int *)buf)) == CTRL_C)
return (c_ctrl_c(&line, buf, msh));
@@ -224,5 +227,6 @@ short
*line = c_process_key(nread, &tcaps, msh);
tputs(tgetstr("ve", NULL), 1, ft_putchar);
}
+ ft_printf("[%s]\n", *line);
return (1);
}