]> git.lizzy.rs Git - rust.git/commitdiff
wip
authorEsteban Kuber <esteban@kuber.com.ar>
Sat, 14 Aug 2021 13:31:48 +0000 (13:31 +0000)
committerEsteban Kuber <esteban@kuber.com.ar>
Mon, 23 Aug 2021 11:58:19 +0000 (11:58 +0000)
compiler/rustc_errors/src/emitter.rs
compiler/rustc_errors/src/lib.rs

index 645b81b9540122fc7cf0cb70b34e14dab1829272..ba6fe4772028098d3d78dd9b6a3dcc96d799d934 100644 (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,
                     );
index cae4a6b472367949db636997d6e09e4b69155fb8..ab3f094863269abba4a84858948444e34c20232f 100644 (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()