summaryrefslogtreecommitdiff
path: root/src/gui/gui-buffer.c
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2023-08-30 17:25:21 +0200
committerSébastien Helleu <flashcode@flashtux.org>2023-08-30 17:25:21 +0200
commit2b3fb620651bd0ba302ea7ae7e2b4c03673d19a7 (patch)
tree7aedd8a407d3dfd65a5d6eee0da2f4846f30a4cd /src/gui/gui-buffer.c
parentc2b6523d9fe1dfc19b07c89f5778b994871b9659 (diff)
downloadweechat-2b3fb620651bd0ba302ea7ae7e2b4c03673d19a7.zip
core: do not evaluate properties "key_bind_xxx" and "key_unbind_xxx" in options weechat.buffer.* (issue #352)
Diffstat (limited to 'src/gui/gui-buffer.c')
-rw-r--r--src/gui/gui-buffer.c54
1 files changed, 34 insertions, 20 deletions
diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c
index b1f45c002..114902a52 100644
--- a/src/gui/gui-buffer.c
+++ b/src/gui/gui-buffer.c
@@ -668,31 +668,45 @@ gui_buffer_apply_config_option_property (struct t_gui_buffer *buffer,
if (!buffer_mask)
return;
+ pos++;
+
if (string_match (buffer->full_name, buffer_mask, 1))
{
- pointers = hashtable_new (
- 32,
- WEECHAT_HASHTABLE_STRING,
- WEECHAT_HASHTABLE_POINTER,
- NULL, NULL);
- extra_vars = hashtable_new (
- 32,
- WEECHAT_HASHTABLE_STRING,
- WEECHAT_HASHTABLE_STRING,
- NULL, NULL);
- if (pointers && extra_vars)
+ if ((strncmp (pos, "key_bind_", 9) == 0)
+ || (strncmp (pos, "key_unbind_", 11) == 0))
+ {
+ /*
+ * no evaluation for local buffer key bindings: this allows to
+ * use command /eval without having to escape `${`
+ */
+ gui_buffer_set (buffer, pos, CONFIG_STRING(option));
+ }
+ else
{
- hashtable_set (pointers, "buffer", buffer);
- hashtable_set (extra_vars, "property", pos + 1);
- value = eval_expression (CONFIG_STRING(option),
- pointers, extra_vars, NULL);
- if (value)
+ pointers = hashtable_new (
+ 32,
+ WEECHAT_HASHTABLE_STRING,
+ WEECHAT_HASHTABLE_POINTER,
+ NULL, NULL);
+ extra_vars = hashtable_new (
+ 32,
+ WEECHAT_HASHTABLE_STRING,
+ WEECHAT_HASHTABLE_STRING,
+ NULL, NULL);
+ if (pointers && extra_vars)
{
- gui_buffer_set (buffer, pos + 1, value);
- free (value);
+ hashtable_set (pointers, "buffer", buffer);
+ hashtable_set (extra_vars, "property", pos);
+ value = eval_expression (CONFIG_STRING(option),
+ pointers, extra_vars, NULL);
+ if (value)
+ {
+ gui_buffer_set (buffer, pos, value);
+ free (value);
+ }
+ hashtable_free (pointers);
+ hashtable_free (extra_vars);
}
- hashtable_free (pointers);
- hashtable_free (extra_vars);
}
}