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

libsmartcols: wrap does not work correctly in start/middle column #269

Closed
ignatenkobrain opened this issue Feb 3, 2016 · 2 comments
Closed

Comments

@ignatenkobrain
Copy link
Contributor

screenshot from 2016-02-03 01-51-11

screenshot from 2016-02-03 01-53-11

But it works perfectly with last column:
screenshot from 2016-02-03 01-54-07

@karelzak
Copy link
Collaborator

karelzak commented Feb 4, 2016

Yes, we do not use \n ... the problem is that we're trying to print all the cell when we print one line, but it's multi-line cell. The best would be to print a table line in a loop until there is any multi-line column and all cell data are not printed yet.

The result should be something like:

AAA    BBB     CCC                            DDD
  1    hello   long multi-line                something
               cells are supported
  2       hi   short data                     another data    

... where CCC is WRAP column with multi-line cell on line 1. I'll try to implement it. It would be useful for more things.

karelzak added a commit that referenced this issue Feb 10, 2016
The initial implementation has been introduced by SCOLS_FL_WRAP columns,
but this patch clean ups all and makes things more elegant.

Note that use SCOLS_FL_TREE | SCOLS_FL_WRAP for a column is bad idea
and I don't think we need to fix it.

References: #269
Signed-off-by: Karel Zak <kzak@redhat.com>
@karelzak
Copy link
Collaborator

$ make ./sample-scols-wrap
$ ./sample-scols-wrap 
NAME                DESC       FOO                         LIKE TEXT                   
A-N-AAAAAAAAAAx     A-D-AAAAAx A-U-AAAAAAAAAAAAAAAAAAAAAAA    1 A-T-AAAAAAAAAAAAAAAAAAA
│                              AAAAAAAAAAAAAAAAAAAAAAAAAAA      AAAAAAAAAAAAAAAAAAAAAAA
│                              xxxxxxxxxxxxxxxxxxxxxxxxxxx      AAAxxxxxxxxxxxxxxxxxxxx
├─aa-N-aaaaaaaaax   aa-D-aaaax aa-U-aaaaaaaaaaaaaaaaaaaaaa    1 aa-T-aaaaaaaaaaaaaaaaaa
│                              aaaaaaaaaaaaaaaaaaaaaaaaaaa      aaaaaaaaaaaaaaaaaaaaaaa
│                              xxxxxxxxxxxxxxxxxxxxxxxxxxx      aaaxxxxxxxxxxxxxxxxxxxx
└─ab-N-aaaaaaaaax   ab-D-aaaax ab-U-aaaaaaaaaaaaaaaaaaaaaa    1 ab-T-aaaaaaaaaaaaaaaaaa
                               aaaaaaaaaaaaaaaaaaaaaaaaaaa      aaaaaaaaaaaaaaaaaaaaaaa
                               xxxxxxxxxxxxxxxxxxxxxxxxxxx      aaaxxxxxxxxxxxxxxxxxxxx

... where FOO and TEXT are SCOLS_FL_WRAP columns with long text.

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