mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-22 22:43:01 +01:00
Fix char -> widechar comparisons
This commit is contained in:
parent
32eb7d3040
commit
811fbfbb1e
10
src/chat.c
10
src/chat.c
@ -1061,8 +1061,8 @@ bool chat_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx->pastemode && key == '\r') {
|
if (ctx->pastemode && key == L'\r') {
|
||||||
key = '\n';
|
key = L'\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self->help->active) {
|
if (self->help->active) {
|
||||||
@ -1070,7 +1070,7 @@ bool chat_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ltr || key == '\n') { /* char is printable */
|
if (ltr || key == L'\n') { /* char is printable */
|
||||||
input_new_char(self, key, x, x2);
|
input_new_char(self, key, x, x2);
|
||||||
|
|
||||||
if (ctx->line[0] != '/' && !ctx->self_is_typing && statusbar->connection != TOX_CONNECTION_NONE) {
|
if (ctx->line[0] != '/' && !ctx->self_is_typing && statusbar->connection != TOX_CONNECTION_NONE) {
|
||||||
@ -1090,7 +1090,7 @@ bool chat_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
|
|||||||
|
|
||||||
int input_ret = false;
|
int input_ret = false;
|
||||||
|
|
||||||
if (key == '\t' && ctx->len > 1 && ctx->line[0] == '/') { /* TAB key: auto-complete */
|
if (key == L'\t' && ctx->len > 1 && ctx->line[0] == '/') { /* TAB key: auto-complete */
|
||||||
input_ret = true;
|
input_ret = true;
|
||||||
int diff = -1;
|
int diff = -1;
|
||||||
|
|
||||||
@ -1128,7 +1128,7 @@ bool chat_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
|
|||||||
sound_notify(self, notif_error, 0, NULL);
|
sound_notify(self, notif_error, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (key == '\r') {
|
} else if (key == L'\r') {
|
||||||
input_ret = true;
|
input_ret = true;
|
||||||
rm_trailing_spaces_buf(ctx);
|
rm_trailing_spaces_buf(ctx);
|
||||||
|
|
||||||
|
@ -856,7 +856,7 @@ static bool friendlist_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key == 'h') {
|
if (key == L'h') {
|
||||||
help_init_menu(self);
|
help_init_menu(self);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -879,7 +879,7 @@ static bool friendlist_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
|
|||||||
|
|
||||||
/* lock screen and force decision on deletion popup */
|
/* lock screen and force decision on deletion popup */
|
||||||
if (PendingDelete.active) {
|
if (PendingDelete.active) {
|
||||||
if (key == 'y' || key == 'n') {
|
if (key == L'y' || key == L'n') {
|
||||||
del_friend_deactivate(m, key);
|
del_friend_deactivate(m, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -891,7 +891,7 @@ static bool friendlist_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case '\r':
|
case L'\r':
|
||||||
if (blocklist_view) {
|
if (blocklist_view) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -914,7 +914,7 @@ static bool friendlist_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
|
|||||||
del_friend_activate(f);
|
del_friend_activate(f);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'b':
|
case L'b':
|
||||||
if (!blocklist_view) {
|
if (!blocklist_view) {
|
||||||
block_friend(m, f);
|
block_friend(m, f);
|
||||||
} else {
|
} else {
|
||||||
|
@ -498,11 +498,11 @@ static bool groupchat_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx->pastemode && key == '\r') {
|
if (ctx->pastemode && key == L'\r') {
|
||||||
key = '\n';
|
key = L'\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ltr || key == '\n') { /* char is printable */
|
if (ltr || key == L'\n') { /* char is printable */
|
||||||
input_new_char(self, key, x, x2);
|
input_new_char(self, key, x, x2);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -517,7 +517,7 @@ static bool groupchat_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
|
|||||||
|
|
||||||
bool input_ret = false;
|
bool input_ret = false;
|
||||||
|
|
||||||
if (key == '\t') { /* TAB key: auto-completes peer name or command */
|
if (key == L'\t') { /* TAB key: auto-completes peer name or command */
|
||||||
input_ret = true;
|
input_ret = true;
|
||||||
|
|
||||||
if (ctx->len > 0) {
|
if (ctx->len > 0) {
|
||||||
@ -564,7 +564,7 @@ static bool groupchat_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
|
|||||||
if (groupchats[self->num].side_pos > 0) {
|
if (groupchats[self->num].side_pos > 0) {
|
||||||
--groupchats[self->num].side_pos;
|
--groupchats[self->num].side_pos;
|
||||||
}
|
}
|
||||||
} else if (key == '\r') {
|
} else if (key == L'\r') {
|
||||||
input_ret = true;
|
input_ret = true;
|
||||||
rm_trailing_spaces_buf(ctx);
|
rm_trailing_spaces_buf(ctx);
|
||||||
|
|
||||||
|
16
src/help.c
16
src/help.c
@ -356,12 +356,12 @@ void help_onKey(ToxWindow *self, wint_t key)
|
|||||||
int height;
|
int height;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case 'x':
|
case L'x':
|
||||||
case T_KEY_ESC:
|
case T_KEY_ESC:
|
||||||
help_exit(self);
|
help_exit(self);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'c':
|
case L'c':
|
||||||
#ifdef VIDEO
|
#ifdef VIDEO
|
||||||
help_init_window(self, 23, 80);
|
help_init_window(self, 23, 80);
|
||||||
#elif AUDIO
|
#elif AUDIO
|
||||||
@ -372,7 +372,7 @@ void help_onKey(ToxWindow *self, wint_t key)
|
|||||||
self->help->type = HELP_CHAT;
|
self->help->type = HELP_CHAT;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'g':
|
case L'g':
|
||||||
height = 22;
|
height = 22;
|
||||||
#ifdef VIDEO
|
#ifdef VIDEO
|
||||||
height += 8;
|
height += 8;
|
||||||
@ -386,30 +386,30 @@ void help_onKey(ToxWindow *self, wint_t key)
|
|||||||
self->help->type = HELP_GLOBAL;
|
self->help->type = HELP_GLOBAL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'r':
|
case L'r':
|
||||||
help_init_window(self, 6, 80);
|
help_init_window(self, 6, 80);
|
||||||
self->help->type = HELP_GROUP;
|
self->help->type = HELP_GROUP;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef PYTHON
|
#ifdef PYTHON
|
||||||
|
|
||||||
case 'p':
|
case L'p':
|
||||||
help_init_window(self, 4 + num_registered_handlers(), help_max_width());
|
help_init_window(self, 4 + num_registered_handlers(), help_max_width());
|
||||||
self->help->type = HELP_PLUGIN;
|
self->help->type = HELP_PLUGIN;
|
||||||
break;
|
break;
|
||||||
#endif /* PYTHON */
|
#endif /* PYTHON */
|
||||||
|
|
||||||
case 'f':
|
case L'f':
|
||||||
help_init_window(self, 10, 80);
|
help_init_window(self, 10, 80);
|
||||||
self->help->type = HELP_CONTACTS;
|
self->help->type = HELP_CONTACTS;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'k':
|
case L'k':
|
||||||
help_init_window(self, 15, 80);
|
help_init_window(self, 15, 80);
|
||||||
self->help->type = HELP_KEYS;
|
self->help->type = HELP_KEYS;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'm':
|
case L'm':
|
||||||
help_init_menu(self);
|
help_init_menu(self);
|
||||||
self->help->type = HELP_MENU;
|
self->help->type = HELP_MENU;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user