summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2019-09-21 13:54:36 +0200
committerSébastien Helleu <flashcode@flashtux.org>2019-09-21 13:54:36 +0200
commite1a461279731877ad66298d9c0576997474453af (patch)
treedeb81f9f0b023a969e3592d15936aecdec3907cc /src/core
parentde456363882d54f18d6fd8614c6d5431d7402824 (diff)
downloadweechat-e1a461279731877ad66298d9c0576997474453af.zip
core: ignore color codes in ${length:xxx} and ${lengthscr:xxx}
Diffstat (limited to 'src/core')
-rw-r--r--src/core/wee-eval.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/core/wee-eval.c b/src/core/wee-eval.c
index 15f5bc3b5..498f6a116 100644
--- a/src/core/wee-eval.c
+++ b/src/core/wee-eval.c
@@ -39,6 +39,7 @@
#include "wee-string.h"
#include "wee-utf8.h"
#include "../gui/gui-buffer.h"
+#include "../gui/gui-chat.h"
#include "../gui/gui-color.h"
#include "../gui/gui-window.h"
#include "../plugins/plugin.h"
@@ -297,7 +298,7 @@ end:
* 6. a reversed string (format: rev:xxx)
* 7. a repeated string (format: repeat:count,string)
* 8. length of a string (format: length:xxx) or length of a string on screen
- * (format: lengthscr:xxx)
+ * (format: lengthscr:xxx); color codes are ignored
* 9. a regex group captured (format: re:N (0.99) or re:+)
* 10. a color (format: color:xxx)
* 11. an info (format: info:name,arguments)
@@ -487,13 +488,13 @@ eval_replace_vars_cb (void *data, const char *text)
*/
if (strncmp (text, "length:", 7) == 0)
{
- length = utf8_strlen (text + 7);
+ length = gui_chat_strlen (text + 7);
snprintf (str_value, sizeof (str_value), "%d", length);
return strdup (str_value);
}
if (strncmp (text, "lengthscr:", 10) == 0)
{
- length = utf8_strlen_screen (text + 10);
+ length = gui_chat_strlen_screen (text + 10);
snprintf (str_value, sizeof (str_value), "%d", length);
return strdup (str_value);
}