Debian Codegraph @

src/utils/arrangement/disabled.rs

raw symbols SCIP
1 use super::{ColumnDisplayInfo, DisplayInfos, constraint, helper::*};
2 use crate::Table;
3
4 /// Dynamic arrangement is disabled.
5 /// Apply all non-relative constraints, and set the width of all remaining columns to the
6 /// respective max content width.
7 pub fn arrange(
8 table: &Table,
9 infos: &mut DisplayInfos,
10 visible_columns: usize,
11 max_content_widths: &[u16],
12 ) {
13 for column in table.columns.iter() {
14 if infos.contains_key(&column.index) {
15 continue;
16 }
17
18 let mut width = max_content_widths[column.index];
19
20 // Reduce the width, if a column has longer content than the specified MaxWidth constraint.
21 if let Some(max_width) = constraint::max(table, &column.constraint, visible_columns)
22 && max_width < width
23 {
24 width = absolute_width_with_padding(column, max_width);
25 }
26
27 let info = ColumnDisplayInfo::new(column, width);
28 infos.insert(column.index, info);
29 }
30 }