Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: rewrite column algorithm #227

Merged
merged 12 commits into from
Sep 10, 2020
Prev Previous commit
Next Next commit
Temporary workaround to avoid having to implement column movement for…
… now
  • Loading branch information
ClementTsang committed Sep 9, 2020
commit a1027d4ed6a722520984ef7d070e1731511ac92d
12 changes: 12 additions & 0 deletions src/canvas/drawing_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ pub fn get_column_widths(
if let Some(Some(hard_width)) = hard_widths.get(*itx) {
// Hard width...
let space_taken = min(*hard_width, total_width_left);

// TODO [COLUMN MOVEMENT]: Remove this
if *hard_width > space_taken {
break;
}

column_widths[*itx] = space_taken;
total_width_left -= space_taken;
total_width_left = total_width_left.saturating_sub(1);
Expand All @@ -53,6 +59,12 @@ pub fn get_column_widths(
*soft_width_min,
);
let space_taken = min(min(soft_limit, *soft_width_desired), total_width_left);

// TODO [COLUMN MOVEMENT]: Remove this
if *soft_width_min > space_taken {
break;
}

column_widths[*itx] = space_taken;
total_width_left -= space_taken;
total_width_left = total_width_left.saturating_sub(1);
Expand Down
2 changes: 1 addition & 1 deletion src/canvas/widgets/process_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ impl ProcessTableWidget for Painter {
} else {
vec![
None,
Some(0.4),
Some(0.3),
None,
None,
None,
Expand Down