From 1515de15c6a91d7363086b10799068b6f291a147 Mon Sep 17 00:00:00 2001 From: salad Date: Mon, 21 Sep 2020 14:49:28 +0200 Subject: FINALLY --- src/c_utils.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/c_utils.c b/src/c_utils.c index 724d9d5..2cff50f 100644 --- a/src/c_utils.c +++ b/src/c_utils.c @@ -137,25 +137,28 @@ int16_t i = 0; 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])); + mod = (tcaps->ws.ws_col); + /* mod -= (nlines > 1) ? 0 : ; */ + /* ft_printf("[%u]", mod); */ tputs(tgetstr("cr", NULL), 1, ft_putchar); - if (len >= mod && len % mod == 0) + if (((len + ft_strlen(msh->ps[0])) % mod) == 0) { + ft_printf("qwe"); 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("sf", NULL), 1, ft_putchar); tputs(tgetstr("up", NULL), 1, ft_putchar); + tputs(tgetstr("up", NULL), 1, ft_putchar); + } while (i < ft_strlen(msh->ps[0])) { tputs(tgetstr("nd", NULL), 1, ft_putchar); i++; } - ret = ft_printf("%s", line) + ft_strlen(msh->ps[0]); + ret = ft_printf("%s", line); if (tcaps->cpos != len) while (--len > tcaps->cpos) tputs(tgetstr("le", NULL), 1, ft_putchar); -- cgit v1.2.3