1
0
mirror of https://github.com/Tha14/toxic.git synced 2025-07-02 09:06:45 +02:00

Lots of bug fixes and general code cleanup

This commit is contained in:
Jfreegman
2015-08-27 03:38:08 -04:00
parent 92d76c7f99
commit 11701d22a1
19 changed files with 247 additions and 173 deletions

View File

@ -212,7 +212,7 @@ static void prompt_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
if (diff != -1) {
if (x + diff > x2 - 1) {
int wlen = wcswidth(ctx->line, sizeof(ctx->line));
int wlen = MAX(0, wcswidth(ctx->line, sizeof(ctx->line) / sizeof(wchar_t)));
ctx->start = wlen < x2 ? 0 : wlen - x2 + 1;
}
} else {
@ -330,7 +330,7 @@ static void prompt_onDraw(ToxWindow *self, Tox *m)
getyx(self->window, y, x);
(void) x;
int new_x = ctx->start ? x2 - 1 : wcswidth(ctx->line, ctx->pos);
int new_x = ctx->start ? x2 - 1 : MAX(0, wcswidth(ctx->line, ctx->pos));
wmove(self->window, y + 1, new_x);
wrefresh(self->window);