diff options
author | Salad <water_appreciator@protonmail.com> | 2020-09-25 16:48:16 +0200 |
---|---|---|
committer | Salad <water_appreciator@protonmail.com> | 2020-09-25 16:48:16 +0200 |
commit | e6d868ff05462d4a4ea7f8c6ff50fd2b3aea2359 (patch) | |
tree | 5c17c204e6f37d5eed5e16ca5a74842573799038 /src/c_keys.c | |
parent | home improvement (diff) | |
download | 42-minishell-e6d868ff05462d4a4ea7f8c6ff50fd2b3aea2359.tar.gz 42-minishell-e6d868ff05462d4a4ea7f8c6ff50fd2b3aea2359.tar.bz2 42-minishell-e6d868ff05462d4a4ea7f8c6ff50fd2b3aea2359.tar.xz 42-minishell-e6d868ff05462d4a4ea7f8c6ff50fd2b3aea2359.tar.zst 42-minishell-e6d868ff05462d4a4ea7f8c6ff50fd2b3aea2359.zip |
transfert
Diffstat (limited to 'src/c_keys.c')
-rw-r--r-- | src/c_keys.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/c_keys.c b/src/c_keys.c index 47d9c93..c303a91 100644 --- a/src/c_keys.c +++ b/src/c_keys.c @@ -58,13 +58,19 @@ int16_t c_end_key(uint16_t size, t_caps *tcaps) { uint16_t i; + uint16_t j; - i = tcaps->cpos; - while (i < size) + i = (tcaps->lpos > 0) ? tcaps->cpos : (tcaps->ws.ws_col * tcaps->nlines - 1); + j = 0; + if (tcaps->cpos < size && tcaps->lpos > 0) { - tputs(tgetstr("nd", NULL), 1, ft_putchar); - i++; + while (j++ < (tcaps->nlines - 1)) + tputs(tgetstr("do", NULL), 1, ft_putchar); + tputs(tgetstr("cr", NULL), 1, ft_putchar); } + else + while (i++ < size) + tputs(tgetstr("nd", NULL), 1, ft_putchar); tcaps->cpos = size; return (1); } |