1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-27 00:03:26 +01:00

had the names confused

This commit is contained in:
Jfreegman 2013-12-14 01:10:22 -05:00
parent 6f034d434a
commit c371c37bce
2 changed files with 10 additions and 10 deletions

View File

@ -307,7 +307,7 @@ static void chat_onKey(ToxWindow *self, Tox *m, wint_t key)
if (key == 0x107 || key == 0x8 || key == 0x7f) { /* BACKSPACE key: Remove character behind pos */ if (key == 0x107 || key == 0x8 || key == 0x7f) { /* BACKSPACE key: Remove character behind pos */
if (ctx->pos > 0) { if (ctx->pos > 0) {
cur_len = MAX(1, wcwidth(ctx->line[ctx->pos - 1], 5)); cur_len = MAX(1, wcwidth(ctx->line[ctx->pos - 1]));
del_char_buf_bck(ctx->line, &ctx->pos, &ctx->len); del_char_buf_bck(ctx->line, &ctx->pos, &ctx->len);
if (x == 0) if (x == 0)
@ -344,14 +344,14 @@ static void chat_onKey(ToxWindow *self, Tox *m, wint_t key)
else if (key == KEY_END) { /* END key: move cursor to end of line */ else if (key == KEY_END) { /* END key: move cursor to end of line */
if (ctx->pos != ctx->len) { if (ctx->pos != ctx->len) {
ctx->pos = ctx->len; ctx->pos = ctx->len;
mv_curs_end(self->window, wcswidth(ctx->line), y2, x2); mv_curs_end(self->window, MAX(0, wcswidth(ctx->line, (CHATBOX_HEIGHT-1)*x2)), y2, x2);
} }
} }
else if (key == KEY_LEFT) { else if (key == KEY_LEFT) {
if (ctx->pos > 0) { if (ctx->pos > 0) {
--ctx->pos; --ctx->pos;
cur_len = MAX(1, wcwidth(ctx->line[ctx->pos], 5)); cur_len = MAX(1, wcwidth(ctx->line[ctx->pos]));
if (x == 0) if (x == 0)
wmove(self->window, y-1, x2 - cur_len); wmove(self->window, y-1, x2 - cur_len);
@ -362,7 +362,7 @@ static void chat_onKey(ToxWindow *self, Tox *m, wint_t key)
else if (key == KEY_RIGHT) { else if (key == KEY_RIGHT) {
if (ctx->pos < ctx->len) { if (ctx->pos < ctx->len) {
cur_len = MAX(1, wcwidth(ctx->line[ctx->pos], 5)); cur_len = MAX(1, wcwidth(ctx->line[ctx->pos]));
++ctx->pos; ++ctx->pos;
if (x == x2-1) if (x == x2-1)
@ -417,7 +417,7 @@ static void chat_onKey(ToxWindow *self, Tox *m, wint_t key)
if (x == x2-1) if (x == x2-1)
wmove(self->window, y+1, 0); wmove(self->window, y+1, 0);
else else
wmove(self->window, y, x + MAX(1, wcwidth(key, 5))); wmove(self->window, y, x + MAX(1, wcwidth(key)));
} }
} }
/* RETURN key: Execute command or print line */ /* RETURN key: Execute command or print line */

View File

@ -301,7 +301,7 @@ static void groupchat_onKey(ToxWindow *self, Tox *m, wint_t key)
if (key == 0x107 || key == 0x8 || key == 0x7f) { /* BACKSPACE key: Remove character behind pos */ if (key == 0x107 || key == 0x8 || key == 0x7f) { /* BACKSPACE key: Remove character behind pos */
if (ctx->pos > 0) { if (ctx->pos > 0) {
cur_len = MAX(1, wcwidth(ctx->line[ctx->pos - 1], 5)); cur_len = wcwidth(ctx->line[ctx->pos - 1]);
del_char_buf_bck(ctx->line, &ctx->pos, &ctx->len); del_char_buf_bck(ctx->line, &ctx->pos, &ctx->len);
if (x == 0) if (x == 0)
@ -338,14 +338,14 @@ static void groupchat_onKey(ToxWindow *self, Tox *m, wint_t key)
else if (key == KEY_END) { /* END key: move cursor to end of line */ else if (key == KEY_END) { /* END key: move cursor to end of line */
if (ctx->pos != ctx->len) { if (ctx->pos != ctx->len) {
ctx->pos = ctx->len; ctx->pos = ctx->len;
mv_curs_end(self->window, wcswidth(ctx->line), y2, x2); mv_curs_end(self->window, MAX(0, wcswidth(ctx->line, (CHATBOX_HEIGHT-1)*x2)), y2, x2);
} }
} }
else if (key == KEY_LEFT) { else if (key == KEY_LEFT) {
if (ctx->pos > 0) { if (ctx->pos > 0) {
--ctx->pos; --ctx->pos;
cur_len = MAX(1, wcwidth(ctx->line[ctx->pos], 5)); cur_len = MAX(1, wcwidth(ctx->line[ctx->pos]));
if (x == 0) if (x == 0)
wmove(self->window, y-1, x2 - cur_len); wmove(self->window, y-1, x2 - cur_len);
@ -356,7 +356,7 @@ static void groupchat_onKey(ToxWindow *self, Tox *m, wint_t key)
else if (key == KEY_RIGHT) { else if (key == KEY_RIGHT) {
if (ctx->pos < ctx->len) { if (ctx->pos < ctx->len) {
cur_len = MAX(1, wcwidth(ctx->line[ctx->pos], 5)); cur_len = MAX(1, wcwidth(ctx->line[ctx->pos]));
++ctx->pos; ++ctx->pos;
if (x == x2-1) if (x == x2-1)
@ -429,7 +429,7 @@ static void groupchat_onKey(ToxWindow *self, Tox *m, wint_t key)
if (x == x2-1) if (x == x2-1)
wmove(self->window, y+1, 0); wmove(self->window, y+1, 0);
else else
wmove(self->window, y, x + MAX(1, wcwidth(key, 5))); wmove(self->window, y, x + MAX(1, wcwidth(key)));
} }
} }