Skip to content

Commit

Permalink
fix(rust): Ensure ASCII ellipsis fits in column width
Browse files Browse the repository at this point in the history
  • Loading branch information
ydagosto committed Feb 15, 2025
1 parent 4eb4fb7 commit e798a86
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion crates/polars-core/src/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -747,8 +747,12 @@ impl Display for DataFrame {
str_truncate + ellipsis_len + padding,
std::cmp::max(name_lengths[idx], *elem_len),
);
if mx <= min_col_width {
if (mx <= min_col_width) && !(max_n_rows > 0 && height > max_n_rows) {
// col width is less than min width + table is not truncated
constraints.push(col_width_exact(mx));
} else if mx <= min_col_width {
// col width is less than min width + table is truncated (w/ ellipsis)
constraints.push(col_width_bounds(mx, min_col_width));
} else {
constraints.push(col_width_bounds(min_col_width, mx));
}
Expand Down

0 comments on commit e798a86

Please sign in to comment.