summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--doc/en/autogen/user/weechat_commands.txt2
-rw-r--r--doc/en/weechat_user.en.txt5
-rw-r--r--doc/fr/autogen/user/weechat_commands.txt2
-rw-r--r--doc/fr/weechat_user.fr.txt5
-rw-r--r--src/core/wee-command.c9
-rw-r--r--src/gui/curses/gui-curses-keyboard.c2
-rw-r--r--src/gui/gui-input.c14
-rw-r--r--src/gui/gui-input.h1
-rw-r--r--src/gui/gui-keyboard.c15
-rw-r--r--src/gui/gui-keyboard.h2
11 files changed, 46 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index 23887e99a..7cb6d51dd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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)
diff --git a/doc/en/autogen/user/weechat_commands.txt b/doc/en/autogen/user/weechat_commands.txt
index 97e01c5f5..71a1572aa 100644
--- a/doc/en/autogen/user/weechat_commands.txt
+++ b/doc/en/autogen/user/weechat_commands.txt
@@ -154,7 +154,7 @@
value: number of history entries to show
........................................
-&bull; *`/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]`::
+&bull; *`/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
diff --git a/doc/en/weechat_user.en.txt b/doc/en/weechat_user.en.txt
index a8159c0ed..3b5f0e18e 100644
--- a/doc/en/weechat_user.en.txt
+++ b/doc/en/weechat_user.en.txt
@@ -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 +
diff --git a/doc/fr/autogen/user/weechat_commands.txt b/doc/fr/autogen/user/weechat_commands.txt
index ac463abfb..8d3fad2b6 100644
--- a/doc/fr/autogen/user/weechat_commands.txt
+++ b/doc/fr/autogen/user/weechat_commands.txt
@@ -154,7 +154,7 @@
valeur: nombre d'entrées dans l'historique à afficher
........................................
-&bull; *`/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]`::
+&bull; *`/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
diff --git a/doc/fr/weechat_user.fr.txt b/doc/fr/weechat_user.fr.txt
index c0779c7aa..dae1e25ab 100644
--- a/doc/fr/weechat_user.fr.txt
+++ b/doc/fr/weechat_user.fr.txt
@@ -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 +
diff --git a/src/core/wee-command.c b/src/core/wee-command.c
index ebe15ea19..0b25435e8 100644
--- a/src/core/wee-command.c
+++ b/src/core/wee-command.c
@@ -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"),
diff --git a/src/gui/curses/gui-curses-keyboard.c b/src/gui/curses/gui-curses-keyboard.c
index 08495a2c8..64db0cf48 100644
--- a/src/gui/curses/gui-curses-keyboard.c
+++ b/src/gui/curses/gui-curses-keyboard.c
@@ -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");
diff --git a/src/gui/gui-input.c b/src/gui/gui-input.c
index 806a97b9d..b40013718 100644
--- a/src/gui/gui-input.c
+++ b/src/gui/gui-input.c
@@ -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);
}
/*
diff --git a/src/gui/gui-input.h b/src/gui/gui-input.h
index 0a1e4983d..d930e158c 100644
--- a/src/gui/gui-input.h
+++ b/src/gui/gui-input.h
@@ -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 ();
diff --git a/src/gui/gui-keyboard.c b/src/gui/gui-keyboard.c
index e3ee919ee..79de71a3b 100644
--- a/src/gui/gui-keyboard.c
+++ b/src/gui/gui-keyboard.c
@@ -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';
}
diff --git a/src/gui/gui-keyboard.h b/src/gui/gui-keyboard.h
index b58c56e8c..708778025 100644
--- a/src/gui/gui-keyboard.h
+++ b/src/gui/gui-keyboard.h
@@ -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);