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

fix offset issue

This commit is contained in:
Jfreegman 2014-06-20 23:56:59 -04:00
parent 9f4248b1e1
commit bba81ac884
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63
2 changed files with 4 additions and 2 deletions

View File

@ -549,13 +549,14 @@ static void chat_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
getmaxyx(self->window, y2, x2);
int cur_len = 0; /* widechar len of current char */
int len = MAX(0, wcslen(ctx->line)); /* widechar len of line */
int x2_is_odd = x2 % 2 != 0;
if (ltr) { /* char is printable */
if (ctx->len < MAX_STR_SIZE - 1) {
add_char_to_buf(ctx, key);
if (x >= x2 - 1) {
wmove(self->window, y, x2 / 2);
wmove(self->window, y, x2 / 2 + x2_is_odd);
ctx->start += x2 / 2;
} else {
wmove(self->window, y, x + MAX(1, wcwidth(key)));

View File

@ -391,13 +391,14 @@ static void groupchat_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
getmaxyx(self->window, y2, x2);
int cur_len = 0; /* widechar len of current char */
int len = MAX(0, wcslen(ctx->line)); /* widechar len of line */
int x2_is_odd = x2 % 2 != 0;
if (ltr) { /* char is printable */
if (ctx->len < MAX_STR_SIZE - 1) {
add_char_to_buf(ctx, key);
if (x >= x2 - 1) {
wmove(self->window, y, x2 / 2);
wmove(self->window, y, x2 / 2 + x2_is_odd);
ctx->start += x2 / 2;
} else {
wmove(self->window, y, x + MAX(1, wcwidth(key)));