Skip to content

Commit

Permalink
Retain trailing newline during justification (#284)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmacdonald committed May 14, 2024
1 parent ffe3df7 commit 3317b96
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/util/reflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ impl<'a> Reflow<'a> {
}
}

// Append trailing newline that is stripped during justification
justified.push('\n');

justified
}
}
Expand Down Expand Up @@ -125,7 +128,7 @@ a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a
buf.data(),
"\
a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a
a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a"
a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a\n"
);
}

Expand Down Expand Up @@ -155,7 +158,7 @@ it wasn't obvious.\n",
"\
these are words to be used as demos for the thing that this is. this is text
reflowing and justification over a few lines. this is just filler text in case
it wasn't obvious."
it wasn't obvious.\n"
);
}

Expand Down Expand Up @@ -204,7 +207,7 @@ of sanity and coherence here!
Fun fact of the day number three is that I spent three hours getting this to not
branch. There is no way that that micro-optimization will actually save three
hours worth of time, but I did it anyway for no good reason!"
hours worth of time, but I did it anyway for no good reason!\n"
);
}

Expand All @@ -230,7 +233,7 @@ hours worth of time, but I did it anyway for no good reason!"
buf.data(),
"\
# a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a
# a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a"
# a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a\n"
);
}

Expand Down Expand Up @@ -262,7 +265,7 @@ languages.\n",
"\
// filler text meant to do stuff and things that end up with text nicely
// wrappped around a comment delimiter such as the double slashes in c-style
// languages.",
// languages.\n",
);
}
}

0 comments on commit 3317b96

Please sign in to comment.