mirror of
https://github.com/profanity-im/profanity.git
synced 2025-01-03 14:57:42 -05:00
Handle alt+enter as newline char
Let user print newline character using alt+enter keybind, it allows great flexibility in communication, now user will be able to write much better longer messages.
This commit is contained in:
parent
bba8278bb7
commit
dac6d0c4f8
@ -80,6 +80,9 @@ Mark current window for later reading with an attention flag.
|
|||||||
.BI ALT+m
|
.BI ALT+m
|
||||||
Switch between windows marked with the attention flag.
|
Switch between windows marked with the attention flag.
|
||||||
.TP
|
.TP
|
||||||
|
.BI ALT+ENTER
|
||||||
|
Add newline character without sending a message/command.
|
||||||
|
.TP
|
||||||
.BI ALT+c
|
.BI ALT+c
|
||||||
Run external editor (see
|
Run external editor (see
|
||||||
.BR profanity-editor (1))
|
.BR profanity-editor (1))
|
||||||
|
@ -137,6 +137,7 @@ static int _inp_rl_subwin_pagedown_handler(int count, int key);
|
|||||||
static int _inp_rl_startup_hook(void);
|
static int _inp_rl_startup_hook(void);
|
||||||
static int _inp_rl_down_arrow_handler(int count, int key);
|
static int _inp_rl_down_arrow_handler(int count, int key);
|
||||||
static int _inp_rl_send_to_editor(int count, int key);
|
static int _inp_rl_send_to_editor(int count, int key);
|
||||||
|
static int _inp_rl_print_newline_symbol(int count, int key);
|
||||||
|
|
||||||
void
|
void
|
||||||
create_input_window(void)
|
create_input_window(void)
|
||||||
@ -482,6 +483,7 @@ _inp_rl_addfuncs(void)
|
|||||||
rl_add_funmap_entry("prof_win_close", _inp_rl_win_close_handler);
|
rl_add_funmap_entry("prof_win_close", _inp_rl_win_close_handler);
|
||||||
rl_add_funmap_entry("prof_send_to_editor", _inp_rl_send_to_editor);
|
rl_add_funmap_entry("prof_send_to_editor", _inp_rl_send_to_editor);
|
||||||
rl_add_funmap_entry("prof_cut_to_history", _inp_rl_down_arrow_handler);
|
rl_add_funmap_entry("prof_cut_to_history", _inp_rl_down_arrow_handler);
|
||||||
|
rl_add_funmap_entry("prof_print_newline_symbol", _inp_rl_print_newline_symbol);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Readline callbacks
|
// Readline callbacks
|
||||||
@ -555,6 +557,8 @@ _inp_rl_startup_hook(void)
|
|||||||
rl_bind_keyseq("\\e[1;5B", _inp_rl_down_arrow_handler); // ctrl+arrow down
|
rl_bind_keyseq("\\e[1;5B", _inp_rl_down_arrow_handler); // ctrl+arrow down
|
||||||
rl_bind_keyseq("\\eOb", _inp_rl_down_arrow_handler);
|
rl_bind_keyseq("\\eOb", _inp_rl_down_arrow_handler);
|
||||||
|
|
||||||
|
rl_bind_keyseq("\\e\\C-\r", _inp_rl_print_newline_symbol); // alt+enter
|
||||||
|
|
||||||
// unbind unwanted mappings
|
// unbind unwanted mappings
|
||||||
rl_bind_keyseq("\\e=", NULL);
|
rl_bind_keyseq("\\e=", NULL);
|
||||||
|
|
||||||
@ -960,3 +964,10 @@ _inp_rl_send_to_editor(int count, int key)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
_inp_rl_print_newline_symbol(int count, int key)
|
||||||
|
{
|
||||||
|
rl_insert_text("\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user