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

Fix clashing key bindings

Scrolling the groupchat peer list now uses ctrl+up and down
This commit is contained in:
jfreegman 2020-10-13 19:52:43 -04:00
parent 3015138a5a
commit e428879beb
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63
9 changed files with 8 additions and 40 deletions

View File

@ -351,16 +351,6 @@ Key combination to scroll half page down\&.
Key combination to scroll to page bottom\&. Key combination to scroll to page bottom\&.
.RE .RE
.PP .PP
\fBpeer_list_up\fR
.RS 4
Key combination to scroll contacts list up\&.
.RE
.PP
\fBpeer_list_down\fR
.RS 4
Key combination to scroll contacts list down\&.
.RE
.PP
\fBtoggle_peerlist\fR \fBtoggle_peerlist\fR
.RS 4 .RS 4
Toggle the peer list on and off\&. Toggle the peer list on and off\&.

View File

@ -221,12 +221,6 @@ OPTIONS
*page_bottom*;; *page_bottom*;;
Key combination to scroll to page bottom. Key combination to scroll to page bottom.
*peer_list_up*;;
Key combination to scroll contacts list up.
*peer_list_down*;;
Key combination to scroll contacts list down.
*toggle_peerlist*;; *toggle_peerlist*;;
Toggle the peer list on and off. Toggle the peer list on and off.

View File

@ -122,8 +122,6 @@ keys = {
half_page_up="Ctrl+F"; half_page_up="Ctrl+F";
half_page_down="Ctrl+V"; half_page_down="Ctrl+V";
page_bottom="Ctrl+H"; page_bottom="Ctrl+H";
peer_list_up="Ctrl+[";
peer_list_down="Ctrl+]";
toggle_peerlist="Ctrl+b"; toggle_peerlist="Ctrl+b";
toggle_paste_mode="Ctrl+T"; toggle_paste_mode="Ctrl+T";
}; };

View File

@ -556,14 +556,14 @@ static bool groupchat_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
} else { } else {
sound_notify(self, notif_error, 0, NULL); sound_notify(self, notif_error, 0, NULL);
} }
} else if (key == user_settings->key_peer_list_down) { /* Scroll peerlist up and down one position */ } else if (key == T_KEY_C_DOWN) { /* Scroll peerlist up and down one position */
input_ret = true; input_ret = true;
const int L = y2 - CHATBOX_HEIGHT - SDBAR_OFST; const int L = y2 - CHATBOX_HEIGHT - SDBAR_OFST;
if (groupchats[self->num].side_pos < (int64_t) groupchats[self->num].num_peers - L) { if (groupchats[self->num].side_pos < (int64_t) groupchats[self->num].num_peers - L) {
++groupchats[self->num].side_pos; ++groupchats[self->num].side_pos;
} }
} else if (key == user_settings->key_peer_list_up) { } else if (key == T_KEY_C_UP) {
input_ret = true; input_ret = true;
if (groupchats[self->num].side_pos > 0) { if (groupchats[self->num].side_pos > 0) {

View File

@ -279,7 +279,7 @@ static void help_draw_keys(ToxWindow *self)
wprintw(win, " Page Up and Page Down : Scroll window history one line\n"); wprintw(win, " Page Up and Page Down : Scroll window history one line\n");
wprintw(win, " Ctrl+F and Ctrl+V : Scroll window history half a page\n"); wprintw(win, " Ctrl+F and Ctrl+V : Scroll window history half a page\n");
wprintw(win, " Ctrl+H : Move to the bottom of window history\n"); wprintw(win, " Ctrl+H : Move to the bottom of window history\n");
wprintw(win, " Ctrl+[ and Ctrl+] : Scroll peer list in groupchats\n"); wprintw(win, " Ctrl+up and Ctrl+down : Scroll peer list in groupchats\n");
wprintw(win, " Ctrl+B : Toggle the groupchat peerlist\n"); wprintw(win, " Ctrl+B : Toggle the groupchat peerlist\n");
wprintw(win, " Ctrl+J : Insert new line\n"); wprintw(win, " Ctrl+J : Insert new line\n");
wprintw(win, " Ctrl+T : Toggle paste mode\n\n"); wprintw(win, " Ctrl+T : Toggle paste mode\n\n");

View File

@ -145,8 +145,6 @@ static const struct keys_strings {
const char *half_page_up; const char *half_page_up;
const char *half_page_down; const char *half_page_down;
const char *page_bottom; const char *page_bottom;
const char *peer_list_up;
const char *peer_list_down;
const char *toggle_peerlist; const char *toggle_peerlist;
const char *toggle_pastemode; const char *toggle_pastemode;
} key_strings = { } key_strings = {
@ -158,8 +156,6 @@ static const struct keys_strings {
"half_page_up", "half_page_up",
"half_page_down", "half_page_down",
"page_bottom", "page_bottom",
"peer_list_up",
"peer_list_down",
"toggle_peerlist", "toggle_peerlist",
"toggle_paste_mode", "toggle_paste_mode",
}; };
@ -174,8 +170,6 @@ static void key_defaults(struct user_settings *settings)
settings->key_half_page_up = T_KEY_C_F; settings->key_half_page_up = T_KEY_C_F;
settings->key_half_page_down = T_KEY_C_V; settings->key_half_page_down = T_KEY_C_V;
settings->key_page_bottom = T_KEY_C_H; settings->key_page_bottom = T_KEY_C_H;
settings->key_peer_list_up = T_KEY_C_LB;
settings->key_peer_list_down = T_KEY_C_RB;
settings->key_toggle_peerlist = T_KEY_C_B; settings->key_toggle_peerlist = T_KEY_C_B;
settings->key_toggle_pastemode = T_KEY_C_T; settings->key_toggle_pastemode = T_KEY_C_T;
} }
@ -493,14 +487,6 @@ int settings_load(struct user_settings *s, const char *patharg)
set_key_binding(&s->key_page_bottom, &tmp); set_key_binding(&s->key_page_bottom, &tmp);
} }
if (config_setting_lookup_string(setting, key_strings.peer_list_up, &tmp)) {
set_key_binding(&s->key_peer_list_up, &tmp);
}
if (config_setting_lookup_string(setting, key_strings.peer_list_down, &tmp)) {
set_key_binding(&s->key_peer_list_down, &tmp);
}
if (config_setting_lookup_string(setting, key_strings.toggle_peerlist, &tmp)) { if (config_setting_lookup_string(setting, key_strings.toggle_peerlist, &tmp)) {
set_key_binding(&s->key_toggle_peerlist, &tmp); set_key_binding(&s->key_toggle_peerlist, &tmp);
} }

