diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-05-17 10:55:21 +0200 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2018-08-24 16:47:08 +0200 |
commit | 0d3fd8ae03eb180e1309f8b0bfd2fbce6c3cfdcc (patch) | |
tree | a7c87610bcd4b82b6d140f791f00c784b2f5996a /src/basic/string-util.h | |
parent | cfbe7aeb009b9e220fde7ee61424e77fc37f18f6 (diff) |
basic/string-util: add a convenience function to cescape mostly-ascii fields
It's not supposed to be the most efficient, but instead fast and simple to use.
I kept the logic in ellipsize_mem() to use unicode ellipsis even in non-unicode
locales. I'm not quite convinced things should be this way, especially that with
this patch it'd actually be simpler to always use "…" in unicode locale and "..."
otherwise, but Lennart wanted it this way for some reason.
Diffstat (limited to 'src/basic/string-util.h')
-rw-r--r-- | src/basic/string-util.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/basic/string-util.h b/src/basic/string-util.h index 52a1d7f2b..99b515569 100644 --- a/src/basic/string-util.h +++ b/src/basic/string-util.h @@ -165,6 +165,7 @@ bool string_has_cc(const char *p, const char *ok) _pure_; char *ellipsize_mem(const char *s, size_t old_length_bytes, size_t new_length_columns, unsigned percent); char *ellipsize(const char *s, size_t length, unsigned percent); +char *cellescape(char *buf, size_t len, const char *s); bool nulstr_contains(const char *nulstr, const char *needle); |