Skip to content

Commit

Permalink
Only contextualize three way diffs
Browse files Browse the repository at this point in the history
  • Loading branch information
walles committed May 20, 2024
1 parent ce8a028 commit a6ffa2e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/conflicts_highlighter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ impl ConflictsHighlighter {
let c1_or_newline = if c1.is_empty() { "\n" } else { &c1 };
let c2_or_newline = if c2.is_empty() { "\n" } else { &c2 };
let (c1_tokens, c2_tokens, _, _) =
refiner::to_highlighted_tokens(c1_or_newline, c2_or_newline, true);
refiner::to_highlighted_tokens(c1_or_newline, c2_or_newline, false);

let c1_style = if base_header.is_empty() {
LINE_STYLE_OLD
Expand Down
4 changes: 2 additions & 2 deletions src/refiner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ pub fn format(prefixes: &[&str], prefix_texts: &[&str]) -> Vec<String> {
pub fn to_highlighted_tokens(
old_text: &str,
new_text: &str,
is_conflict: bool,
is_three_way_conflict: bool,
) -> (Vec<StyledToken>, Vec<StyledToken>, bool, bool) {
// Find diffs between adds and removals
let mut old_tokens = Vec::new();
Expand Down Expand Up @@ -231,7 +231,7 @@ pub fn to_highlighted_tokens(
bridge_consecutive_highlighted_tokens(&mut old_tokens);
unhighlight_noisy_rows(&mut old_tokens);

if is_conflict {
if is_three_way_conflict {
contextualize_unhighlighted_lines(&mut new_tokens);
}
bridge_consecutive_highlighted_tokens(&mut new_tokens);
Expand Down

0 comments on commit a6ffa2e

Please sign in to comment.