summaryrefslogtreecommitdiff
path: root/src/core/wee-command.c
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2019-09-20 21:37:01 +0200
committerSébastien Helleu <flashcode@flashtux.org>2019-09-20 21:37:01 +0200
commit997894edc04e87b0ba0c81712c92a83ec7f5c121 (patch)
tree8dc259f773da21c8592421da0323694843b146db /src/core/wee-command.c
parent0109c519375f8a54552127e71ea2b00b1baa296e (diff)
downloadweechat-997894edc04e87b0ba0c81712c92a83ec7f5c121.zip
core: add calculation of expression in evaluation of expressions with "calc:..." (issue #997)
Diffstat (limited to 'src/core/wee-command.c')
-rw-r--r--src/core/wee-command.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/core/wee-command.c b/src/core/wee-command.c
index 1f5debd96..d5d3846dd 100644
--- a/src/core/wee-command.c
+++ b/src/core/wee-command.c
@@ -7363,9 +7363,11 @@ command_init ()
" 10. an environment variable (format: \"env:XXX\")\n"
" 11. a ternary operator (format: "
"\"if:condition?value_if_true:value_if_false\")\n"
- " 12. an option (format: \"file.section.option\")\n"
- " 13. a local variable in buffer\n"
- " 14. a hdata name/variable (the value is automatically converted "
+ " 12. result of an expression with parentheses and operators "
+ "+ - * / // % (format: \"calc:xxx\")\n"
+ " 13. an option (format: \"file.section.option\")\n"
+ " 14. a local variable in buffer\n"
+ " 15. a hdata name/variable (the value is automatically converted "
"to string), by default \"window\" and \"buffer\" point to current "
"window/buffer.\n"
"Format for hdata can be one of following:\n"
@@ -7401,6 +7403,7 @@ command_init ()
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
" /eval -n ${rev:Hello} ==> olleH\n"
" /eval -n ${repeat:5,-} ==> -----\n"
+ " /eval -n ${calc:(5+2)*3} ==> 21\n"
"\n"
"Examples (conditions):\n"
" /eval -n -c ${window.buffer.number} > 2 ==> 0\n"