summaryrefslogtreecommitdiffstats
path: root/src/c_utils.c
diff options
context:
space:
mode:
authorSalad <water_appreciator@protonmail.com>2020-10-05 17:37:55 +0200
committerSalad <water_appreciator@protonmail.com>2020-10-05 17:37:55 +0200
commitf5eb08c14ccaa5e7a0e35364668ba28433459f9d (patch)
treee00b36d7c0bc787b41d07e56a3b0e08cbc002939 /src/c_utils.c
parentalmost there : norme + miltiligne (diff)
download42-minishell-f5eb08c14ccaa5e7a0e35364668ba28433459f9d.tar.gz
42-minishell-f5eb08c14ccaa5e7a0e35364668ba28433459f9d.tar.bz2
42-minishell-f5eb08c14ccaa5e7a0e35364668ba28433459f9d.tar.xz
42-minishell-f5eb08c14ccaa5e7a0e35364668ba28433459f9d.tar.zst
42-minishell-f5eb08c14ccaa5e7a0e35364668ba28433459f9d.zip
some changes, need MORE
Diffstat (limited to '')
-rw-r--r--src/c_utils.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/c_utils.c b/src/c_utils.c
index 8a142cf..a62e3f9 100644
--- a/src/c_utils.c
+++ b/src/c_utils.c
@@ -25,17 +25,16 @@
** TODO:
** delchar MOVE
** NORME
+** c_redraw_next TOUJOURS CALL --> DLA MERDE
** C-c globul pid
*/
char
*c_new_line(char *line,
- t_caps *tcaps,
- t_msh *msh)
+ t_caps *tcaps)
{
char *ret;
- (void)msh;
ret = NULL;
write(1, "\n", 1);
tputs(tgetstr("cr", NULL), 1, ft_putchar);
@@ -120,16 +119,18 @@ static int16_t
while (--j > tcaps->lpos)
tputs(tgetstr("up", NULL), 1, ft_putchar);
tputs(tgetstr("up", NULL), 1, ft_putchar);
- tputs(tgetstr("cr", NULL), 1, ft_putchar); /* cr, cpos mauvaise col, bonne ligne */
+ tputs(tgetstr("cr", NULL), 1, ft_putchar);
while (i <= (tcaps->cpos + plen))
{
- tputs(tgetstr("nd", NULL), 1, ft_putchar); /* cr, cpos mauvaise col, bonne ligne */
+ tputs(tgetstr("nd", NULL), 1, ft_putchar);
i++;
}
}
else
while (--len > tcaps->cpos)
+ {
tputs(tgetstr("le", NULL), 1, ft_putchar);
+ }
return (len);
}
@@ -143,13 +144,13 @@ int16_t
tcaps->nlines = c_get_line_num(line, tcaps->cpos,
ft_strlen(msh->ps[tcaps->psx]), tcaps);
- j = tcaps->lpos;
i = 0;
+ j = tcaps->lpos;
tputs(tgetstr("cr", NULL), 1, ft_putchar);
- if (((tcaps->cpos + ft_strlen(msh->ps[tcaps->psx])) % tcaps->ws.ws_col) == 0)
+ if ((((tcaps->cpos - 1) + ft_strlen(msh->ps[tcaps->psx])) %
+ tcaps->ws.ws_col) == 0)
{
tputs(tgetstr("sf", NULL), 1, ft_putchar);
- return (1);
}
while (--j > 0)
{
@@ -160,7 +161,7 @@ int16_t
while (i++ < ft_strlen(msh->ps[tcaps->psx]))
tputs(tgetstr("nd", NULL), 1, ft_putchar);
ft_printf("%s", line);
- return ((tcaps->cpos != ft_strlen(line)) ?
+ return (((tcaps->cpos) != ft_strlen(line)) ?
c_redraw_next(ft_strlen(msh->ps[tcaps->psx]), ft_strlen(line), tcaps) :
ft_strlen(line));
}