Tweak variable name for MatchedPos values

pull/926/head
Wilfred Hughes 2025-11-03 09:40:39 +07:00
parent d615490493
commit dd18b1d6cd
2 changed files with 12 additions and 12 deletions

@ -17,8 +17,8 @@ pub(crate) fn print(
lhs_src: &str,
rhs_src: &str,
display_options: &DisplayOptions,
lhs_positions: &[MatchedPos],
rhs_positions: &[MatchedPos],
lhs_mps: &[MatchedPos],
rhs_mps: &[MatchedPos],
hunks: &[Hunk],
display_path: &str,
extra_info: &Option<String>,
@ -32,7 +32,7 @@ pub(crate) fn print(
display_options.syntax_highlight,
file_format,
display_options.background_color,
lhs_positions,
lhs_mps,
),
apply_colors(
rhs_src,
@ -40,7 +40,7 @@ pub(crate) fn print(
display_options.syntax_highlight,
file_format,
display_options.background_color,
rhs_positions,
rhs_mps,
),
)
} else {
@ -63,8 +63,8 @@ pub(crate) fn print(
.map(|line| style::replace_tabs(&line, display_options.tab_width))
.collect();
let opposite_to_lhs = opposite_positions(lhs_positions);
let opposite_to_rhs = opposite_positions(rhs_positions);
let opposite_to_lhs = opposite_positions(lhs_mps);
let opposite_to_rhs = opposite_positions(rhs_mps);
for (i, hunk) in hunks.iter().enumerate() {
println!(

@ -329,12 +329,12 @@ pub(crate) fn color_positions(
background: BackgroundColor,
syntax_highlight: bool,
file_format: &FileFormat,
positions: &[MatchedPos],
mps: &[MatchedPos],
) -> Vec<(SingleLineSpan, Style)> {
let mut styles = vec![];
for pos in positions {
for mp in mps {
let mut style = Style::new();
match pos.kind {
match mp.kind {
MatchKind::UnchangedToken { highlight, .. } | MatchKind::Ignored { highlight } => {
if syntax_highlight {
if let TokenKind::Atom(atom_kind) = highlight {
@ -400,7 +400,7 @@ pub(crate) fn color_positions(
}
}
};
styles.push((pos.pos, style));
styles.push((mp.pos, style));
}
styles
}
@ -411,9 +411,9 @@ pub(crate) fn apply_colors(
syntax_highlight: bool,
file_format: &FileFormat,
background: BackgroundColor,
positions: &[MatchedPos],
mps: &[MatchedPos],
) -> Vec<String> {
let styles = color_positions(side, background, syntax_highlight, file_format, positions);
let styles = color_positions(side, background, syntax_highlight, file_format, mps);
let lines = split_on_newlines(s).collect::<Vec<_>>();
style_lines(&lines, &styles)
}