diff options
Diffstat (limited to '')
-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); } |