This commit is contained in:
Esteban Kuber 2021-08-14 13:31:48 +00:00
parent 75fd1bf1e6
commit a29a624f86
2 changed files with 13 additions and 20 deletions

View File

@ -1679,27 +1679,19 @@ fn emit_suggestion_default(
// Colorize addition/replacements with green.
for &SubstitutionHighlight { start, end } in highlight_parts {
// Account for tabs when highlighting (#87972).
let start: usize = line
.chars()
.take(start)
.map(|ch| match ch {
'\t' => 4,
_ => 1,
})
.sum();
let end: usize = line
.chars()
.take(end)
.map(|ch| match ch {
'\t' => 4,
_ => 1,
})
.sum();
// let tabs: usize = line
// .chars()
// .take(start)
// .map(|ch| match ch {
// '\t' => 3,
// _ => 0,
// })
// .sum();
let tabs = 0;
buffer.set_style_range(
row_num,
max_line_num_len + 3 + start,
max_line_num_len + 3 + end,
max_line_num_len + 3 + start + tabs,
max_line_num_len + 3 + end + tabs,
Style::Addition,
true,
);

View File

@ -14,7 +14,7 @@
pub use emitter::ColorConfig;
use tracing::debug;
use tracing::{debug, info};
use Level::*;
use emitter::{is_case_difference, Emitter, EmitterWriter};
@ -349,6 +349,7 @@ fn push_trailing(
while buf.ends_with('\n') {
buf.pop();
}
info!(?buf, ?highlights);
Some((buf, substitution.parts, highlights, only_capitalization))
})
.collect()