summaryrefslogtreecommitdiffstats
path: root/src/c_input.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/c_input.c109
1 files changed, 39 insertions, 70 deletions
diff --git a/src/c_input.c b/src/c_input.c
index 478c29e..5e9db72 100644
--- a/src/c_input.c
+++ b/src/c_input.c
@@ -11,7 +11,6 @@
/* ************************************************************************** */
#include <libft.h>
-#include <unistd.h>
#include <term.h>
#include "c_init.h"
@@ -21,6 +20,41 @@
#include "m_loop.h"
int16_t
+ c_init_keys(t_caps *tcaps)
+{
+ if (tcaps)
+ {
+ tcaps->KL[0] = 27;
+ tcaps->KL[1] = 91;
+ tcaps->KL[2] = 68;
+ tcaps->KL[3] = 0;
+ tcaps->KR[0] = 27;
+ tcaps->KR[1] = 91;
+ tcaps->KR[2] = 67;
+ tcaps->KR[3] = 0;
+ tcaps->CL[0] = 12;
+ tcaps->CL[1] = 0;
+ tcaps->CL[2] = 0;
+ tcaps->CL[3] = 0;
+ tcaps->CC[0] = 3;
+ tcaps->CC[1] = 0;
+ tcaps->CC[2] = 0;
+ tcaps->CC[3] = 0;
+ tcaps->HM[0] = 27;
+ tcaps->HM[1] = 91;
+ tcaps->HM[2] = 72;
+ tcaps->HM[3] = 0;
+ tcaps->ND[0] = 27;
+ tcaps->ND[1] = 91;
+ tcaps->ND[2] = -103;
+ tcaps->ND[3] = 0;
+ return (1);
+ }
+ else
+ return (-1);
+}
+
+int16_t
c_back_slash(char **line,
t_caps *tcaps)
{
@@ -35,78 +69,13 @@ int16_t
}
int16_t
- c_ctrl_l(char *line,
- t_caps *tcaps,
- t_msh *msh)
-{
- tputs(tgetstr("cl", NULL), 1, ft_putchar);
- m_prompt_psx(1, msh);
- c_redraw_line(line, tcaps, msh);
- return (1);
-}
-
-int16_t
c_ctrl_c(char *line,
t_caps *tcaps,
t_msh *msh)
{
- tputs(tgetstr("cl", NULL), 1, ft_putchar);
- m_prompt_psx(1, msh);
- c_redraw_line(line, tcaps, msh);
- return (1);
-}
-
-int16_t
- c_home_key(t_caps *tcaps)
-{
- uint16_t i;
-
- i = tcaps->cpos;
- while (i > 0)
- {
- tputs(tgetstr("le", NULL), 1, ft_putchar);
- i--;
- }
- tcaps->cpos = 0;
- return (1);
-}
-
-int16_t
- c_end_key(uint16_t size, t_caps *tcaps)
-{
- uint16_t i;
-
- i = tcaps->cpos;
- while (i < size)
- {
- tputs(tgetstr("nd", NULL), 1, ft_putchar);
- i++;
- }
- tcaps->cpos = size;
- return (1);
-}
-
-int16_t
- c_key_right(uint32_t len,
- t_caps *tcaps)
-{
- if (tcaps->cpos < len)
- {
- tputs(tgetstr("nd", NULL), 1, ft_putchar);
- tcaps->cpos++;
- }
- return (1);
-}
-
-int16_t
- c_key_left(uint32_t len,
- t_caps *tcaps)
-{
- (void)len;
- if (tcaps->cpos >= 1)
- {
- tputs(tgetstr("le", NULL), 1, ft_putchar);
- tcaps->cpos--;
- }
+ (void)tcaps;
+ (void)line;
+ msh->ret = 130;
+ c_new_line(NULL, msh, tcaps);
return (1);
}