diff options
Diffstat (limited to 'src/c_utils.c')
-rw-r--r-- | src/c_utils.c | 17 |
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)); } |