summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsalad <fmoenne-@student.le-101.fr>2020-09-21 16:11:33 +0200
committersalad <fmoenne-@student.le-101.fr>2020-09-21 16:11:33 +0200
commitfd7a2ba757e6382ce377e9f53fcff0c483099caa (patch)
tree6d5235b58ffa7466cb8d54a9573b3f9ef09c169d
parentlets fucking go (diff)
download42-minishell-fd7a2ba757e6382ce377e9f53fcff0c483099caa.tar.gz
42-minishell-fd7a2ba757e6382ce377e9f53fcff0c483099caa.tar.bz2
42-minishell-fd7a2ba757e6382ce377e9f53fcff0c483099caa.tar.xz
42-minishell-fd7a2ba757e6382ce377e9f53fcff0c483099caa.tar.zst
42-minishell-fd7a2ba757e6382ce377e9f53fcff0c483099caa.zip
DEL MULTILIGNEED
-rw-r--r--src/c_init.c2
-rw-r--r--src/c_input.c20
-rw-r--r--src/c_input.h2
-rw-r--r--src/c_keys.c6
-rw-r--r--src/c_utils.c4
5 files changed, 25 insertions, 9 deletions
diff --git a/src/c_init.c b/src/c_init.c
index 8f5a573..16f6cba 100644
--- a/src/c_init.c
+++ b/src/c_init.c
@@ -96,7 +96,7 @@ int16_t
return (c_ctrl_l(line, tcaps, msh));
else if (ft_strncmp(buf, tgetstr("kb", NULL), ft_strlen(tgetstr("kb", NULL))) == 0)
{
- c_back_slash(&line, tcaps);
+ c_back_slash(&line, ft_strlen(msh->ps[0]), tcaps);
return (1);
}
else if (buf[0] == '\n')
diff --git a/src/c_input.c b/src/c_input.c
index be72aa9..37f7b66 100644
--- a/src/c_input.c
+++ b/src/c_input.c
@@ -66,7 +66,7 @@ c_get_line_num(char *line,
it = 0;
line_num = 0;
- tcaps->lpos = 0;
+ tcaps->lpos = 1;
len = ft_strlen(line);
if (len < (tcaps->ws.ws_col - plen))
return (1);
@@ -81,9 +81,23 @@ c_get_line_num(char *line,
int16_t
c_back_slash(char **line,
- t_caps *tcaps)
+ uint32_t plen,
+ t_caps *tcaps)
{
- if (tcaps->cpos >= 1)
+ int32_t pos;
+
+ pos = -1;
+ if (((tcaps->cpos + plen) % (tcaps->ws.ws_col)) == 0
+ && tcaps->cpos >= 1)
+ {
+ *line = c_delchar(*line, tcaps->cpos);
+ tputs(tgetstr("up", NULL), 1, ft_putchar);
+ while(++pos <= (tcaps->ws.ws_col))
+ tputs(tgetstr("nd", NULL), 1, ft_putchar);
+ tputs(tgetstr("dc", NULL), 1, ft_putchar);
+ tcaps->cpos--;
+ }
+ else if (tcaps->cpos >= 1)
{
*line = c_delchar(*line, tcaps->cpos);
tcaps->cpos--;
diff --git a/src/c_input.h b/src/c_input.h
index b529a88..78b35d6 100644
--- a/src/c_input.h
+++ b/src/c_input.h
@@ -13,7 +13,7 @@
#ifndef C_INPUT_H
#define C_INPUT_H
-int16_t c_back_slash(char **line, t_caps *tcaps);
+int16_t c_back_slash(char **line, uint32_t plen, t_caps *tcaps);
int16_t c_ctrl_c(char *line, t_caps *tcaps, t_msh *msh);
uint32_t c_get_line_num(char *line, uint32_t cpos, uint32_t plen, t_caps *tcaps);
diff --git a/src/c_keys.c b/src/c_keys.c
index fc8962e..6496525 100644
--- a/src/c_keys.c
+++ b/src/c_keys.c
@@ -63,7 +63,8 @@ int16_t
uint32_t plen,
t_caps *tcaps)
{
- if (((tcaps->cpos + plen + 1) % (tcaps->ws.ws_col)) == 0 && tcaps->cpos < len)
+ if (((tcaps->cpos + plen + 1) % (tcaps->ws.ws_col)) == 0
+ && tcaps->cpos < len)
{
tputs(tgetstr("do", NULL), 1, ft_putchar);
tputs(tgetstr("cr", NULL), 1, ft_putchar);
@@ -86,7 +87,8 @@ int16_t
(void)len;
pos = -1;
- if (((tcaps->cpos + plen) % (tcaps->ws.ws_col )) == 0 && tcaps->cpos >= 1)
+ if (((tcaps->cpos + plen) % (tcaps->ws.ws_col)) == 0
+ && tcaps->cpos >= 1)
{
tputs(tgetstr("up", NULL), 1, ft_putchar);
while(++pos <= (tcaps->ws.ws_col))
diff --git a/src/c_utils.c b/src/c_utils.c
index 96a9c2b..dc9522d 100644
--- a/src/c_utils.c
+++ b/src/c_utils.c
@@ -24,7 +24,7 @@
/*
** TODO:
-** MULTILIGHNE (reprint correct)
+** REPRINT edit
** FLECHES UP DOWN
** C-c globul pid
** NORME
@@ -132,7 +132,7 @@ int16_t
uint32_t len;
uint32_t mod;
int16_t ret;
- int16_t nlines;
+ uint32_t nlines;
i = 0;
nlines = c_get_line_num(line, tcaps->cpos, ft_strlen(msh->ps[0]), tcaps);