diff options
author | wm4 <wm4@nowhere> | 2017-10-30 21:15:09 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2017-10-30 21:15:09 +0100 |
commit | 0b8b64fba312d53ae72974618e2e7f191afa0d00 (patch) | |
tree | 50be3034534716275378a9f76af1ebd8f7a82782 | |
parent | a18a7cd4f568aa934be30b2cdf813a0879b8db19 (diff) |
osd: don't strip leading whitespace in messages
Do this by replacing the first space after a line break with "\h".
-rw-r--r-- | sub/osd_libass.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sub/osd_libass.c b/sub/osd_libass.c index 046007d66b..ce1a3cddb4 100644 --- a/sub/osd_libass.c +++ b/sub/osd_libass.c @@ -190,6 +190,7 @@ void osd_get_function_sym(char *buffer, size_t buffer_size, int osd_function) static void mangle_ass(bstr *dst, const char *in) { + const char *start = in; bool escape_ass = true; while (*in) { // As used by osd_get_function_sym(). @@ -207,6 +208,12 @@ static void mangle_ass(bstr *dst, const char *in) } if (escape_ass && *in == '{') bstr_xappend(NULL, dst, bstr0("\\")); + // Libass will strip leading whitespace + if (in[0] == ' ' && in != start && in[-1] == '\n') { + bstr_xappend(NULL, dst, bstr0("\\h")); + in += 1; + continue; + } bstr_xappend(NULL, dst, (bstr){(char *)in, 1}); // Break ASS escapes with U+2060 WORD JOINER if (escape_ass && *in == '\\') |