View File

@ -75,8 +75,6 @@ struct user_settings {
int key_half_page_up; int key_half_page_up;
int key_half_page_down; int key_half_page_down;
int key_page_bottom; int key_page_bottom;
int key_peer_list_up;
int key_peer_list_down;
int key_toggle_peerlist; int key_toggle_peerlist;
int key_toggle_pastemode; int key_toggle_pastemode;

View File

@ -61,8 +61,6 @@
#define T_KEY_PREV 0x0F /* ctrl-o */ #define T_KEY_PREV 0x0F /* ctrl-o */
#define T_KEY_C_E 0x05 /* ctrl-e */ #define T_KEY_C_E 0x05 /* ctrl-e */
#define T_KEY_C_A 0x01 /* ctrl-a */ #define T_KEY_C_A 0x01 /* ctrl-a */
#define T_KEY_C_RB 0x1D /* ctrl-] */
#define T_KEY_C_LB 0x1B /* ctrl-[ */
#define T_KEY_C_V 0x16 /* ctrl-v */ #define T_KEY_C_V 0x16 /* ctrl-v */
#define T_KEY_C_F 0x06 /* ctrl-f */ #define T_KEY_C_F 0x06 /* ctrl-f */
#define T_KEY_C_H 0x08 /* ctrl-h */ #define T_KEY_C_H 0x08 /* ctrl-h */
@ -73,6 +71,8 @@
#define T_KEY_C_T 0x14 /* ctrl-t */ #define T_KEY_C_T 0x14 /* ctrl-t */
#define T_KEY_C_LEFT 0x221 /* ctrl-left arrow */ #define T_KEY_C_LEFT 0x221 /* ctrl-left arrow */
#define T_KEY_C_RIGHT 0x230 /* ctrl-right arrow */ #define T_KEY_C_RIGHT 0x230 /* ctrl-right arrow */
#define T_KEY_C_UP 0x236 /* ctrl-up arrow */
#define T_KEY_C_DOWN 0x20D /* ctrl-down arrow */
#define T_KEY_TAB 0x09 /* TAB key */ #define T_KEY_TAB 0x09 /* TAB key */
#define ONLINE_CHAR "*" #define ONLINE_CHAR "*"

View File

@ -609,8 +609,10 @@ static struct key_sequence_codes {
wchar_t *code; wchar_t *code;
wint_t key; wint_t key;
} Keys[] = { } Keys[] = {
{ L"[1;5D", T_KEY_C_LEFT }, { L"[1;5A", T_KEY_C_UP },
{ L"[1;5B", T_KEY_C_DOWN },
{ L"[1;5C", T_KEY_C_RIGHT }, { L"[1;5C", T_KEY_C_RIGHT },
{ L"[1;5D", T_KEY_C_LEFT },
{ NULL, 0 } { NULL, 0 }
}; };