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

the option 'calign' does not work with '#draw grid table' #230

Open
peddn opened this issue Aug 21, 2024 · 3 comments
Open

the option 'calign' does not work with '#draw grid table' #230

peddn opened this issue Aug 21, 2024 · 3 comments

Comments

@peddn
Copy link

peddn commented Aug 21, 2024

Hello,

when I draw a table with the command '#draw calign grid table', it seems that the option 'calign' is no longer taken into account. Here is an example:

#draw calign grid table {2} {2} {8} {42} {n;s;w;e} {n;s;w;e}; produces:

┌─────────┬─────────┬─────────┬─────────┐
│n        │s        │w        │e        │
│         │         │         │         │
├─────────┼─────────┼─────────┼─────────┤
│n        │s        │w        │e        │
│         │         │         │         │
└─────────┴─────────┴─────────┴─────────┘

#draw calign table {2} {2} {8} {42} {n;s;w;e} {n;s;w;e}; produces:

┌────────┐┌────────┐┌────────┐┌────────┐
│   n    ││   s    ││   w    ││   e    │
└────────┘└────────┘└────────┘└────────┘
┌────────┐┌────────┐┌────────┐┌────────┐
│   n    ││   s    ││   w    ││   e    │
└────────┘└────────┘└────────┘└────────┘

I also noticed that the tables are different heights.

I am new to TinTin++ and it is quite possible that I am just using the command incorrectly. I would be very grateful for any help.

@scandum
Copy link
Owner

scandum commented Aug 22, 2024

Hi there,

The grid table code could definitely use some more work. I've added calign to my todo list, but due to complexities involved it may not be an easy fix.

I don't think there's a good solution for the height difference?

@peddn
Copy link
Author

peddn commented Aug 23, 2024

If you think about it more closely, this is certainly not a trivial problem. It would be great to have the grid table with centered text.

My first attempt for a workaround was to add the leading and trailing spaces to the string for the cell content, but it seems that these spaces are automatically removed. So now I just use '#draw calign line' for the cell contents and hard-code the positions and width.

Regarding the height of the tables, I couldn't think of a reasonable solution to make sure that both table types have the same height. After thinking about it for a while, I'm also not sure whether this feature is needed at all...

I would also like to take this opportunity to express my thanks for such wonderful open source software. Please keep up the great work.

@peddn peddn changed the title the option 'calign' does not work with '#draw grid tabel' the option 'calign' does not work with '#draw grid table' Aug 23, 2024
@scandum
Copy link
Owner

scandum commented Aug 23, 2024

I initially thought it was part of the grid code being a bit quirky, but this actually turned out to be a bug that was easy to fix. Tintin was accidentally removing the calign flag in the grid code.

Centering and a few other formatting options should now work in the beta source code:

https://mudhalla.net/tintin-beta.tar.gz

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

No branches or pull requests

2 participants