summaryrefslogtreecommitdiffstats
path: root/src/c_utils.c
diff options
context:
space:
mode:
authorSalad <water_appreciator@protonmail.com>2020-10-02 16:55:52 +0200
committerSalad <water_appreciator@protonmail.com>2020-10-02 16:55:52 +0200
commitb6b09fc1fa8e4f70f042cfe48f26b28d798498d3 (patch)
tree22ec864530fc4a0a9e642bdf35c42b2dacc93e95 /src/c_utils.c
parentlessgo (diff)
download42-minishell-b6b09fc1fa8e4f70f042cfe48f26b28d798498d3.tar.gz
42-minishell-b6b09fc1fa8e4f70f042cfe48f26b28d798498d3.tar.bz2
42-minishell-b6b09fc1fa8e4f70f042cfe48f26b28d798498d3.tar.xz
42-minishell-b6b09fc1fa8e4f70f042cfe48f26b28d798498d3.tar.zst
42-minishell-b6b09fc1fa8e4f70f042cfe48f26b28d798498d3.zip
almost there : norme + miltiligne
Diffstat (limited to 'src/c_utils.c')
-rw-r--r--src/c_utils.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/c_utils.c b/src/c_utils.c
index 78b923a..8a142cf 100644
--- a/src/c_utils.c
+++ b/src/c_utils.c
@@ -24,9 +24,7 @@
/*
** TODO:
** delchar MOVE
-** plen opti
** NORME
-** FLECHES UP DOWN
** C-c globul pid
*/
@@ -142,14 +140,13 @@ int16_t
{
uint32_t i;
uint32_t j;
- uint32_t len;
- len = ft_strlen(line);
- tcaps->nlines = c_get_line_num(line, tcaps->cpos, ft_strlen(msh->ps[0]), tcaps);
+ tcaps->nlines = c_get_line_num(line, tcaps->cpos,
+ ft_strlen(msh->ps[tcaps->psx]), tcaps);
j = tcaps->lpos;
i = 0;
tputs(tgetstr("cr", NULL), 1, ft_putchar);
- if (((tcaps->cpos + ft_strlen(msh->ps[0])) % tcaps->ws.ws_col) == 0)
+ if (((tcaps->cpos + ft_strlen(msh->ps[tcaps->psx])) % tcaps->ws.ws_col) == 0)
{
tputs(tgetstr("sf", NULL), 1, ft_putchar);
return (1);
@@ -160,10 +157,10 @@ int16_t
tputs(tgetstr("up", NULL), 1, ft_putchar);
tputs(tgetstr("up", NULL), 1, ft_putchar);
}
- while (i++ < ft_strlen(msh->ps[0]))
+ while (i++ < ft_strlen(msh->ps[tcaps->psx]))
tputs(tgetstr("nd", NULL), 1, ft_putchar);
ft_printf("%s", line);
- if (tcaps->cpos != len)
- return (c_redraw_next(ft_strlen(msh->ps[0]), len, tcaps));
- return (len);
+ return ((tcaps->cpos != ft_strlen(line)) ?
+ c_redraw_next(ft_strlen(msh->ps[tcaps->psx]), ft_strlen(line), tcaps) :
+ ft_strlen(line));
}