summaryrefslogtreecommitdiffstats
path: root/src/c_utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/c_utils.c')
-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));
}