andmarti1424 / sc-im

sc-im - Spreadsheet Calculator Improvised -- An ncurses spreadsheet program for terminal
Other
4.77k stars 201 forks source link

Autoresize doesn't take newlines into account #848

Open hseg opened 10 months ago

hseg commented 10 months ago

\n is not treated specially when it comes to aa, making it compute much wider (and shorter) values for cell needs in case of multiline string content.

andmarti1424 commented 10 months ago

@hseg yes. it seems a bug. thanks for reporting it

andmarti1424 commented 1 month ago

@hseg, do you have a sample file? you have the newline char inside label? your file is a csv? thanks.

hseg commented 2 weeks ago

File is a SC spreadsheet, but this is clearest when manually writing the spreadsheet:

  1. Start a new SC spreadsheet
  2. In cell A0, run <multiline\nstring\nexample
  3. Notice the cell is too small, run aa. This makes the cell 25 characters wide (the width of multiline.string.example.) but still 1 tall, hiding the two other lines of the label

Playing around a little further, it appears that while the width is recognized as part of the format, the height isn't (fh,fl prompt Current format is messages, whereas fj,fk don't). So perhaps these need different semantics?

File is pasted below, for what it's worth

# This data file was generated by the Spreadsheet Calculator Improvised (sc-im)
# You almost certainly shouldn't edit it.

newsheet "Sheet1"
movetosheet "Sheet1"
offscr_sc_cols 0
offscr_sc_rows 0
nb_frozen_rows 0
nb_frozen_cols 0
nb_frozen_screenrows 0
nb_frozen_screencols 0
leftstring A0 = "multiline\nlabel\nexample"
goto A0
movetosheet "Sheet1"