diff options
Diffstat (limited to '')
-rw-r--r-- | src/c_keys.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/c_keys.c b/src/c_keys.c index 6496525..47d9c93 100644 --- a/src/c_keys.c +++ b/src/c_keys.c @@ -31,13 +31,24 @@ int16_t int16_t c_home_key(t_caps *tcaps) { - uint16_t i; + int16_t i; + int16_t j; i = tcaps->cpos; - while (i > 0) + j = (tcaps->lpos - 1); + if (tcaps->cpos > 0 && j > 0) { - tputs(tgetstr("le", NULL), 1, ft_putchar); - i--; + i = 0; + while (--j >= 0) + tputs(tgetstr("up", NULL), 1, ft_putchar); + tputs(tgetstr("cr", NULL), 1, ft_putchar); + while ((uint32_t)++i <= 13) + tputs(tgetstr("nd", NULL), 1, ft_putchar); + } + else + { + while (--i >= 0) + tputs(tgetstr("le", NULL), 1, ft_putchar); } tcaps->cpos = 0; return (1); |