euporie.core.ft.table.calculate_col_widths

euporie.core.ft.table.calculate_col_widths(cols: tuple[euporie.core.ft.table.Col], width: prompt_toolkit.layout.dimension.Dimension, expand_to_width: bool, min_col_width: int = 2, render_count: int = 0) list[int]

Calculate column widths given the available space.

Reduce the widest column until we fit in available width, or expand cells to to fill the available width.

Parameters
  • cols – A list of columns in the table

  • width – The desired width of the table

  • expand_to_width – Whether the column should expand to fill the available width

  • min_col_width – The minimum width allowed for a column

  • render_count – The number of times the app has been rendered

Returns

List of new column widths