sc-im icon indicating copy to clipboard operation
sc-im copied to clipboard

Newlines within values in CSV identified as row separation.

Open 1a7r0ch3 opened this issue 4 years ago • 7 comments

In csv, comma separate values (columns), newlines separate rows. But there is a possibility to insert comma or newlines within values : as part of values given between quotes "like, this", or "like this".

It seems that sc-im is able to identify such literal comma, but not such literal newlines. That is "like, this" is correcty rendered within one cell, but "like this" is rendered as a cell containing like at the end of the row and a cell containing this'' at the begining of next row.

1a7r0ch3 avatar May 14 '20 09:05 1a7r0ch3

Hello. You think the \n should be kept as part of the cell content?

andmarti1424 avatar Mar 25 '21 01:03 andmarti1424

Indeed, as long as they are escaped within quotes.

Actually, I realize that such feature request is slightly more general than that, because having newlines within cell content raises the problem of displaying some cell content spanning over several lines. Currently, when the cell content width is larger than its column width, the content is displayed as stars "****", this is why I suppose that such behavior is not currently implemented, otherwise an other option would have been to wrap the cell content.

So this is actually two feature requests and one bonus :

  1. implementing display of cell content over several rows
  2. parsing newlines within double quotes as part of the cell content
  3. (bonus that comes with 1) giving the option to either wrap around or replace by stars cell content larger than the column width

1a7r0ch3 avatar Mar 25 '21 11:03 1a7r0ch3

Dont think merging of cells and the point 1 you commented above, would be implemented on this version of sc-im. And probably number 2 comes with those too. 3 is already implemented with overlap. when content exceeds current column width, it just overlaps with the next column to the right.

andmarti1424 avatar Mar 25 '21 11:03 andmarti1424

Merging of cells would be yet another interesting feature, substantially more involved I guess. Too bad that 1 (on which 2 and 3 rely) would not be implemented ; I must say I have no idea how difficult that would be, my knowledge of ncurses and of the internals of your great software being simply zero.

At the very least that would imply, for each row in the sheet, the computation of the maximum number of terminal lines over which the row needs to be displayed, and then having some rule for the vertical justification of cells of this row that span over less terminal rows than this maximum, and then render...

Thanks for the overlap option, which is already useful when cells with longer text are at the end of their rows.

I humbly suggest to keep this issue open, maybe some day...

1a7r0ch3 avatar Mar 25 '21 12:03 1a7r0ch3

I am currently trying to keep in issues only the bugs. And move feature request or enhancements to discussions. In there is a better place to discuss them

andmarti1424 avatar Mar 25 '21 17:03 andmarti1424

Alright, I started a discussion #534. Good luck with the bugs, thanks for the software.

1a7r0ch3 avatar Mar 25 '21 23:03 1a7r0ch3

So, autowrap is there :tada: thank you :) Now this still waits to be fixed, and it is actually a bug as this is a common feature of CSV.

xeruf avatar Oct 02 '21 15:10 xeruf