From 1383614a5fae9f8cd8e3adc923b5ae71e7e372fa Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 7 Dec 2016 13:43:27 +0000 Subject: [PATCH] Fix markup parsing handling of antislash escapes Antislashes did not need to immediately precede a face spec to escape it, it could be in any characters before it. --- src/display_buffer.cc | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/display_buffer.cc b/src/display_buffer.cc index 4ac6a2fb..cd7468d9 100644 --- a/src/display_buffer.cc +++ b/src/display_buffer.cc @@ -316,8 +316,14 @@ DisplayLine parse_display_line(StringView line) it = closing; pos = closing + 1; } - was_antislash = false; } + if (c == '\n') // line breaks are forbidden, replace with space + { + content += StringView{pos, it+1}; + content.back() = ' '; + pos = it + 1; + } + if (c == '\\') { if (was_antislash) @@ -329,13 +335,8 @@ DisplayLine parse_display_line(StringView line) else was_antislash = true; } - if (c == '\n') // line breaks are forbidden, replace with space - { - content += StringView{pos, it+1}; - content.back() = ' '; - pos = it + 1; + else was_antislash = false; - } } content += StringView{pos, line.end()}; if (not content.empty())