Skip to content

Empty line handling fix #440

Description

@lukeeheller

Hey, not sure if this is an actual issue but figured I'd mention it. There's a small bug in _wrap_text_to_colwidths (tabulate/__init__.py) where intentional blank lines in multiline cell content get stripped out during wrapping. So if you have a cell like "para 1\n\n para 2" and use maxcolwidths, the blank line between paragraphs just disappears.

Looks like it's this line:

if line.strip() != ""

Which is in the list comprehension that filters lines before wrapping. Just deleting that condition fixes it. wrapper.wrap("") already returns [], and "\n".join([]) returns "", so the existing pipeline handles blank lines fine once that filter's gone.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions