mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-23 06:23:02 +01:00
fixed arrow printing bug
This commit is contained in:
parent
49655e13a0
commit
192a06c4f0
10
src/chat.c
10
src/chat.c
@ -299,20 +299,24 @@ static void chat_onKey(ToxWindow *self, Tox *m, wint_t key)
|
|||||||
int end_y = (ctx->len / x2) + (y2 - CURS_Y_OFFSET);
|
int end_y = (ctx->len / x2) + (y2 - CURS_Y_OFFSET);
|
||||||
int end_x = ctx->len % x2;
|
int end_x = ctx->len % x2;
|
||||||
wmove(self->window, end_y, end_x);
|
wmove(self->window, end_y, end_x);
|
||||||
} else if (key == KEY_LEFT && ctx->pos > 0) {
|
} else if (key == KEY_LEFT) {
|
||||||
|
if (ctx->pos > 0) {
|
||||||
--ctx->pos;
|
--ctx->pos;
|
||||||
|
|
||||||
if (x == 0)
|
if (x == 0)
|
||||||
wmove(self->window, y-1, x2-1);
|
wmove(self->window, y-1, x2-1);
|
||||||
else
|
else
|
||||||
wmove(self->window, y, x-1);
|
wmove(self->window, y, x-1);
|
||||||
} else if (key == KEY_RIGHT && ctx->line[ctx->pos] != L'\0') {
|
}
|
||||||
|
} else if (key == KEY_RIGHT) {
|
||||||
|
if (ctx->pos < ctx->len) {
|
||||||
++ctx->pos;
|
++ctx->pos;
|
||||||
|
|
||||||
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+1);
|
wmove(self->window, y, x+1);
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
#if HAVE_WIDECHAR
|
#if HAVE_WIDECHAR
|
||||||
if (iswprint(key))
|
if (iswprint(key))
|
||||||
@ -395,7 +399,7 @@ static void chat_onDraw(ToxWindow *self, Tox *m)
|
|||||||
ChatContext *ctx = self->chatwin;
|
ChatContext *ctx = self->chatwin;
|
||||||
|
|
||||||
wclear(ctx->linewin);
|
wclear(ctx->linewin);
|
||||||
mvwprintw(ctx->linewin, 1, 0, "%s\n", wcs_to_char(ctx->line));
|
mvwprintw(ctx->linewin, 1, 0, "%s", wcs_to_char(ctx->line));
|
||||||
|
|
||||||
/* Draw status bar */
|
/* Draw status bar */
|
||||||
StatusBar *statusbar = self->stb;
|
StatusBar *statusbar = self->stb;
|
||||||
|
@ -239,20 +239,24 @@ static void groupchat_onKey(ToxWindow *self, Tox *m, wint_t key)
|
|||||||
int end_y = (ctx->len / x2) + (y2 - CURS_Y_OFFSET);
|
int end_y = (ctx->len / x2) + (y2 - CURS_Y_OFFSET);
|
||||||
int end_x = ctx->len % x2;
|
int end_x = ctx->len % x2;
|
||||||
wmove(self->window, end_y, end_x);
|
wmove(self->window, end_y, end_x);
|
||||||
} else if (key == KEY_LEFT && ctx->pos > 0) {
|
} else if (key == KEY_LEFT) {
|
||||||
|
if (ctx->pos > 0) {
|
||||||
--ctx->pos;
|
--ctx->pos;
|
||||||
|
|
||||||
if (x == 0)
|
if (x == 0)
|
||||||
wmove(self->window, y-1, x2-1);
|
wmove(self->window, y-1, x2-1);
|
||||||
else
|
else
|
||||||
wmove(self->window, y, x-1);
|
wmove(self->window, y, x-1);
|
||||||
} else if (key == KEY_RIGHT && ctx->line[ctx->pos] != L'\0') {
|
}
|
||||||
|
} else if (key == KEY_RIGHT) {
|
||||||
|
if (ctx->pos < ctx->len) {
|
||||||
++ctx->pos;
|
++ctx->pos;
|
||||||
|
|
||||||
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+1);
|
wmove(self->window, y, x+1);
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
#if HAVE_WIDECHAR
|
#if HAVE_WIDECHAR
|
||||||
if (iswprint(key))
|
if (iswprint(key))
|
||||||
@ -328,7 +332,7 @@ static void groupchat_onDraw(ToxWindow *self, Tox *m)
|
|||||||
ChatContext *ctx = self->chatwin;
|
ChatContext *ctx = self->chatwin;
|
||||||
|
|
||||||
wclear(ctx->linewin);
|
wclear(ctx->linewin);
|
||||||
mvwprintw(ctx->linewin, 1, 0, "%s\n", wcs_to_char(ctx->line));
|
mvwprintw(ctx->linewin, 1, 0, "%s", wcs_to_char(ctx->line));
|
||||||
|
|
||||||
wclrtobot(ctx->sidebar);
|
wclrtobot(ctx->sidebar);
|
||||||
mvwhline(ctx->linewin, 0, 0, ACS_HLINE, x);
|
mvwhline(ctx->linewin, 0, 0, ACS_HLINE, x);
|
||||||
|
Loading…
Reference in New Issue
Block a user