|
|
|
|
@ -203,9 +203,23 @@ impl SourceDimensions {
|
|
|
|
|
let rhs_line_nums_width = format_line_num(rhs_max_line).len();
|
|
|
|
|
|
|
|
|
|
let lhs_total_width = (terminal_width - SPACER.len()) / 2;
|
|
|
|
|
let lhs_content_width = lhs_total_width - lhs_line_nums_width;
|
|
|
|
|
let rhs_content_width =
|
|
|
|
|
terminal_width - lhs_total_width - SPACER.len() - rhs_line_nums_width;
|
|
|
|
|
|
|
|
|
|
let lhs_content_width = if lhs_line_nums_width < lhs_total_width {
|
|
|
|
|
lhs_total_width - lhs_line_nums_width
|
|
|
|
|
} else {
|
|
|
|
|
// The terminal is so narrow that even the column numbers
|
|
|
|
|
// display doesn't fit. Ensure we show a non-zero number
|
|
|
|
|
// of content columns anyway.
|
|
|
|
|
1
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
let rhs_content_width = max(
|
|
|
|
|
1,
|
|
|
|
|
terminal_width as isize
|
|
|
|
|
- lhs_total_width as isize
|
|
|
|
|
- SPACER.len() as isize
|
|
|
|
|
- rhs_line_nums_width as isize,
|
|
|
|
|
) as usize;
|
|
|
|
|
|
|
|
|
|
Self {
|
|
|
|
|
lhs_content_width,
|
|
|
|
|
|