summaryrefslogtreecommitdiffstats
path: root/src/c_keys.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/c_keys.c')
-rw-r--r--src/c_keys.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/c_keys.c b/src/c_keys.c
index d388d60..7874932 100644
--- a/src/c_keys.c
+++ b/src/c_keys.c
@@ -60,9 +60,16 @@ int16_t
int16_t
c_key_right(uint32_t len,
+ uint32_t plen,
t_caps *tcaps)
{
- if (tcaps->cpos < len)
+ if (((tcaps->cpos + 1) % (tcaps->ws.ws_col - plen)) == 0 && tcaps->cpos < len)
+ {
+ tputs(tgetstr("do", NULL), 1, ft_putchar);
+ tputs(tgetstr("cr", NULL), 1, ft_putchar);
+ tcaps->cpos++;
+ }
+ else if (tcaps->cpos < len)
{
tputs(tgetstr("nd", NULL), 1, ft_putchar);
tcaps->cpos++;
@@ -72,9 +79,20 @@ int16_t
int16_t
c_key_left(uint32_t len,
+ uint32_t plen,
t_caps *tcaps)
{
+ int32_t pos;
(void)len;
+
+ pos = -1;
+ if (((tcaps->cpos) % (tcaps->ws.ws_col - plen)) == 0 && tcaps->cpos >= 1)
+ {
+ tputs(tgetstr("up", NULL), 1, ft_putchar);
+ while(++pos <= (tcaps->ws.ws_col))
+ tputs(tgetstr("nd", NULL), 1, ft_putchar);
+ tcaps->cpos--;
+ }
if (tcaps->cpos >= 1)
{
tputs(tgetstr("le", NULL), 1, ft_putchar);