dankamongmen / notcurses

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

`ncprogbar_options` is different in implementation and in docs #2639

Closed OBenjaminT closed 2 years ago

OBenjaminT commented 2 years ago

I have no context but this is confusing and seems wrong.

Documentation

Claims it's made of three uint64_t.

USAGE.md

typedef struct ncprogbar_options {
  // channels for the maximum and minimum points. linear interpolation will be
  // applied across the domain between these two.
  uint64_t maxchannels;
  uint64_t minchannels;
  uint64_t flags;
} ncprogbar_options;

doc/man/man3/notcurses_progbar.3.md

typedef struct ncprogbar_options {
  uint64_t maxchannels;
  uint64_t minchannels;
  uint64_t flags;
} ncprogbar_options;

Implementation

Assumes it's actually four uint32_t and one uint64_t

include/notcurses/notcurses.h

typedef struct ncprogbar_options {
  uint32_t ulchannel; // upper-left channel. in the context of a progress bar,
  uint32_t urchannel; // "up" is the direction we are progressing towards, and
  uint32_t blchannel; // "bottom" is the direction of origin. for monochromatic
  uint32_t brchannel; // bar, all four channels ought be the same.
  uint64_t flags;
} ncprogbar_options;

src/lib/progbar.c

ret->ulchannel = opts->ulchannel;
ret->urchannel = opts->urchannel;
ret->blchannel = opts->blchannel;
ret->brchannel = opts->brchannel;
ret->retrograde = opts->flags & NCPROGBAR_OPTION_RETROGRADE;
dankamongmen commented 2 years ago

love love love this close reading you're doing of the docs vis-a-vis the implementation! i should be able to get to this and your other one this evening, hopefully. thanks so much!

OBenjaminT commented 2 years ago

I'm just reporting what I stumble across.

There's no real rush, I'm working on v3.0.7 and not master, and this isn't a coding bug that breaks stuff anyway.

I do love the responsiveness though! Definitely encouraging me to keep going and trust the project's progress.

dankamongmen commented 2 years ago

if people are going to take their time to help improve my baby, the very least i can do is confirm receipt and perform cursory initial triage as soon as i see it =]

dankamongmen commented 2 years ago

Updated!