diff options
author | salad <fmoenne-@student.le-101.fr> | 2020-09-21 14:49:28 +0200 |
---|---|---|
committer | salad <fmoenne-@student.le-101.fr> | 2020-09-21 14:49:28 +0200 |
commit | 1515de15c6a91d7363086b10799068b6f291a147 (patch) | |
tree | 0e0cc10a3269232a8f06b73d004ce0d3b82519e0 /src | |
parent | close (diff) | |
download | 42-minishell-1515de15c6a91d7363086b10799068b6f291a147.tar.gz 42-minishell-1515de15c6a91d7363086b10799068b6f291a147.tar.bz2 42-minishell-1515de15c6a91d7363086b10799068b6f291a147.tar.xz 42-minishell-1515de15c6a91d7363086b10799068b6f291a147.tar.zst 42-minishell-1515de15c6a91d7363086b10799068b6f291a147.zip |
FINALLY
Diffstat (limited to 'src')
-rw-r--r-- | src/c_utils.c | 17 |
1 files changed, 10 insertions, 7 deletions
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); |