From a29a624f86c07dc4bbfed2e278a49b6a7f7dff3e Mon Sep 17 00:00:00 2001 From: Esteban Kuber Date: Sat, 14 Aug 2021 13:31:48 +0000 Subject: [PATCH] wip --- compiler/rustc_errors/src/emitter.rs | 30 ++++++++++------------------ compiler/rustc_errors/src/lib.rs | 3 ++- 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index 645b81b9540..ba6fe477202 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -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, ); diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index cae4a6b4723..ab3f0948632 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -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()