summaryrefslogtreecommitdiffstats
path: root/src/c_keys.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_keys.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 '')
-rw-r--r--src/c_keys.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/c_keys.c b/src/c_keys.c
index d388d60..7874932 100644
--- a/src/c_keys.c
+++ b/src/c_keys.c
@@ -60,9 +60,16 @@ int16_t
int16_t
c_key_right(uint32_t len,
+ uint32_t plen,
t_caps *tcaps)
{
- if (tcaps->cpos < len)
+ if (((tcaps->cpos + 1) % (tcaps->ws.ws_col - plen)) == 0 && tcaps->cpos < len)
+ {
+ tputs(tgetstr("do", NULL), 1, ft_putchar);
+ tputs(tgetstr("cr", NULL), 1, ft_putchar);
+ tcaps->cpos++;
+ }
+ else if (tcaps->cpos < len)
{
tputs(tgetstr("nd", NULL), 1, ft_putchar);
tcaps->cpos++;
@@ -72,9 +79,20 @@ int16_t
int16_t
c_key_left(uint32_t len,
+ uint32_t plen,
t_caps *tcaps)
{
+ int32_t pos;
(void)len;
+
+ pos = -1;
+ if (((tcaps->cpos) % (tcaps->ws.ws_col - plen)) == 0 && tcaps->cpos >= 1)
+ {
+ tputs(tgetstr("up", NULL), 1, ft_putchar);
+ while(++pos <= (tcaps->ws.ws_col))
+ tputs(tgetstr("nd", NULL), 1, ft_putchar);
+ tcaps->cpos--;
+ }
if (tcaps->cpos >= 1)
{
tputs(tgetstr("le", NULL), 1, ft_putchar);