Skip to content

Commit bf90154

Browse files
committed
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.
1 parent 78f62c6 commit bf90154

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/librustc_errors/emitter.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1304,11 +1304,11 @@ impl EmitterWriter {
13041304
};
13051305

13061306
let column_width = if let Some(width) = self.terminal_width {
1307-
width
1307+
max(width, code_offset) - code_offset
13081308
} else if self.ui_testing {
13091309
140
13101310
} else {
1311-
term_size::dimensions().map(|(w, _)| w - code_offset).unwrap_or(140)
1311+
term_size::dimensions().map(|(w, _)| w - code_offset).unwrap_or(std::usize::MAX)
13121312
};
13131313

13141314
let margin = Margin::new(

0 commit comments

Comments
 (0)