diff options
author | salad <fmoenne-@student.le-101.fr> | 2020-09-20 13:51:01 +0200 |
---|---|---|
committer | salad <fmoenne-@student.le-101.fr> | 2020-09-20 13:51:01 +0200 |
commit | 0a5e031d87dc504e6928bca1b74a6e081c76b870 (patch) | |
tree | 1e180c7f755e716083f31feda87f5db338635c44 /src/c_utils.c | |
parent | full bugged, mais full features (diff) | |
download | 42-minishell-0a5e031d87dc504e6928bca1b74a6e081c76b870.tar.gz 42-minishell-0a5e031d87dc504e6928bca1b74a6e081c76b870.tar.bz2 42-minishell-0a5e031d87dc504e6928bca1b74a6e081c76b870.tar.xz 42-minishell-0a5e031d87dc504e6928bca1b74a6e081c76b870.tar.zst 42-minishell-0a5e031d87dc504e6928bca1b74a6e081c76b870.zip |
reworking redraw line lets go
Diffstat (limited to '')
-rw-r--r-- | src/c_utils.c | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/src/c_utils.c b/src/c_utils.c index f96d0b3..d5d818a 100644 --- a/src/c_utils.c +++ b/src/c_utils.c @@ -17,16 +17,15 @@ #include <unistd.h> #include "c_init.h" +#include "c_input.h" #include "m_prompt.h" #include "m_loop.h" #include "s_struct.h" /* ** TODO: -** MULTILIGHNE +** MULTILIGHNE (reprint correct) ** FLECHES UP DOWN -** quotes -** unknown chars ** C-c globul pid ** NORME */ @@ -132,23 +131,17 @@ int16_t uint32_t i; uint32_t len; int16_t ret; + uint32_t nlines; i = 0; len = ft_strlen(line); + nlines = c_get_line_num(line, tcaps->cpos, ft_strlen(msh->ps[0]), tcaps); tputs(tgetstr("cr", NULL), 1, ft_putchar); - if (len >= (tcaps->ws.ws_col - ft_strlen(msh->ps[0]))) + if (nlines > 1) { - if (len % (tcaps->ws.ws_col - ft_strlen(msh->ps[0])) == 0) - { - tputs(tgetstr("sf", NULL), 1, ft_putchar); - return (1); - } - else - { - tputs(tgetstr("sf", NULL), 1, ft_putchar); - tputs(tgetstr("up", NULL), 1, ft_putchar); - tputs(tgetstr("up", NULL), 1, ft_putchar); - } + 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])) { |