Skip to content

Commit a04ce41

Browse files
committed
Strip whitespace following a newline when whitespace collapsing is enabled
Signed-off-by: Nico Burns <[email protected]>
1 parent ef0ee99 commit a04ce41

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

parley/src/resolve/tree.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,13 @@ impl<B: Brush> TreeStyleBuilder<B> {
7878
WhiteSpaceCollapse::Collapse => {
7979
let mut span_text = self.uncommitted_text.as_str();
8080

81-
if self.is_span_first {
81+
if self.is_span_first
82+
|| self
83+
.text
84+
.chars()
85+
.last()
86+
.is_some_and(|c| c.is_ascii_whitespace())
87+
{
8288
span_text = span_text.trim_start();
8389
}
8490
if is_span_last {

0 commit comments

Comments
 (0)