1
Fork 0

Fix substitution parts having a shifted underline in some cases

This commit is contained in:
Lieselotte 2024-04-25 13:09:13 +02:00
parent 865808b33b
commit b52e4bd997
No known key found for this signature in database
GPG key ID: 43A6A32F83A6F9B1
2 changed files with 3 additions and 3 deletions

View file

@ -2019,7 +2019,7 @@ impl HumanEmitter {
let offset: isize = offsets let offset: isize = offsets
.iter() .iter()
.filter_map( .filter_map(
|(start, v)| if span_start_pos <= *start { None } else { Some(v) }, |(start, v)| if span_start_pos < *start { None } else { Some(v) },
) )
.sum(); .sum();
let underline_start = (span_start_pos + start) as isize + offset; let underline_start = (span_start_pos + start) as isize + offset;
@ -2028,7 +2028,7 @@ impl HumanEmitter {
let padding: usize = max_line_num_len + 3; let padding: usize = max_line_num_len + 3;
for p in underline_start..underline_end { for p in underline_start..underline_end {
if let DisplaySuggestion::Underline = show_code_change { if let DisplaySuggestion::Underline = show_code_change {
// If this is a replacement, underline with `^`, if this is an addition // If this is a replacement, underline with `~`, if this is an addition
// underline with `+`. // underline with `+`.
buffer.putc( buffer.putc(
row_num, row_num,