Skip to content

Commit 6819166

Browse files
committed
fix: Don't add margin when span is near line end
1 parent 8b5e6a3 commit 6819166

File tree

3 files changed

+5
-17
lines changed

3 files changed

+5
-17
lines changed

src/renderer/margin.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,6 @@ impl Margin {
5858
self.computed_left > 0
5959
}
6060

61-
pub(crate) fn was_cut_right(&self, line_len: usize) -> bool {
62-
let right =
63-
if self.computed_right == self.span_right || self.computed_right == self.label_right {
64-
// Account for the "..." padding given above. Otherwise we end up with code lines that
65-
// do fit but end in "..." as if they were trimmed.
66-
self.computed_right - ELLIPSIS_PASSING
67-
} else {
68-
self.computed_right
69-
};
70-
right < line_len && self.computed_left + self.term_width < line_len
71-
}
72-
7361
fn compute(&mut self, max_line_len: usize) {
7462
// When there's a lot of whitespace (>20), we want to trim it as it is useless.
7563
self.computed_left = if self.whitespace_left > LONG_WHITESPACE {

src/renderer/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2083,7 +2083,7 @@ impl Renderer {
20832083
ElementStyle::Quotation,
20842084
);
20852085

2086-
if margin.was_cut_right(line_len) {
2086+
if line_len > right {
20872087
// We have stripped some code/whitespace from the beginning, make it clear.
20882088
let mut char_taken = 0;
20892089
let mut width_taken_inner = 0;

0 commit comments

Comments
 (0)