mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
wip
This commit is contained in:
parent
75fd1bf1e6
commit
a29a624f86
@ -1679,27 +1679,19 @@ impl EmitterWriter {
|
||||
// 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,
|
||||
);
|
||||
|
@ -14,7 +14,7 @@ extern crate rustc_macros;
|
||||
|
||||
pub use emitter::ColorConfig;
|
||||
|
||||
use tracing::debug;
|
||||
use tracing::{debug, info};
|
||||
use Level::*;
|
||||
|
||||
use emitter::{is_case_difference, Emitter, EmitterWriter};
|
||||
@ -349,6 +349,7 @@ impl CodeSuggestion {
|
||||
while buf.ends_with('\n') {
|
||||
buf.pop();
|
||||
}
|
||||
info!(?buf, ?highlights);
|
||||
Some((buf, substitution.parts, highlights, only_capitalization))
|
||||
})
|
||||
.collect()
|
||||
|
Loading…
Reference in New Issue
Block a user