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

Nested frames have longer horizontal lines that match their parent #45

Closed
Zeta611 opened this issue Sep 12, 2024 · 2 comments · Fixed by ocaml/opam-repository#26655
Closed

Comments

@Zeta611
Copy link

Zeta611 commented Sep 12, 2024

Nested frames have longer horizontal lines that match their parent:

utop # PrintBox.(
      frame
        (vlist
           [
             text "123456789";
             frame (vlist [ text "." |> align ~h:`Right ~v:`Top; text "." ]);
           ]));;
- : PrintBox.t =
┌─────────┐
│123456789│
├─────────┤
│┌─┐      │
││ │    . │
│├─┼───── │
││.│      │
│└─┘      │
└─────────┘

This breaks alignment as shown above.

This even causes an assertion failure:

utop # PrintBox.(
      frame
        (vlist
           [
             text "123456789";
             frame (vlist [ text "...." |> align ~h:`Right ~v:`Top; text "." ]);
           ]));;
- : PrintBox.t =
┌─────────┐
│123456789│
├─────────┤
│┌────┐   │
││   ....<printer PrintBox_text.pp raised an exception: File "src/printbox-text/PrintBox_text.ml", line 202, characters 6-12: Assertion failed>

when the right aligned text intersects with the frame which "(logically) contains" it

c-cube added a commit that referenced this issue Sep 12, 2024
also fix #45 by adjusting the expected size for non stretched frames.
c-cube added a commit that referenced this issue Sep 12, 2024
@c-cube
Copy link
Owner

c-cube commented Sep 12, 2024

Should be fixed in #46 . I also added a stretch parameter to frame, see the example test (to pick whether you want the frame to expand or not).

@Zeta611
Copy link
Author

Zeta611 commented Sep 12, 2024

Thanks for the super fast fix!

@Zeta611 Zeta611 closed this as completed Sep 12, 2024
c-cube added a commit that referenced this issue Sep 12, 2024
fix #45, add stretch param to frame
c-cube added a commit to c-cube/opam-repository that referenced this issue Oct 2, 2024
CHANGES:

- Remove fallback to and dependency on `printbox-html` from `printbox-md` (@lukstafi)
- introduce notion of extensions (@lukstafi)
- add `printbox-ext-plot` extension for text and HTML plots (@lukstafi)
- feat: add `?stretch` param to `frame`

- fix c-cube/printbox#45, problem with nested frames
c-cube added a commit to c-cube/opam-repository that referenced this issue Oct 4, 2024
CHANGES:

- Remove fallback to and dependency on `printbox-html` from `printbox-md` (@lukstafi)
- introduce notion of extensions (@lukstafi)
- add `printbox-ext-plot` extension for text and HTML plots (@lukstafi)
- feat: add `?stretch` param to `frame`

- fix c-cube/printbox#45, problem with nested frames
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants