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

Simplify and fix Table.set_span #53

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Commits on Aug 16, 2024

  1. Simplify and fix Table.set_span

    In `Table.set_span` there are a bunch of redundant checks for borders and
    number of bordered edges that this commit simplifies. Additionally the
    vertical and horizontal spans are independent of each other, therefore these
    checks can be untangled.
    
    I think that this actually uncovered a bug in the old implementation.
    For the cases where both horizontally and vertically only one of both edges
    are bordered there are differences with this commit.
    
    | left  | right | top   | bottom | vspan/hspan before | vspan/hspan after |
    | ----- | ----- | ---   | ------ | ------------------ | ----------------- |
    | true  | false | true  | false  | false              | true              |
    | true  | false | false | true   | false              | true              |
    | false | true  | true  | false  | false              | true              |
    | false | true  | false | true   | false              | true              |
    
    This change in behaviour of the `Table.set_span` method is a bug fix.
    I guess in the original code it was missed that a cell could both
    horizontally and vertically span to other cells if the two bordered
    edges are not on the same direction.
    tomprogrammer committed Aug 16, 2024
    Configuration menu
    Copy the full SHA
    edae2a0 View commit details
    Browse the repository at this point in the history

Commits on Aug 17, 2024

  1. Change cell.hspan and cell.vspan to properties

    The attributes `vspan` and `hspan` depend only on other attributes
    inside `Cell`, therefore there is no need to use a mutating method
    `set_span` to recover the invariants of `Cell`.
    tomprogrammer committed Aug 17, 2024
    Configuration menu
    Copy the full SHA
    e8ad941 View commit details
    Browse the repository at this point in the history

Commits on Aug 19, 2024

  1. Remove redundant conditions on Cell.vspan/hspan

    The condition `hspan and not left` expands to `(not left or not right)
    and not left` which simplifies to `not left`.
    
    After this change `Cell.hspan` and `Cell.vspan` aren't used anymore in
    this codebase. They stay because they are part of the API.
    tomprogrammer committed Aug 19, 2024
    Configuration menu
    Copy the full SHA
    42daeb6 View commit details
    Browse the repository at this point in the history