diff options
author | salad <fmoenne-@student.le-101.fr> | 2020-09-21 17:29:35 +0200 |
---|---|---|
committer | salad <fmoenne-@student.le-101.fr> | 2020-09-21 17:29:35 +0200 |
commit | a61be744a8e1beef9f90b57de4c493b034b2ffa1 (patch) | |
tree | 1cbef09daf675e082b420ec95458c0e4edb4fddf /src | |
parent | DEL MULTILIGNEED (diff) | |
download | 42-minishell-a61be744a8e1beef9f90b57de4c493b034b2ffa1.tar.gz 42-minishell-a61be744a8e1beef9f90b57de4c493b034b2ffa1.tar.bz2 42-minishell-a61be744a8e1beef9f90b57de4c493b034b2ffa1.tar.xz 42-minishell-a61be744a8e1beef9f90b57de4c493b034b2ffa1.tar.zst 42-minishell-a61be744a8e1beef9f90b57de4c493b034b2ffa1.zip |
line curs lesgo
Diffstat (limited to 'src')
-rw-r--r-- | src/c_input.c | 23 | ||||
-rw-r--r-- | src/c_utils.c | 4 |
2 files changed, 13 insertions, 14 deletions
diff --git a/src/c_input.c b/src/c_input.c index 37f7b66..37412bd 100644 --- a/src/c_input.c +++ b/src/c_input.c @@ -87,22 +87,21 @@ int16_t int32_t pos; pos = -1; - if (((tcaps->cpos + plen) % (tcaps->ws.ws_col)) == 0 - && tcaps->cpos >= 1) + if (tcaps->cpos >= 1) { - *line = c_delchar(*line, tcaps->cpos); - tputs(tgetstr("up", NULL), 1, ft_putchar); - while(++pos <= (tcaps->ws.ws_col)) - tputs(tgetstr("nd", NULL), 1, ft_putchar); + if (((tcaps->cpos + plen) % (tcaps->ws.ws_col)) == 0) + { + tputs(tgetstr("up", NULL), 1, ft_putchar); + while(++pos <= (tcaps->ws.ws_col)) + tputs(tgetstr("nd", NULL), 1, ft_putchar); + } + else + { + tputs(tgetstr("le", NULL), 1, ft_putchar); + } tputs(tgetstr("dc", NULL), 1, ft_putchar); - tcaps->cpos--; - } - else if (tcaps->cpos >= 1) - { *line = c_delchar(*line, tcaps->cpos); tcaps->cpos--; - tputs(tgetstr("le", NULL), 1, ft_putchar); - tputs(tgetstr("dc", NULL), 1, ft_putchar); } return (1); } diff --git a/src/c_utils.c b/src/c_utils.c index dc9522d..372f66d 100644 --- a/src/c_utils.c +++ b/src/c_utils.c @@ -139,12 +139,12 @@ int16_t len = ft_strlen(line); mod = (tcaps->ws.ws_col); tputs(tgetstr("cr", NULL), 1, ft_putchar); - if (((len + ft_strlen(msh->ps[0])) % mod) == 0) + if (((tcaps->cpos + ft_strlen(msh->ps[0])) % mod) == 0) { tputs(tgetstr("sf", NULL), 1, ft_putchar); return (1); } - while (--nlines > 0) + while (--tcaps->lpos > 0) { tputs(tgetstr("sf", NULL), 1, ft_putchar); tputs(tgetstr("up", NULL), 1, ft_putchar); |