diff options
author | salad <fmoenne-@student.le-101.fr> | 2020-10-20 18:44:30 +0200 |
---|---|---|
committer | salad <fmoenne-@student.le-101.fr> | 2020-10-20 18:44:30 +0200 |
commit | 6238338ae0c89c9cb16e437bf80db3f4fb1cce10 (patch) | |
tree | c8f058727128f5d7ba0e47c12b35eb135ec55a53 /src/c_keys.c | |
parent | norme + backslash + delchar + init --> gnl (diff) | |
download | 42-minishell-6238338ae0c89c9cb16e437bf80db3f4fb1cce10.tar.gz 42-minishell-6238338ae0c89c9cb16e437bf80db3f4fb1cce10.tar.bz2 42-minishell-6238338ae0c89c9cb16e437bf80db3f4fb1cce10.tar.xz 42-minishell-6238338ae0c89c9cb16e437bf80db3f4fb1cce10.tar.zst 42-minishell-6238338ae0c89c9cb16e437bf80db3f4fb1cce10.zip |
globul scope
Diffstat (limited to '')
-rw-r--r-- | src/c_keys.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/c_keys.c b/src/c_keys.c index cd3e6f1..78b3d8f 100644 --- a/src/c_keys.c +++ b/src/c_keys.c @@ -29,8 +29,8 @@ int16_t int16_t c_home_key(t_caps *tcaps) { - int16_t i; - int16_t j; + uint32_t i; + int16_t j; i = tcaps->cpos; j = tcaps->lpos; @@ -40,7 +40,7 @@ int16_t while (--j > 0) tputs(tgetstr("up", NULL), 1, ft_putchar); tputs(tgetstr("cr", NULL), 1, ft_putchar); - while ((uint32_t)++i <= 13) + while (++i <= 13) tputs(tgetstr("nd", NULL), 1, ft_putchar); } else @@ -54,24 +54,24 @@ int16_t } int16_t - c_end_key(uint16_t size, t_caps *tcaps) + c_end_key(uint16_t size, uint32_t plen, t_caps *tcaps) { uint16_t i; uint16_t j; i = tcaps->cpos; j = tcaps->lpos; - if (tcaps->cpos < size && j < tcaps->nlines) + if ((tcaps->cpos < size) && (j < tcaps->nlines)) { i = 0; - while (j < (tcaps->nlines)) + while (j < tcaps->nlines) { tputs(tgetstr("do", NULL), 1, ft_putchar); i += tcaps->ws.ws_col; j++; } tputs(tgetstr("cr", NULL), 1, ft_putchar); - while (i++ < (size + 13)) + while (i++ < (size + plen)) tputs(tgetstr("nd", NULL), 1, ft_putchar); } else @@ -85,8 +85,8 @@ int16_t int16_t c_key_right(uint32_t len, uint32_t plen, t_caps *tcaps) { - if ((((tcaps->cpos + plen + 1) % (tcaps->ws.ws_col)) == 0) - && tcaps->cpos < len) + if ((((tcaps->cpos + plen + 1) % (tcaps->ws.ws_col)) == 0) && + tcaps->cpos < len) { tputs(tgetstr("do", NULL), 1, ft_putchar); tputs(tgetstr("cr", NULL), 1, ft_putchar); @@ -107,11 +107,11 @@ int16_t int32_t pos; pos = -1; - if (((tcaps->cpos + plen) % (tcaps->ws.ws_col)) == 0 - && tcaps->cpos >= 1) + if (((tcaps->cpos + plen) % tcaps->ws.ws_col) == 0 && + tcaps->cpos >= 1) { tputs(tgetstr("up", NULL), 1, ft_putchar); - while(++pos <= (tcaps->ws.ws_col)) + while (++pos <= tcaps->ws.ws_col) tputs(tgetstr("nd", NULL), 1, ft_putchar); tcaps->cpos--; tcaps->lpos--; |