diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2024-05-01 13:38:17 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2024-05-01 15:07:08 +0200 |
commit | 573f1046ac1056e8947a70df56018863be5f7ae0 (patch) | |
tree | cced25fd34f9a1b208bfdaa4dfc07bd2839ab724 | |
parent | 3aeea2d6aa7b272844bee28e1ddfd1b5d7858a07 (diff) | |
download | weechat-573f1046ac1056e8947a70df56018863be5f7ae0.zip |
core: execute command as user data for local keys in buffer (issue #2066)
If buffer->input_get_any_user_data is set to 1, any command executed via a
buffer local key is considered as user input and then sent to the buffer
callback, instead of being executed directly.
This is used on relay remote buffers, to execute the command on the remote
instead of locally.
-rw-r--r-- | src/gui/gui-key.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/gui/gui-key.c b/src/gui/gui-key.c index 3e5a552fa..3e74d7c91 100644 --- a/src/gui/gui-key.c +++ b/src/gui/gui-key.c @@ -2343,6 +2343,7 @@ gui_key_pressed (const char *key_str) { int i, insert_into_input, context, length, length_key, signal_sent; int rc, rc_expand, exact_match, chunks1_count, chunks2_count, event_size; + int buffer_key; struct t_gui_key *ptr_key; char saved_char, signal_name[128], **commands; char *key_name, *key_name_alias, **chunks1, **chunks2; @@ -2438,6 +2439,7 @@ gui_key_pressed (const char *key_str) chunks2_count = 0; } + buffer_key = 0; context = gui_key_get_current_context (); switch (context) { @@ -2449,6 +2451,8 @@ gui_key_pressed (const char *key_str) (const char **)chunks1, chunks1_count, (const char **)chunks2, chunks2_count, &exact_match); + if (ptr_key) + buffer_key = 1; /* if key is not found for buffer, then look in general table */ if (!ptr_key) { @@ -2523,8 +2527,12 @@ gui_key_pressed (const char *key_str) { for (i = 0; commands[i]; i++) { - (void) input_data (gui_current_window->buffer, - commands[i], NULL, 0, 0); + (void) input_data ( + gui_current_window->buffer, + commands[i], + NULL, + 0, + (buffer_key) ? 1 : 0); } string_free_split (commands); } |