From 610a6e441d896b8a8e3ad188344c708159695cd8 Mon Sep 17 00:00:00 2001 From: Wilfred Hughes Date: Fri, 6 Jan 2023 19:07:05 -0800 Subject: [PATCH] Ensure that textual fallback diffing has a parse language of None Previously we still passed the parse language after exceeding the graph limit, leading to incorrect underline highlighting. --- CHANGELOG.md | 3 +++ src/main.rs | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ff4f3d0f1..d497bd2fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,9 @@ constituents. `--display=inline` now respects `--tab-width`. +Fixed an issue with unwanted underlines with textual diffing when +DFT_GRAPH_LIMIT is reached. + ## 0.40 (released 28th December 2022) ### Diffing diff --git a/src/main.rs b/src/main.rs index 673558a58..7e86c96d8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -325,7 +325,7 @@ fn diff_file_content( FileArgument::DevNull => (&lhs_src, Path::new(&lhs_display_path)), }; - let language = language_override.or_else(|| guess(guess_path, guess_src)); + let mut language = language_override.or_else(|| guess(guess_path, guess_src)); let lang_config = language.map(tsp::from_language); if lhs_bytes == rhs_bytes { @@ -414,6 +414,7 @@ fn diff_file_content( if exceeded_graph_limit { let lhs_positions = line_parser::change_positions(&lhs_src, &rhs_src); let rhs_positions = line_parser::change_positions(&rhs_src, &lhs_src); + language = None; ( Some("Text (exceeded DFT_GRAPH_LIMIT)".into()), lhs_positions,