From e3400e095bcdae267ae057c7151f7994e1b6a813 Mon Sep 17 00:00:00 2001 From: Jfreegman Date: Wed, 4 Dec 2013 16:21:32 -0500 Subject: [PATCH] a few fixes and update version --- configure.ac | 2 +- src/chat.c | 20 ++++++++++++-------- src/groupchat.c | 25 +++++++++++++++---------- src/prompt.c | 2 +- 4 files changed, 29 insertions(+), 20 deletions(-) diff --git a/configure.ac b/configure.ac index e272999..4fcd5d1 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ([2.65]) -AC_INIT([toxic], [0.2.3], [http://tox.im/]) +AC_INIT([toxic], [0.2.4], [http://tox.im/]) AC_CONFIG_AUX_DIR(configure_aux) AC_CONFIG_SRCDIR([src/main.c]) AC_CONFIG_HEADERS([config.h]) diff --git a/src/chat.c b/src/chat.c index 0afb8cc..872213e 100644 --- a/src/chat.c +++ b/src/chat.c @@ -294,19 +294,23 @@ static void chat_onKey(ToxWindow *self, Tox *m, wint_t key) else if (key == KEY_DC) { /* DEL key: Remove character at pos */ if (ctx->pos != ctx->len) del_char_buf_frnt(ctx->line, &ctx->pos, &ctx->len); - } + } else if (key == KEY_HOME) { /* HOME key: Move cursor to beginning of line */ - ctx->pos = 0; - wmove(self->window, y2 - CURS_Y_OFFSET, 0); + if (ctx->pos > 0) { + ctx->pos = 0; + 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->len / x2) + (y2 - CURS_Y_OFFSET); - int end_x = ctx->len % x2; - wmove(self->window, end_y, end_x); - } + if (ctx->pos != ctx->len) { + ctx->pos = ctx->len; + 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) { if (ctx->pos > 0) { diff --git a/src/groupchat.c b/src/groupchat.c index 4fcfd3e..e33018a 100644 --- a/src/groupchat.c +++ b/src/groupchat.c @@ -235,20 +235,25 @@ static void groupchat_onKey(ToxWindow *self, Tox *m, wint_t key) } else if (key == KEY_DC) { /* DEL key: Remove character at pos */ - del_char_buf_frnt(ctx->line, &ctx->pos, &ctx->len); - } + if (ctx->pos != ctx->len) + del_char_buf_frnt(ctx->line, &ctx->pos, &ctx->len); + } else if (key == KEY_HOME) { /* HOME key: Move cursor to beginning of line */ - ctx->pos = 0; - wmove(self->window, y2 - CURS_Y_OFFSET, 0); - } + if (ctx->pos > 0) { + ctx->pos = 0; + 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->len / x2) + (y2 - CURS_Y_OFFSET); - int end_x = ctx->len % x2; - wmove(self->window, end_y, end_x); - } + if (ctx->pos != ctx->len) { + ctx->pos = ctx->len; + 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) { if (ctx->pos > 0) { diff --git a/src/prompt.c b/src/prompt.c index 8c625af..95c6b0a 100644 --- a/src/prompt.c +++ b/src/prompt.c @@ -266,7 +266,7 @@ void prompt_init_statusbar(ToxWindow *self, Tox *m) snprintf(statusbar->nick, sizeof(statusbar->nick), "%s", nick); /* temporary until statusmessage saving works */ - uint8_t *statusmsg = "Toxing on Toxic v.0.2.3"; + uint8_t *statusmsg = "Toxing on Toxic v.0.2.4"; m_set_statusmessage(m, statusmsg, strlen(statusmsg) + 1); snprintf(statusbar->statusmsg, sizeof(statusbar->statusmsg), "%s", statusmsg);