dankamongmen / notcurses

blingful character graphics/TUI library. definitely not curses.
https://nick-black.com/dankwiki/index.php/Notcurses
Other
3.56k stars 112 forks source link

fix incorrect state reset after carriage return command #2785

Closed waveplate closed 3 months ago

waveplate commented 3 months ago

i ran into an issue with ncsixel_as_rgba where it always failed with sixel images exceeding 13 pixels in height

the cause of the issue seems to be

}else if(*sx == '$'){
  x = 0;
  state = STATE_WANT_HASH;

this prevents sixel images from being correctly parsed -- i haven't investigated what the sixel standard says about this, but img2sixel outputs don't follow carriage returns with a hash, just more data

changing STATE_WANT_HASH to STATE_WANT_DATA resolved the issue

in any case, i don't think this change is likely to break anything:

if(state == STATE_WANT_DATA){
  if(*sx == '#'){
    state = STATE_WANT_HASH;
    --sx;

as if a hash is encountered, it will just decrement the pointer and set the state to STATE_WANT_HASH

dankamongmen commented 3 months ago

ugh, sorry, i went and handled this when i saw your report in #2784. i thanked you in the commit and in the bug, but i preempted your PR =\ my bad =[