wip
This commit is contained in:
parent
75fd1bf1e6
commit
a29a624f86
2 changed files with 13 additions and 20 deletions
|
@ -1679,27 +1679,19 @@ impl EmitterWriter {
|
||||||
// Colorize addition/replacements with green.
|
// Colorize addition/replacements with green.
|
||||||
for &SubstitutionHighlight { start, end } in highlight_parts {
|
for &SubstitutionHighlight { start, end } in highlight_parts {
|
||||||
// Account for tabs when highlighting (#87972).
|
// Account for tabs when highlighting (#87972).
|
||||||
let start: usize = line
|
// let tabs: usize = line
|
||||||
.chars()
|
// .chars()
|
||||||
.take(start)
|
// .take(start)
|
||||||
.map(|ch| match ch {
|
// .map(|ch| match ch {
|
||||||
'\t' => 4,
|
// '\t' => 3,
|
||||||
_ => 1,
|
// _ => 0,
|
||||||
})
|
// })
|
||||||
.sum();
|
// .sum();
|
||||||
|
let tabs = 0;
|
||||||
let end: usize = line
|
|
||||||
.chars()
|
|
||||||
.take(end)
|
|
||||||
.map(|ch| match ch {
|
|
||||||
'\t' => 4,
|
|
||||||
_ => 1,
|
|
||||||
})
|
|
||||||
.sum();
|
|
||||||
buffer.set_style_range(
|
buffer.set_style_range(
|
||||||
row_num,
|
row_num,
|
||||||
max_line_num_len + 3 + start,
|
max_line_num_len + 3 + start + tabs,
|
||||||
max_line_num_len + 3 + end,
|
max_line_num_len + 3 + end + tabs,
|
||||||
Style::Addition,
|
Style::Addition,
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
|
|
|
@ -14,7 +14,7 @@ extern crate rustc_macros;
|
||||||
|
|
||||||
pub use emitter::ColorConfig;
|
pub use emitter::ColorConfig;
|
||||||
|
|
||||||
use tracing::debug;
|
use tracing::{debug, info};
|
||||||
use Level::*;
|
use Level::*;
|
||||||
|
|
||||||
use emitter::{is_case_difference, Emitter, EmitterWriter};
|
use emitter::{is_case_difference, Emitter, EmitterWriter};
|
||||||
|
@ -349,6 +349,7 @@ impl CodeSuggestion {
|
||||||
while buf.ends_with('\n') {
|
while buf.ends_with('\n') {
|
||||||
buf.pop();
|
buf.pop();
|
||||||
}
|
}
|
||||||
|
info!(?buf, ?highlights);
|
||||||
Some((buf, substitution.parts, highlights, only_capitalization))
|
Some((buf, substitution.parts, highlights, only_capitalization))
|
||||||
})
|
})
|
||||||
.collect()
|
.collect()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue