Skip to content

Commit

Permalink
Fix carriage return bug in syntax highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
crowdagger committed Jan 24, 2024
1 parent a5f710e commit 666c90b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/lib/syntax.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2017-2023 Élisabeth HENRY.
// Copyright (C) 2017-2024 Élisabeth HENRY.
//
// This file is part of Crowbook.
//
Expand Down Expand Up @@ -102,7 +102,6 @@ impl Syntax {
let mut content = escape::tex(text).into_owned();
content = insert_breaks(&content);
content = content
.replace('\n', "\\\\{}\n")
.replace(' ', "\\hphantom{ }\\allowbreak{}");
content = format!("\\texttt{{{content}}}");
if style.foreground != Color::BLACK {
Expand All @@ -121,8 +120,8 @@ impl Syntax {
content = format!("\\underline{{{content}}}");
}
formatted_code.push_str(&content);
formatted_code.push_str("\n");
}
formatted_code.push_str("\\\\{}\n");
}
Ok(format!("{{\\sloppy {formatted_code}}}"))
}
Expand Down

0 comments on commit 666c90b

Please sign in to comment.