Skip to content

Commit e798a86

Browse files
committed
fix(rust): Ensure ASCII ellipsis fits in column width
1 parent 4eb4fb7 commit e798a86

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

crates/polars-core/src/fmt.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,8 +747,12 @@ impl Display for DataFrame {
747747
str_truncate + ellipsis_len + padding,
748748
std::cmp::max(name_lengths[idx], *elem_len),
749749
);
750-
if mx <= min_col_width {
750+
if (mx <= min_col_width) && !(max_n_rows > 0 && height > max_n_rows) {
751+
// col width is less than min width + table is not truncated
751752
constraints.push(col_width_exact(mx));
753+
} else if mx <= min_col_width {
754+
// col width is less than min width + table is truncated (w/ ellipsis)
755+
constraints.push(col_width_bounds(mx, min_col_width));
752756
} else {
753757
constraints.push(col_width_bounds(min_col_width, mx));
754758
}

0 commit comments

Comments
 (0)