-
-
Notifications
You must be signed in to change notification settings - Fork 275
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
fixed width saver truncates data if columns are not fully expanded #1849
Comments
Hmm... Looking at the code, it looks like the truncation behaviour is intentional? visidata/visidata/loaders/fixed_width.py Line 87 in d40fc93
I wouldn't normally expect a display mode to change the underlying data. Also, I suspect there's something funny going on here, which is leaving us with a missing space in the truncated version: visidata/visidata/loaders/fixed_width.py Line 95 in d40fc93
|
Yes, this behavior is (somewhat) intentional; the widths of the columns indicate the fixed widths of the fields. This is so you can set them precisely, in case the fixed file format has an exact specification. I agree though that it's undesirable to have the data truncated otherwise. What's the better thing to do here? Find the max width and use it instead of the column width, if it's larger? and warn or ask for confirmation if this is the case? |
@daviewales, do you have a preference wrt:
|
My preference would be to always use the true max width by default, so data is never truncated. Truncation could be a separate feature which you explicitly opt into. (Save view vs save data?) Admittedly, my use case for this is non-standard. |
Okay, I pushed that change to |
Thanks @anjakefala. I've had a play, but it's not quite what I had in mind. |
Hey @daviewales ! Can you draw in ascii what you are intending to happen? With the example lines above? |
Hi @geekscrapy, In ASCII:
Perhaps I have misunderstood how @anjakefala's patch works? |
Looking at the code in 77ae017, I can see that if I set the sheet However, this has other side-effects. It's not something that you'd want to set in your |
This is a bug; if |
I guess my issue is that I like having |
Small description
If you save or syscopy a table as
fixed
format, and the visible column width is less than the width of the data in the column, the data is truncated. Also, the resulting file is not a valid fixed width format file as the columns are not aligned with the headers.Expected result
Saving or copying a table when the columns are not fully expanded should yield the same result as when the columns are expanded.
Actual result with screenshot
Steps to reproduce with sample data and a .vd
test-vd-fixed.zip
Additional context
saul.pw/VisiData v2.11
The text was updated successfully, but these errors were encountered: