def column_max_width(inner_widths, column_number, outer_border, inner_border, padding):
    """Determine the maximum width of a column based on the current terminal width.

    :param iter inner_widths: List of widths (no padding) for each column.
    :param int column_number: The column number to query.
    :param int outer_border: Sum of left and right outer border visible widths.
    :param int inner_border: Visible width of the inner border character.
    :param int padding: Total padding per cell (left + right padding).

    :return: The maximum width the column can be without causing line wrapping.
    """
    column_count = len(inner_widths)
    terminal_width = terminal_size()[0]

    # Count how much space padding, outer, and inner borders take up.
    non_data_space = outer_border
    non_data_space += inner_border * (column_count - 1)
    non_data_space += column_count * padding

    # Exclude selected column's width.
    data_space = sum(inner_widths) - inner_widths[column_number]

    return terminal_width - data_space - non_data_space
Determine the maximum width of a column based on the current terminal width.

    :param iter inner_widths: List of widths (no padding) for each column.
    :param int column_number: The column number to query.
    :param int outer_border: Sum of left and right outer border visible widths.
    :param int inner_border: Visible width of the inner border character.
    :param int padding: Total padding per cell (left + right padding).

    :return: The maximum width the column can be without causing line wrapping.