Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

H/vlines ending in the middle of col/rowspan not drawn #27

Open
PgBiel opened this issue Jun 30, 2023 · 0 comments
Open

H/vlines ending in the middle of col/rowspan not drawn #27

PgBiel opened this issue Jun 30, 2023 · 0 comments
Assignees
Labels
bug Something isn't working regression Something was working before, but now isn't renderer Related to the final rendering (drawing) step of the table.

Comments

@PgBiel
Copy link
Owner

PgBiel commented Jun 30, 2023

When lines are drawn with arbitrary length and they end at the middle of a col/rowspan, they are not drawn around that cell. This affects one of the examples in the README:

image

I've tracked this down to commit 875ebaf, which was released in v0.0.2.

The third line in the snippet below was changed from + 1 to + cell.colspan, which considers hlines ending at the middle of cells as "having already ended" before the cell began (as it doesn't go all the way to the end of the span), and thus they are filtered out. (An equivalent change was done for vlines in that commit.)

typst-tablex/tablex.typ

Lines 1383 to 1385 in 875ebaf

let hline_hasnt_already_ended = (
h.end in (auto, none) // always goes towards the right
or h.end >= cell.x + cell.colspan // ends at or after this cell

Interestingly, however, they are drawn after a page turn.

Additionally, simply reversing the change to that particular line isn't enough, as it forces the line to be drawn all the way to the end of the cell.

See examples below.

#stack(dir: ltr, spacing: 2em,
    tablex(
        columns: 4,
        [a], [b], [c], [c],
        auto-lines: false,
        hlinex(start: 0, end: 1),
        [c], colspanx(3)[d],
        hlinex(start: 0, end: 2),
        [f], colspanx(2)[d], [e]
    ),
    tablex(
        columns: 4,
        [a], [b], [c], [c],
        auto-lines: false,
        hlinex(start: 0, end: 1),
        [c], colspanx(3)[d],
        hlinex(start: 0, end: 4),
        [f], colspanx(2)[d], [e]
    ),
)

#stack(dir: ltr, spacing: 2em,
    tablex(
        columns: 4,
        vlinex(start: 0, end: 1),
        rowspanx(2)[e], [b], [c], [c],
        auto-lines: false,
        (), [d], [e], [f]
    ),
    tablex(
        columns: 4,
        vlinex(start: 0, end: 2),
        rowspanx(2)[e], [b], [c], [c],
        auto-lines: false,
        (), [d], [e], [f]
    )
)

image

@PgBiel PgBiel added bug Something isn't working regression Something was working before, but now isn't labels Jun 30, 2023
@PgBiel PgBiel self-assigned this Jun 30, 2023
@PgBiel PgBiel added this to the v0.2.0 or later milestone Aug 11, 2023
@PgBiel PgBiel added the renderer Related to the final rendering (drawing) step of the table. label Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working regression Something was working before, but now isn't renderer Related to the final rendering (drawing) step of the table.
Projects
None yet
Development

No branches or pull requests

1 participant