summaryrefslogtreecommitdiffstats
path: root/src/c_init.c
diff options
context:
space:
mode:
authorsalad <fmoenne-@student.le-101.fr>2020-09-18 14:51:08 +0200
committersalad <fmoenne-@student.le-101.fr>2020-09-18 14:51:08 +0200
commit3ab54c00fd08f02f246488629442866c8eb604b1 (patch)
treeab4bca754ad2220ef2f704d6dc9f721606dc9b33 /src/c_init.c
parentnorm, new file, ctrl + c (diff)
download42-minishell-3ab54c00fd08f02f246488629442866c8eb604b1.tar.gz
42-minishell-3ab54c00fd08f02f246488629442866c8eb604b1.tar.bz2
42-minishell-3ab54c00fd08f02f246488629442866c8eb604b1.tar.xz
42-minishell-3ab54c00fd08f02f246488629442866c8eb604b1.tar.zst
42-minishell-3ab54c00fd08f02f246488629442866c8eb604b1.zip
full bugged, mais full features
Diffstat (limited to 'src/c_init.c')
-rw-r--r--src/c_init.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/c_init.c b/src/c_init.c
index 8870b27..a196708 100644
--- a/src/c_init.c
+++ b/src/c_init.c
@@ -14,6 +14,7 @@
#include <stdlib.h>
#include <term.h>
#include <libft.h>
+#include <signal.h>
#include "c_init.h"
#include "c_input.h"
@@ -82,9 +83,9 @@ int16_t
else
{
if (ft_strncmp(buf, tcaps->KL, 4) == 0)
- return (c_key_left(ft_strlen(line), tcaps));
+ return (c_key_left(ft_strlen(line), ft_strlen(msh->ps[0]), tcaps));
else if (ft_strncmp(buf, tcaps->KR, 4) == 0)
- return (c_key_right(ft_strlen(line), tcaps));
+ return (c_key_right(ft_strlen(line), ft_strlen(msh->ps[0]), tcaps));
else if (ft_strncmp(buf, tcaps->HM, 4) == 0)
return (c_home_key(tcaps));
else if (ft_strncmp(buf, tcaps->ND, 4) == 0)
@@ -94,7 +95,11 @@ int16_t
else if (ft_strncmp(buf, tcaps->CL, 4) == 0)
return (c_ctrl_l(line, tcaps, msh));
else if (ft_strncmp(buf, tgetstr("kb", NULL), ft_strlen(tgetstr("kb", NULL))) == 0)
- return (c_back_slash(&line, tcaps));
+ {
+ c_back_slash(&line, tcaps);
+ c_redraw_line(line, tcaps, msh);
+ return (1);
+ }
else if (buf[0] == '\n')
{
c_new_line(ft_strdup(line), msh, tcaps);
@@ -123,6 +128,7 @@ int16_t
c_get_struct(1, &tcaps);
c_init_keys(&tcaps);
m_prompt_psx(1, msh);
+ signal(SIGINT, SIG_IGN);
if (!(c_get_win_size(&tcaps.ws)))
return (-1);
while (1)