diff options
Diffstat (limited to '')
-rw-r--r-- | src/c_utils.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/c_utils.c b/src/c_utils.c index 56cfbaa..724d9d5 100644 --- a/src/c_utils.c +++ b/src/c_utils.c @@ -130,21 +130,26 @@ int16_t { uint32_t i; uint32_t len; + uint32_t mod; int16_t ret; - uint32_t nlines; + int16_t nlines; i = 0; - len = ft_strlen(line); nlines = c_get_line_num(line, tcaps->cpos, ft_strlen(msh->ps[0]), tcaps); + len = ft_strlen(line); + mod = (tcaps->ws.ws_col - ft_strlen(msh->ps[0])); tputs(tgetstr("cr", NULL), 1, ft_putchar); - if (nlines > 1) + if (len >= mod && len % mod == 0) { - ft_printf("qwe"); - /* if (tcaps->lpos > 1) */ - tputs(tgetstr("up", NULL), 1, ft_putchar); - tputs(tgetstr("up", NULL), 1, ft_putchar); tputs(tgetstr("sf", NULL), 1, ft_putchar); + return (1); } + if (nlines > 1) + mod += ft_strlen(msh->ps[0]); + tputs(tgetstr("sf", NULL), 1, ft_putchar); + tputs(tgetstr("up", NULL), 1, ft_putchar); + while (--nlines > 0) + tputs(tgetstr("up", NULL), 1, ft_putchar); while (i < ft_strlen(msh->ps[0])) { tputs(tgetstr("nd", NULL), 1, ft_putchar); @@ -154,5 +159,5 @@ int16_t if (tcaps->cpos != len) while (--len > tcaps->cpos) tputs(tgetstr("le", NULL), 1, ft_putchar); - return (i); + return (ret); } |