YS-L / csvlens

Command line csv viewer
MIT License
2.47k stars 41 forks source link

Impossible to view full content of long multiline text cells in 0.8.0 #68

Closed confluence closed 5 months ago

confluence commented 5 months ago

I'm using csvlens on Linux to view exported Reddit comments. One of the columns contains long text content, which is markdown source, with double newlines separating paragraphs. A handful of very old comments have carriage return characters in addition to line feed characters at each newline, and they are affected differently (this may be significant).

In 0.7.0, when I wrap text with -S, I can see the full text in long text fields. Each blank line contains a single ellipsis character, unless it's one of the old comments with carriage returns, in which case the blank line is just blank.

In 0.8.0, whether I use -S or the new -W, all the long text fields are truncated with the ellipsis character at the first newline. The only way that I can find to view the full content is to tab to the cell and enter to output it to the terminal and exit the program. The comments with carriage returns are unaffected, and are displayed in full as expected.

I hadn't given this much thought before, but I guess that the presence of the ellipsis character in the blank lines in 0.7.0 was not intended behaviour, and something has now been fixed in the way that long text is displayed. I'm not sure if the truncation is intentional (and the carriage returns are breaking something) or if the full text display is intentional (and the lack of carriage returns is breaking something).

I would expect to be able to view the full content of long cells without having to exit csvlens, but I can also see the benefit of truncating the rows, so that a snippet of the text can be previewed (as in the view without text wrap, but with more lines). Perhaps this should be another wrap option, or a separate option? I've looked at the documentation, and unless I'm missing something there isn't an option for this now.

YS-L commented 5 months ago

Thanks for the detailed report! You are right, there is a regression in the handling of consecutive newlines in 0.8.0, though the ellipses characters in the prior versions are not intended either.

I pushed a fix to the main branch which should resolve both issues. Could you check if it works for you?

confluence commented 5 months ago

I've tested a build of the latest version, and both issues are resolved. Thank you!