Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix LT-21918: Newline symbol \0A printed in output #216

Merged
merged 2 commits into from
Nov 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Src/xWorks/LcmWordGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2187,15 +2187,15 @@ internal static WP.Run CreateBeforeAfterBetweenRun(string text, string styleDisp
}
}

if (text.Contains("\\A"))
if (text.Contains("\\A") || text.Contains("\\0A") || text.Contains("\\a") || text.Contains("\\0a"))
{
var run = new WP.Run()
{
RunProperties = GenerateRunProperties(uniqueDisplayName)
};
// If the before after between text has line break characters return a composite run including the line breaks
// Use Regex.Matches to capture both the content and the delimiters
var matches = Regex.Matches(text, @"(\\A|\\0A)|[^\\]*(?:(?=\\A|\\0A)|$)");
var matches = Regex.Matches(text, @"(\\A|\\0A|\\a|\\0a)|[^\\]*(?:(?=\\A|\\0A|\\a|\\0a)|$)");
foreach (Match match in matches)
{
if (match.Groups[1].Success)
Expand Down
Loading