mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-14 17:33:02 +01:00
Add settings option to set paste-mode key and update docs
This commit is contained in:
parent
04576fea7e
commit
c6a2bb8a90
@ -313,6 +313,11 @@ Key combination to scroll contacts list down\&.
|
||||
.RS 4
|
||||
Toggle the peer list on and off\&.
|
||||
.RE
|
||||
.PP
|
||||
\fBtoggle_paste_mode\fR
|
||||
.RS 4
|
||||
Toggle treating linebreaks as enter key press\&.
|
||||
.RE
|
||||
.RE
|
||||
.SH "FILES"
|
||||
.PP
|
||||
|
@ -201,6 +201,9 @@ OPTIONS
|
||||
*toggle_peerlist*;;
|
||||
Toggle the peer list on and off.
|
||||
|
||||
*toggle_paste_mode*;;
|
||||
Toggle treating linebreaks as enter key press.
|
||||
|
||||
|
||||
FILES
|
||||
-----
|
||||
|
@ -101,5 +101,6 @@ keys = {
|
||||
peer_list_up="Ctrl+[";
|
||||
peer_list_down="Ctrl+]";
|
||||
toggle_peerlist="Ctrl+b";
|
||||
toggle_paste_mode="Ctrl+T";
|
||||
};
|
||||
|
||||
|
@ -245,7 +245,9 @@ static void help_draw_keys(ToxWindow *self)
|
||||
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+[ and Ctrl+] : Scroll peer list in groupchats\n");
|
||||
wprintw(win, " Ctrl+B : Toggle the groupchat peerlist\n\n");
|
||||
wprintw(win, " Ctrl+B : Toggle the groupchat peerlist\n");
|
||||
wprintw(win, " Ctrl+J : Insert new line\n");
|
||||
wprintw(win, " Ctrl+T : Toggle paste mode\n\n");
|
||||
wprintw(win, " (Note: Custom keybindings override these defaults.)\n\n");
|
||||
|
||||
help_draw_bottom_menu(win);
|
||||
@ -335,7 +337,7 @@ void help_onKey(ToxWindow *self, wint_t key)
|
||||
break;
|
||||
|
||||
case 'k':
|
||||
help_init_window(self, 13, 80);
|
||||
help_init_window(self, 15, 80);
|
||||
self->help->type = HELP_KEYS;
|
||||
break;
|
||||
|
||||
|
13
src/input.c
13
src/input.c
@ -262,10 +262,6 @@ bool input_handle(ToxWindow *self, wint_t key, int x, int y, int mx_x, int mx_y)
|
||||
force_refresh(self->chatwin->history);
|
||||
break;
|
||||
|
||||
case T_KEY_C_T:
|
||||
self->chatwin->pastemode ^= 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
match = false;
|
||||
break;
|
||||
@ -273,14 +269,19 @@ bool input_handle(ToxWindow *self, wint_t key, int x, int y, int mx_x, int mx_y)
|
||||
|
||||
/* TODO: this special case is ugly.
|
||||
maybe convert entire function to if/else and make them all customizable keys? */
|
||||
if (!match && key == user_settings->key_toggle_peerlist) {
|
||||
if (!match) {
|
||||
if (key == user_settings->key_toggle_peerlist) {
|
||||
if (self->is_groupchat) {
|
||||
self->show_peerlist ^= 1;
|
||||
redraw_groupchat_win(self);
|
||||
}
|
||||
|
||||
match = true;
|
||||
}
|
||||
else if (key == user_settings->key_toggle_pastemode) {
|
||||
self->chatwin->pastemode ^= 1;
|
||||
match = true;
|
||||
}
|
||||
}
|
||||
|
||||
return match;
|
||||
}
|
||||
|
@ -127,6 +127,7 @@ static const struct keys_strings {
|
||||
const char* peer_list_up;
|
||||
const char* peer_list_down;
|
||||
const char* toggle_peerlist;
|
||||
const char* toggle_pastemode;
|
||||
} key_strings = {
|
||||
"keys",
|
||||
"next_tab",
|
||||
@ -139,6 +140,7 @@ static const struct keys_strings {
|
||||
"peer_list_up",
|
||||
"peer_list_down",
|
||||
"toggle_peerlist",
|
||||
"toggle_paste_mode",
|
||||
};
|
||||
|
||||
/* defines from toxic.h */
|
||||
@ -154,6 +156,7 @@ static void key_defaults(struct user_settings* settings)
|
||||
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_pastemode = T_KEY_C_T;
|
||||
}
|
||||
|
||||
static const struct tox_strings {
|
||||
@ -399,6 +402,8 @@ int settings_load(struct user_settings *s, const char *patharg)
|
||||
s->key_peer_list_down = key_parse(&tmp);
|
||||
if (config_setting_lookup_string(setting, key_strings.toggle_peerlist, &tmp))
|
||||
s->key_toggle_peerlist = key_parse(&tmp);
|
||||
if (config_setting_lookup_string(setting, key_strings.toggle_pastemode, &tmp))
|
||||
s->key_toggle_pastemode = key_parse(&tmp);
|
||||
}
|
||||
|
||||
#ifdef AUDIO
|
||||
|
@ -68,6 +68,7 @@ struct user_settings {
|
||||
int key_peer_list_up;
|
||||
int key_peer_list_down;
|
||||
int key_toggle_peerlist;
|
||||
int key_toggle_pastemode;
|
||||
|
||||
int mplex_away; /* boolean (1 for reaction to terminal attach/detach) */
|
||||
char mplex_away_note [TOX_MAX_STATUS_MESSAGE_LENGTH];
|
||||
|
Loading…
Reference in New Issue
Block a user