From eacb95c85da15005f091729f3225609d0db67963 Mon Sep 17 00:00:00 2001 From: Will Lillis Date: Sun, 14 Dec 2025 21:38:05 -0500 Subject: [PATCH] fix(cli): correct discrepancy with cst for `--no-ranges` --- crates/cli/src/parse.rs | 47 ++++++++++++++++------------------------- 1 file changed, 18 insertions(+), 29 deletions(-) diff --git a/crates/cli/src/parse.rs b/crates/cli/src/parse.rs index 292b3614..b7936f0d 100644 --- a/crates/cli/src/parse.rs +++ b/crates/cli/src/parse.rs @@ -883,35 +883,24 @@ fn write_node_text( 0 }; let formatted_line = render_line_feed(line, opts); - if !opts.no_ranges { - write!( - out, - "{}{}{}{}{}{}", - if multiline { "\n" } else { " " }, - if multiline { - render_node_range(opts, cursor, is_named, true, total_width, node_range) - } else { - String::new() - }, - if multiline { - " ".repeat(indent_level + 1) - } else { - String::new() - }, - paint(quote_color, &String::from(quote)), - &paint(color, &render_node_text(&formatted_line)), - paint(quote_color, &String::from(quote)), - )?; - } else { - write!( - out, - "\n{}{}{}{}", - " ".repeat(indent_level + 1), - paint(quote_color, &String::from(quote)), - &paint(color, &render_node_text(&formatted_line)), - paint(quote_color, &String::from(quote)), - )?; - } + write!( + out, + "{}{}{}{}{}{}", + if multiline { "\n" } else { " " }, + if multiline && !opts.no_ranges { + render_node_range(opts, cursor, is_named, true, total_width, node_range) + } else { + String::new() + }, + if multiline { + " ".repeat(indent_level + 1) + } else { + String::new() + }, + paint(quote_color, &String::from(quote)), + paint(color, &render_node_text(&formatted_line)), + paint(quote_color, &String::from(quote)), + )?; } }