mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-10 01:29:05 -04:00
[plots] always return -1 on x below window
This commit is contained in:
parent
346e7354a0
commit
af62226f69
@ -510,9 +510,7 @@ create_##T(nc##X##plot* ncpp, ncplane* n, const ncplot_options* opts, const T mi
|
||||
reset them, and write the new sample anywhere. otherwise, write it to the \
|
||||
proper slot based on the current newest slot. */ \
|
||||
int window_slide_##T(nc##X##plot* ncp, int64_t x){ \
|
||||
if(x < ncp->plot.slotx - (ncp->plot.slotcount - 1)){ /* x is behind window, won't be counted */ \
|
||||
return -1; \
|
||||
}else if(x <= ncp->plot.slotx){ /* x is within window, do nothing */ \
|
||||
if(x <= ncp->plot.slotx){ /* x is within window, do nothing */ \
|
||||
return 0; \
|
||||
} /* x is newest; we might be keeping some, might not */ \
|
||||
int64_t xdiff = x - ncp->plot.slotx; /* the raw amount we're advancing */ \
|
||||
@ -548,6 +546,9 @@ static void update_sample_##T(nc##X##plot* ncp, int64_t x, T y, bool reset); \
|
||||
the window are lost. The first call will place the initial window. The plot \
|
||||
will be redrawn, but notcurses_render() is not called. */ \
|
||||
int add_sample_##T(nc##X##plot* ncpp, int64_t x, T y){ \
|
||||
if(x < ncpp->plot.slotx - (ncpp->plot.slotcount - 1)){ /* x is behind window, won't be counted */ \
|
||||
return -1; \
|
||||
} \
|
||||
if(y == 0 && x <= ncpp->plot.slotx){ \
|
||||
return 0; /* no need to redraw plot; nothing changed */ \
|
||||
} \
|
||||
|
Loading…
x
Reference in New Issue
Block a user