summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorjoe <rbousset@42lyon.fr>2020-11-30 18:21:47 +0100
committerjoe <rbousset@42lyon.fr>2020-11-30 18:21:47 +0100
commit9deb36310009688683e064fe1a2021ba70eed23c (patch)
treec3f5748b54644eb12c079465010c7227ca2860e6 /src
parentIn progress (diff)
download42-minishell-9deb36310009688683e064fe1a2021ba70eed23c.tar.gz
42-minishell-9deb36310009688683e064fe1a2021ba70eed23c.tar.bz2
42-minishell-9deb36310009688683e064fe1a2021ba70eed23c.tar.xz
42-minishell-9deb36310009688683e064fe1a2021ba70eed23c.tar.zst
42-minishell-9deb36310009688683e064fe1a2021ba70eed23c.zip
Hey at least I tried
Diffstat (limited to 'src')
-rw-r--r--src/c_init.c3
-rw-r--r--src/c_keys.c1
-rw-r--r--src/c_keys_next.c25
-rw-r--r--src/c_keys_next.h20
4 files changed, 48 insertions, 1 deletions
diff --git a/src/c_init.c b/src/c_init.c
index 5e09031..84f91db 100644
--- a/src/c_init.c
+++ b/src/c_init.c
@@ -20,6 +20,7 @@
#include "c_ctrls.h"
#include "c_init.h"
#include "c_keys.h"
+#include "c_keys_next.h"
#include "c_input.h"
#include "c_utils.h"
#include "b_exit.h"
@@ -90,7 +91,7 @@ static short
return (c_ctrl_l(line, tcaps, msh));
else if (((*((unsigned int *)buf)) == UP_K) ||
((*((unsigned int *)buf)) == CTRL_P))
- return (ft_dprintf(0, "qweqwe\n"));
+ return (c_key_up(tcaps));
else if ((*((unsigned int *)buf)) == CTRL_D &&
line[0] == '\0')
{
diff --git a/src/c_keys.c b/src/c_keys.c
index 3d80327..6391631 100644
--- a/src/c_keys.c
+++ b/src/c_keys.c
@@ -70,6 +70,7 @@ short
while (i++ < size)
tputs(tgetstr("nd", NULL), 1, ft_putchar);
tcaps->cpos = size;
+ ft_printf("%d\n", tcaps->cpos);
tcaps->lpos = tcaps->nlines;
return (1);
}
diff --git a/src/c_keys_next.c b/src/c_keys_next.c
new file mode 100644
index 0000000..68b2a3a
--- /dev/null
+++ b/src/c_keys_next.c
@@ -0,0 +1,25 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* c_keys_next.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/02/14 17:19:27 by rbousset #+# #+# */
+/* Updated: 2020/02/14 17:19:29 by rbousset ### ########lyon.fr */
+/* */
+/* ************************************************************************** */
+
+#include <libft.h>
+#include <term.h>
+
+#include "c_init.h"
+
+short c_key_up(t_caps *tcaps)
+{
+ tputs("qwe", 1, ft_putchar);
+ tcaps->cpos = 3;
+ tcaps->lpos = 1;
+ /* ft_dprintf(0, "qwe"); */
+ return (1);
+}
diff --git a/src/c_keys_next.h b/src/c_keys_next.h
new file mode 100644
index 0000000..f71ff5c
--- /dev/null
+++ b/src/c_keys_next.h
@@ -0,0 +1,20 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* c_keys_next.h :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/02/14 17:19:27 by rbousset #+# #+# */
+/* Updated: 2020/02/14 17:19:29 by rbousset ### ########lyon.fr */
+/* */
+/* ************************************************************************** */
+
+#ifndef C_KEYS_NEXT_H
+# define C_KEYS_NEXT_H
+
+#include "c_init.h"
+
+short c_key_up(t_caps *tcaps);
+
+#endif