From 49655e13a06dfe18ae4edc7ddbab44bdb0f45914 Mon Sep 17 00:00:00 2001 From: Jfreegman Date: Sun, 1 Dec 2013 03:29:12 -0500 Subject: [PATCH] fix --- src/chat.c | 2 +- src/groupchat.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/chat.c b/src/chat.c index 0fbb60b..481620d 100644 --- a/src/chat.c +++ b/src/chat.c @@ -296,7 +296,7 @@ static void chat_onKey(ToxWindow *self, Tox *m, wint_t key) wmove(self->window, y2 - CURS_Y_OFFSET, 0); } else if (key == KEY_END) { /* END key: move cursor to end of line */ ctx->pos = ctx->len; - int end_y = (ctx->pos / x2) + y; + int end_y = (ctx->len / x2) + (y2 - CURS_Y_OFFSET); int end_x = ctx->len % x2; wmove(self->window, end_y, end_x); } else if (key == KEY_LEFT && ctx->pos > 0) { diff --git a/src/groupchat.c b/src/groupchat.c index 70efe7a..6ed792f 100644 --- a/src/groupchat.c +++ b/src/groupchat.c @@ -236,7 +236,7 @@ static void groupchat_onKey(ToxWindow *self, Tox *m, wint_t key) wmove(self->window, y2 - CURS_Y_OFFSET, 0); } else if (key == KEY_END) { /* END key: move cursor to end of line */ ctx->pos = ctx->len; - int end_y = (ctx->pos / x2) + y; + int end_y = (ctx->len / x2) + (y2 - CURS_Y_OFFSET); int end_x = ctx->len % x2; wmove(self->window, end_y, end_x); } else if (key == KEY_LEFT && ctx->pos > 0) {