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.
This commit is contained in:
parent
2f704eab16
commit
1383614a5f
|
@ -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,14 +335,9 @@ 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())
|
||||
res.push_back({std::move(content), face});
|
||||
|
|
Loading…
Reference in New Issue
Block a user