mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-14 05:23: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;
|
||||
}
|
||||
|
||||
if (ctx->pastemode && key == '\r') {
|
||||
key = '\n';
|
||||
if (ctx->pastemode && key == L'\r') {
|
||||
key = L'\n';
|
||||
}
|
||||
|
||||
if (self->help->active) {
|
||||
@ -1070,7 +1070,7 @@ bool chat_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ltr || key == '\n') { /* char is printable */
|
||||
if (ltr || key == L'\n') { /* char is printable */
|
||||
input_new_char(self, key, x, x2);
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
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);
|
||||
}
|
||||
|
||||
} else if (key == '\r') {
|
||||
} else if (key == L'\r') {
|
||||
input_ret = true;
|
||||
rm_trailing_spaces_buf(ctx);
|
||||
|
||||
|
@ -856,7 +856,7 @@ static bool friendlist_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (key == 'h') {
|
||||
if (key == L'h') {
|
||||
help_init_menu(self);
|
||||
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 */
|
||||
if (PendingDelete.active) {
|
||||
if (key == 'y' || key == 'n') {
|
||||
if (key == L'y' || key == L'n') {
|
||||
del_friend_deactivate(m, key);
|
||||
}
|
||||
|
||||
@ -891,7 +891,7 @@ static bool friendlist_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
|
||||
}
|
||||
|
||||
switch (key) {
|
||||
case '\r':
|
||||
case L'\r':
|
||||
if (blocklist_view) {
|
||||
break;
|
||||
}
|
||||
@ -914,7 +914,7 @@ static bool friendlist_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
|
||||
del_friend_activate(f);
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
case L'b':
|
||||
if (!blocklist_view) {
|
||||
block_friend(m, f);
|
||||
} else {
|
||||
|
@ -498,11 +498,11 @@ static bool groupchat_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ctx->pastemode && key == '\r') {
|
||||
key = '\n';
|
||||
if (ctx->pastemode && key == L'\r') {
|
||||
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);
|
||||
return true;
|
||||
}
|
||||
@ -517,7 +517,7 @@ static bool groupchat_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
|
||||
|
||||
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;
|
||||
|
||||
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) {
|
||||
--groupchats[self->num].side_pos;
|
||||
}
|
||||
} else if (key == '\r') {
|
||||
} else if (key == L'\r') {
|
||||
input_ret = true;
|
||||
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;
|
||||
|
||||
switch (key) {
|
||||
case 'x':
|
||||
case L'x':
|
||||
case T_KEY_ESC:
|
||||
help_exit(self);
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
case L'c':
|
||||
#ifdef VIDEO
|
||||
help_init_window(self, 23, 80);
|
||||
#elif AUDIO
|
||||
@ -372,7 +372,7 @@ void help_onKey(ToxWindow *self, wint_t key)
|
||||
self->help->type = HELP_CHAT;
|
||||
break;
|
||||
|
||||
case 'g':
|
||||
case L'g':
|
||||
height = 22;
|
||||
#ifdef VIDEO
|
||||
height += 8;
|
||||
@ -386,30 +386,30 @@ void help_onKey(ToxWindow *self, wint_t key)
|
||||
self->help->type = HELP_GLOBAL;
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
case L'r':
|
||||
help_init_window(self, 6, 80);
|
||||
self->help->type = HELP_GROUP;
|
||||
break;
|
||||
|
||||
#ifdef PYTHON
|
||||
|
||||
case 'p':
|
||||
case L'p':
|
||||
help_init_window(self, 4 + num_registered_handlers(), help_max_width());
|
||||
self->help->type = HELP_PLUGIN;
|
||||
break;
|
||||
#endif /* PYTHON */
|
||||
|
||||
case 'f':
|
||||
case L'f':
|
||||
help_init_window(self, 10, 80);
|
||||
self->help->type = HELP_CONTACTS;
|
||||
break;
|
||||
|
||||
case 'k':
|
||||
case L'k':
|
||||
help_init_window(self, 15, 80);
|
||||
self->help->type = HELP_KEYS;
|
||||
break;
|
||||
|
||||
case 'm':
|
||||
case L'm':
|
||||
help_init_menu(self);
|
||||
self->help->type = HELP_MENU;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user