Skip to content

Commit 041488f

Browse files
authored
[Fix] incorrect with of ASCII snapshot (#94)
1 parent ddf101a commit 041488f

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

core/src/snapshot/ascii_snapshot.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,12 @@ impl ASCIISnapshot {
5858
}
5959
None => frame_width,
6060
};
61-
let line = format!("│{}│\n", "─".repeat(frame_width));
62-
let frame_width_with_content = frame_width - 1;
63-
let top_frame = format!("╭{}╮\n", "─".repeat(frame_width));
64-
let bottom_frame = format!("╰{}╯", "─".repeat(frame_width));
61+
let frame_width_with_space = frame_width + SPACE_BOTH_SIDE;
62+
let line = "─".repeat(frame_width_with_space);
63+
let breadcurmbs_line = format!("│{}│\n", line);
64+
let frame_width_with_content = frame_width;
65+
let top_frame = format!("╭{}╮\n", line);
66+
let bottom_frame = format!("╰{}╯", line);
6567
let code = code
6668
.lines()
6769
.enumerate()
@@ -76,14 +78,14 @@ impl ASCIISnapshot {
7678
),
7779
None => line.to_string(),
7880
},
79-
frame_width_with_content - 1
81+
frame_width_with_content
8082
)
8183
})
8284
.collect::<String>();
83-
let text_line = |text: &str| format!("│ {:1$}│\n", text, frame_width_with_content);
85+
let text_line = |text: &str| format!("│ {:1$} \n", text, frame_width_with_content);
8486
let breadcrumbs = optional(
8587
format!(
86-
"{}{line}",
88+
"{}{breadcurmbs_line}",
8789
text_line(&self.code.file_path.clone().unwrap_or(String::from("")))
8890
),
8991
self.has_breadcrumbs,

0 commit comments

Comments
 (0)