Always replace tabs, even in single-column display

Fixes #617
pull/647/head^2
Wilfred Hughes 2024-03-04 21:38:23 +07:00
parent d095465715
commit b78f7d447b
5 changed files with 27 additions and 1 deletions

@ -25,6 +25,8 @@ from `git diff`.
Fixed an issue with the experimental JSON display mode where it
ignored `--skip-unchanged`.
Fixed an issue with tabs not being replaced in single-column display.
## 0.55 (released 1st February 2024)
### Parsing

@ -247,6 +247,9 @@ sample_files/syntax_error_before.js sample_files/syntax_error_after.js
sample_files/tab_before.c sample_files/tab_after.c
7e4345e584d440a136f90becb0ef45bc -
sample_files/tab_before.txt sample_files/tab_after.txt
c7fcee21dd5ebd251e2cf4cd7d4446d2 -
sample_files/tailwind_before.css sample_files/tailwind_after.css
db01dde1e8455a144e5bf0511273f674 -

@ -0,0 +1 @@
export default env;

@ -0,0 +1,9 @@
export const ORIGIN = new URL(
env.VERCEL_ENV === "production"
? "https://alpha.sweets.community"
: env.VERCEL_ENV === "preview"
? `https://${env.VERCEL_URL}`
: "http://localhost:3000"
);
export default env;

@ -102,7 +102,7 @@ fn display_single_column(
.style(style)
.to_string(),
);
formatted_line.push_str(&replace_tabs(line, display_options.tab_width));
formatted_line.push_str(line);
formatted_lines.push(formatted_line);
}
@ -339,6 +339,17 @@ pub(crate) fn print(
)
};
// Style positions are relative to the source code offsets. Now
// that we've applied styling, we can replace tabs.
let lhs_colored_lines: Vec<_> = lhs_colored_lines
.iter()
.map(|l| replace_tabs(l, display_options.tab_width))
.collect();
let rhs_colored_lines: Vec<_> = rhs_colored_lines
.iter()
.map(|l| replace_tabs(l, display_options.tab_width))
.collect();
if lhs_src.is_empty() {
for line in display_single_column(
display_path,