mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-14 23:03: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
|
.RS 4
|
||||||
Toggle the peer list on and off\&.
|
Toggle the peer list on and off\&.
|
||||||
.RE
|
.RE
|
||||||
|
.PP
|
||||||
|
\fBtoggle_paste_mode\fR
|
||||||
|
.RS 4
|
||||||
|
Toggle treating linebreaks as enter key press\&.
|
||||||
|
.RE
|
||||||
.RE
|
.RE
|
||||||
.SH "FILES"
|
.SH "FILES"
|
||||||
.PP
|
.PP
|
||||||
|
@ -201,6 +201,9 @@ OPTIONS
|
|||||||
*toggle_peerlist*;;
|
*toggle_peerlist*;;
|
||||||
Toggle the peer list on and off.
|
Toggle the peer list on and off.
|
||||||
|
|
||||||
|
*toggle_paste_mode*;;
|
||||||
|
Toggle treating linebreaks as enter key press.
|
||||||
|
|
||||||
|
|
||||||
FILES
|
FILES
|
||||||
-----
|
-----
|
||||||
|
@ -101,5 +101,6 @@ keys = {
|
|||||||
peer_list_up="Ctrl+[";
|
peer_list_up="Ctrl+[";
|
||||||
peer_list_down="Ctrl+]";
|
peer_list_down="Ctrl+]";
|
||||||
toggle_peerlist="Ctrl+b";
|
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+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+[ 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");
|
wprintw(win, " (Note: Custom keybindings override these defaults.)\n\n");
|
||||||
|
|
||||||
help_draw_bottom_menu(win);
|
help_draw_bottom_menu(win);
|
||||||
@ -335,7 +337,7 @@ void help_onKey(ToxWindow *self, wint_t key)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'k':
|
case 'k':
|
||||||
help_init_window(self, 13, 80);
|
help_init_window(self, 15, 80);
|
||||||
self->help->type = HELP_KEYS;
|
self->help->type = HELP_KEYS;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
21
src/input.c
21
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);
|
force_refresh(self->chatwin->history);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_KEY_C_T:
|
|
||||||
self->chatwin->pastemode ^= 1;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
match = false;
|
match = false;
|
||||||
break;
|
break;
|
||||||
@ -273,13 +269,18 @@ bool input_handle(ToxWindow *self, wint_t key, int x, int y, int mx_x, int mx_y)
|
|||||||
|
|
||||||
/* TODO: this special case is ugly.
|
/* TODO: this special case is ugly.
|
||||||
maybe convert entire function to if/else and make them all customizable keys? */
|
maybe convert entire function to if/else and make them all customizable keys? */
|
||||||
if (!match && key == user_settings->key_toggle_peerlist) {
|
if (!match) {
|
||||||
if (self->is_groupchat) {
|
if (key == user_settings->key_toggle_peerlist) {
|
||||||
self->show_peerlist ^= 1;
|
if (self->is_groupchat) {
|
||||||
redraw_groupchat_win(self);
|
self->show_peerlist ^= 1;
|
||||||
|
redraw_groupchat_win(self);
|
||||||
|
}
|
||||||
|
match = true;
|
||||||
|
}
|
||||||
|
else if (key == user_settings->key_toggle_pastemode) {
|
||||||
|
self->chatwin->pastemode ^= 1;
|
||||||
|
match = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
match = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return match;
|
return match;
|
||||||
|
@ -127,6 +127,7 @@ static const struct keys_strings {
|
|||||||
const char* peer_list_up;
|
const char* peer_list_up;
|
||||||
const char* peer_list_down;
|
const char* peer_list_down;
|
||||||
const char* toggle_peerlist;
|
const char* toggle_peerlist;
|
||||||
|
const char* toggle_pastemode;
|
||||||
} key_strings = {
|
} key_strings = {
|
||||||
"keys",
|
"keys",
|
||||||
"next_tab",
|
"next_tab",
|
||||||
@ -139,6 +140,7 @@ static const struct keys_strings {
|
|||||||
"peer_list_up",
|
"peer_list_up",
|
||||||
"peer_list_down",
|
"peer_list_down",
|
||||||
"toggle_peerlist",
|
"toggle_peerlist",
|
||||||
|
"toggle_paste_mode",
|
||||||
};
|
};
|
||||||
|
|
||||||
/* defines from toxic.h */
|
/* 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_up = T_KEY_C_LB;
|
||||||
settings->key_peer_list_down = T_KEY_C_RB;
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct tox_strings {
|
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);
|
s->key_peer_list_down = key_parse(&tmp);
|
||||||
if (config_setting_lookup_string(setting, key_strings.toggle_peerlist, &tmp))
|
if (config_setting_lookup_string(setting, key_strings.toggle_peerlist, &tmp))
|
||||||
s->key_toggle_peerlist = key_parse(&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
|
#ifdef AUDIO
|
||||||
|
@ -68,6 +68,7 @@ struct user_settings {
|
|||||||
int key_peer_list_up;
|
int key_peer_list_up;
|
||||||
int key_peer_list_down;
|
int key_peer_list_down;
|
||||||
int key_toggle_peerlist;
|
int key_toggle_peerlist;
|
||||||
|
int key_toggle_pastemode;
|
||||||
|
|
||||||
int mplex_away; /* boolean (1 for reaction to terminal attach/detach) */
|
int mplex_away; /* boolean (1 for reaction to terminal attach/detach) */
|
||||||
char mplex_away_note [TOX_MAX_STATUS_MESSAGE_LENGTH];
|
char mplex_away_note [TOX_MAX_STATUS_MESSAGE_LENGTH];
|
||||||
|
Loading…
Reference in New Issue
Block a user