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
Fix using len vs grapheme len for headers for processes
  • Loading branch information
ClementTsang committed Sep 10, 2020
commit a62ab6c39c01d6441746588aa7fec5855053a528
11 changes: 10 additions & 1 deletion src/canvas/widgets/process_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ impl ProcessTableWidget for Painter {
if recalculate_column_widths {
let mut column_widths = process_headers
.iter()
.map(|entry| entry.len() as u16)
.map(|entry| UnicodeWidthStr::width_cjk(entry.as_str()) as u16)
.collect::<Vec<_>>();
let soft_widths_min = column_widths
.iter()
Expand Down Expand Up @@ -335,6 +335,15 @@ impl ProcessTableWidget for Painter {
.collect::<Vec<_>>()),
true,
);

debug!(
"DCW: {:?}",
proc_widget_state.table_width_state.desired_column_widths
);
debug!(
"CCW: {:?}",
proc_widget_state.table_width_state.calculated_column_widths
);
}

let dcw = &proc_widget_state.table_width_state.desired_column_widths;
Expand Down