mirror of
https://github.com/weechat/weechat.git
synced 2026-06-28 05:46:38 +02:00
Add option grab_key_command for /input (bound by default to alt-k)
New binding for alt-k is not automatic (for existing config), if you want to use it, you can do: /key bind meta-k /input grab_key_command
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
WeeChat ChangeLog
|
||||
=================
|
||||
FlashCode <flashcode@flashtux.org>
|
||||
v0.3.1-dev, 2009-10-04
|
||||
v0.3.1-dev, 2009-10-05
|
||||
|
||||
|
||||
Version 0.3.1 (under dev!)
|
||||
--------------------------
|
||||
|
||||
* core: add option grab_key_command for /input (bound by default to alt-k)
|
||||
* core: fix compilation under Cygwin (patch #6916)
|
||||
* core: fix cmake directories: let user customize lib, share, locale and include
|
||||
directories (patch #6922)
|
||||
|
||||
@@ -154,7 +154,7 @@
|
||||
value: number of history entries to show
|
||||
........................................
|
||||
|
||||
• *`/input`* `return | complete_next | complete_previous | search_next | delete_previous_char | delete_next_char | delete_previous_word | delete_next_word | delete_beginning_of_line | delete_end_of_line | delete_line | clipboard_paste | transpose_chars | move_beginning_of_line | move_end_of_line | move_previous_char | move_next_char | move_previous_word | move_next_word | history_previous | history_next | history_global_previous | history_global_next | jump_smart | jump_last_buffer | jump_previously_visited_buffer | jump_next_visited_buffer | hotlist_clear | grab_key | scroll_unread | set_unread | set_unread_current_buffer | insert [args]`::
|
||||
• *`/input`* `return | complete_next | complete_previous | search_next | delete_previous_char | delete_next_char | delete_previous_word | delete_next_word | delete_beginning_of_line | delete_end_of_line | delete_line | clipboard_paste | transpose_chars | move_beginning_of_line | move_end_of_line | move_previous_char | move_next_char | move_previous_word | move_next_word | history_previous | history_next | history_global_previous | history_global_next | jump_smart | jump_last_buffer | jump_previously_visited_buffer | jump_next_visited_buffer | hotlist_clear | grab_key | grab_key_command | scroll_unread | set_unread | set_unread_current_buffer | insert [args]`::
|
||||
|
||||
........................................
|
||||
functions for command line
|
||||
|
||||
@@ -437,8 +437,9 @@ Keys for command line
|
||||
`/input delete_next_word`
|
||||
|
||||
| Alt + K |
|
||||
Grab a key and insert its code in command line +
|
||||
`/input grab_key`
|
||||
Grab a key and insert its code (and command bound if key exists) in command
|
||||
line +
|
||||
`/input grab_key_command`
|
||||
|
||||
| Alt + R` +
|
||||
Delete entire command line +
|
||||
|
||||
@@ -154,7 +154,7 @@
|
||||
valeur: nombre d'entrées dans l'historique à afficher
|
||||
........................................
|
||||
|
||||
• *`/input`* `return | complete_next | complete_previous | search_next | delete_previous_char | delete_next_char | delete_previous_word | delete_next_word | delete_beginning_of_line | delete_end_of_line | delete_line | clipboard_paste | transpose_chars | move_beginning_of_line | move_end_of_line | move_previous_char | move_next_char | move_previous_word | move_next_word | history_previous | history_next | history_global_previous | history_global_next | jump_smart | jump_last_buffer | jump_previously_visited_buffer | jump_next_visited_buffer | hotlist_clear | grab_key | scroll_unread | set_unread | set_unread_current_buffer | insert [args]`::
|
||||
• *`/input`* `return | complete_next | complete_previous | search_next | delete_previous_char | delete_next_char | delete_previous_word | delete_next_word | delete_beginning_of_line | delete_end_of_line | delete_line | clipboard_paste | transpose_chars | move_beginning_of_line | move_end_of_line | move_previous_char | move_next_char | move_previous_word | move_next_word | history_previous | history_next | history_global_previous | history_global_next | jump_smart | jump_last_buffer | jump_previously_visited_buffer | jump_next_visited_buffer | hotlist_clear | grab_key | grab_key_command | scroll_unread | set_unread | set_unread_current_buffer | insert [args]`::
|
||||
|
||||
........................................
|
||||
fonctions pour la ligne de commande
|
||||
|
||||
@@ -452,8 +452,9 @@ Touches pour la ligne de commande
|
||||
`/input delete_next_word`
|
||||
|
||||
| Alt + K |
|
||||
Capturer une touche et insérer son code sur la ligne de commande +
|
||||
`/input grab_key`
|
||||
Capturer une touche et insérer son code (et la commande associée si la
|
||||
commande existe) sur la ligne de commande +
|
||||
`/input grab_key_command`
|
||||
|
||||
| Alt + R |
|
||||
Effacer entièrement la ligne de commande +
|
||||
|
||||
@@ -1843,6 +1843,8 @@ command_input (void *data, struct t_gui_buffer *buffer,
|
||||
gui_input_hotlist_clear ();
|
||||
else if (string_strcasecmp (argv[1], "grab_key") == 0)
|
||||
gui_input_grab_key ();
|
||||
else if (string_strcasecmp (argv[1], "grab_key_command") == 0)
|
||||
gui_input_grab_key_command ();
|
||||
else if (string_strcasecmp (argv[1], "scroll_unread") == 0)
|
||||
gui_input_scroll_unread ();
|
||||
else if (string_strcasecmp (argv[1], "set_unread") == 0)
|
||||
@@ -4123,8 +4125,8 @@ command_init ()
|
||||
"jump_smart | jump_last_buffer | "
|
||||
"jump_previously_visited_buffer | "
|
||||
"jump_next_visited_buffer | hotlist_clear | grab_key | "
|
||||
"scroll_unread | set_unread | set_unread_current_buffer | "
|
||||
"insert [args]",
|
||||
"grab_key_command | scroll_unread | set_unread | "
|
||||
"set_unread_current_buffer | insert [args]",
|
||||
N_("This command is used by key bindings or plugins."),
|
||||
"return|complete_next|complete_previous|search_next|"
|
||||
"delete_previous_char|delete_next_char|"
|
||||
@@ -4137,7 +4139,8 @@ command_init ()
|
||||
"history_global_previous|history_global_next|"
|
||||
"jump_smart|jump_last_buffer|jump_previously_visited_buffer|"
|
||||
"jump_next_visited_buffer|hotlist_clear|grab_key|"
|
||||
"scroll_unread|set_unread|set_unread_current_buffer|insert",
|
||||
"grab_key_command|scroll_unread|set_unread|"
|
||||
"set_unread_current_buffer|insert",
|
||||
&command_input, NULL);
|
||||
hook_command (NULL, "key",
|
||||
N_("bind/unbind keys"),
|
||||
|
||||
@@ -118,7 +118,7 @@ gui_keyboard_default_bindings ()
|
||||
gui_keyboard_default_bind (/* m-j,m-r */ "meta-jmeta-r", "/server raw");
|
||||
gui_keyboard_default_bind (/* m-j,m-s */ "meta-jmeta-s", "/server jump");
|
||||
gui_keyboard_default_bind (/* m-h */ "meta-h", "/input hotlist_clear");
|
||||
gui_keyboard_default_bind (/* m-k */ "meta-k", "/input grab_key");
|
||||
gui_keyboard_default_bind (/* m-k */ "meta-k", "/input grab_key_command");
|
||||
gui_keyboard_default_bind (/* m-u */ "meta-u", "/input scroll_unread");
|
||||
gui_keyboard_default_bind (/* ^S^U */ "ctrl-Sctrl-U", "/input set_unread");
|
||||
gui_keyboard_default_bind (/* ^Cb */ "ctrl-Cb", "/input insert \\x02");
|
||||
|
||||
+13
-1
@@ -1224,7 +1224,19 @@ void
|
||||
gui_input_grab_key ()
|
||||
{
|
||||
if (gui_current_window->buffer->input)
|
||||
gui_keyboard_grab_init ();
|
||||
gui_keyboard_grab_init (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_input_grab_key_command: init "grab key mode" (next key and command
|
||||
* bound will be inserted into input buffer)
|
||||
*/
|
||||
|
||||
void
|
||||
gui_input_grab_key_command ()
|
||||
{
|
||||
if (gui_current_window->buffer->input)
|
||||
gui_keyboard_grab_init (1);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -63,6 +63,7 @@ extern void gui_input_jump_previously_visited_buffer ();
|
||||
extern void gui_input_jump_next_visited_buffer ();
|
||||
extern void gui_input_hotlist_clear ();
|
||||
extern void gui_input_grab_key ();
|
||||
extern void gui_input_grab_key_command ();
|
||||
extern void gui_input_scroll_unread ();
|
||||
extern void gui_input_set_unread ();
|
||||
extern void gui_input_set_unread_current_buffer ();
|
||||
|
||||
+14
-1
@@ -53,6 +53,7 @@ int gui_keyboard_verbose = 0; /* 1 to see some messages */
|
||||
char gui_key_combo_buffer[128]; /* buffer used for combos */
|
||||
int gui_key_grab = 0; /* 1 if grab mode enabled (alt-k) */
|
||||
int gui_key_grab_count = 0; /* number of keys pressed in grab mode */
|
||||
int gui_key_grab_command = 0; /* grab command bound to key? */
|
||||
|
||||
int *gui_keyboard_buffer = NULL; /* input buffer (for paste detection) */
|
||||
int gui_keyboard_buffer_alloc = 0; /* input buffer allocated size */
|
||||
@@ -96,10 +97,11 @@ gui_keyboard_init_last_activity_time ()
|
||||
*/
|
||||
|
||||
void
|
||||
gui_keyboard_grab_init ()
|
||||
gui_keyboard_grab_init (int grab_command)
|
||||
{
|
||||
gui_key_grab = 1;
|
||||
gui_key_grab_count = 0;
|
||||
gui_key_grab_command = grab_command;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -110,6 +112,7 @@ void
|
||||
gui_keyboard_grab_end ()
|
||||
{
|
||||
char *expanded_key;
|
||||
struct t_gui_key *ptr_key;
|
||||
|
||||
/* get expanded name (for example: ^U => ctrl-u) */
|
||||
expanded_key = gui_keyboard_get_expanded_name (gui_key_combo_buffer);
|
||||
@@ -119,6 +122,15 @@ gui_keyboard_grab_end ()
|
||||
if (gui_current_window->buffer->input)
|
||||
{
|
||||
gui_input_insert_string (gui_current_window->buffer, expanded_key, -1);
|
||||
if (gui_key_grab_command)
|
||||
{
|
||||
ptr_key = gui_keyboard_search (NULL, gui_key_combo_buffer);
|
||||
if (ptr_key)
|
||||
{
|
||||
gui_input_insert_string (gui_current_window->buffer, " ", -1);
|
||||
gui_input_insert_string (gui_current_window->buffer, ptr_key->command, -1);
|
||||
}
|
||||
}
|
||||
if (gui_current_window->buffer->completion)
|
||||
gui_completion_stop (gui_current_window->buffer->completion, 1);
|
||||
gui_input_text_changed_modifier_and_signal (gui_current_window->buffer);
|
||||
@@ -129,6 +141,7 @@ gui_keyboard_grab_end ()
|
||||
/* end grab mode */
|
||||
gui_key_grab = 0;
|
||||
gui_key_grab_count = 0;
|
||||
gui_key_grab_command = 0;
|
||||
gui_key_combo_buffer[0] = '\0';
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ extern time_t gui_keyboard_last_activity_time;
|
||||
/* keyboard functions */
|
||||
|
||||
extern void gui_keyboard_init ();
|
||||
extern void gui_keyboard_grab_init ();
|
||||
extern void gui_keyboard_grab_init (int grab_command);
|
||||
extern void gui_keyboard_grab_end ();
|
||||
extern char *gui_keyboard_get_internal_code (const char *key);
|
||||
extern char *gui_keyboard_get_expanded_name (const char *key);
|
||||
|
||||
Reference in New Issue
Block a user