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.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/c_init.c b/src/c_init.c
index 18482c1..8974007 100644
--- a/src/c_init.c
+++ b/src/c_init.c
@@ -9,8 +9,6 @@
/* Updated: 2020/02/14 17:19:29 by rbousset ### ########lyon.fr */
/* */
/* ************************************************************************** */
-# define FT_KEY_LEFT (char[4]){ 27, 91, 68, 0 }
-# define FT_KEY_RIGHT (char[4]){ 27, 91, 67, 0 }
#include <unistd.h>
@@ -113,24 +111,26 @@ int16_t
}
else
{
- /* if (strncmp(buf, tgetstr("kr", NULL), ft_strlen(tgetstr("kr", NULL))) == 0) */
- /* if ((*((unsigned int*)buf)) == FT_KEY_RIGHT) */
- if (strncmp(buf, FT_KEY_LEFT, 4) == 0)
+ if (strncmp(buf, tcaps->KL, 4) == 0)
{
return (c_key_left(ft_strlen(line), tcaps));
}
- else if (buf[0] == '\n')
+ else if (strncmp(buf, tcaps->KR, 4) == 0)
{
- return (c_new_line(buf, &line, msh, tcaps));
+ return (c_key_right(ft_strlen(line), tcaps));
}
- else if (strncmp(buf, tgetstr("kl", NULL), ft_strlen(tgetstr("kl", NULL))) == 0)
+ else if (strncmp(buf, tcaps->CL, ft_strlen(tgetstr("kb", NULL))) == 0)
{
- return (c_key_left(ft_strlen(line), tcaps));
+ return (c_ctrl_l(line, tcaps, msh));
}
else if (strncmp(buf, tgetstr("kb", NULL), ft_strlen(tgetstr("kb", NULL))) == 0)
{
return (c_back_slash(&line, tcaps));
}
+ else if (buf[0] == '\n')
+ {
+ return (c_new_line(buf, &line, msh, tcaps));
+ }
}
return (0);
}
@@ -151,6 +151,7 @@ int16_t
tcaps.cpos = 0;
c_set_term_raw(1);
c_get_struct(1, &tcaps);
+ c_init_keys(&tcaps);
m_prompt_psx(1, msh);
if (!(c_get_win_size(&tcaps.ws)))
return (-1);