From bf90154410b372ad0c8731a6d470acd9bf820f7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Fri, 30 Aug 2019 19:47:21 -0700 Subject: [PATCH] Tweak terminal width trimming Properly account for left margin when setting terminal width through CLI flag and don't trim code by default if we can't get the terminal's dimensions. --- src/librustc_errors/emitter.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs index fddb6c5c259..02473cc86bd 100644 --- a/src/librustc_errors/emitter.rs +++ b/src/librustc_errors/emitter.rs @@ -1304,11 +1304,11 @@ impl EmitterWriter { }; let column_width = if let Some(width) = self.terminal_width { - width + max(width, code_offset) - code_offset } else if self.ui_testing { 140 } else { - term_size::dimensions().map(|(w, _)| w - code_offset).unwrap_or(140) + term_size::dimensions().map(|(w, _)| w - code_offset).unwrap_or(std::usize::MAX) }; let margin = Margin::new(