From e6bbcd2e701c3061c8065b5816679fe3a7ac5a1f Mon Sep 17 00:00:00 2001 From: nick black Date: Sat, 29 Feb 2020 18:16:19 -0500 Subject: [PATCH] Selector: properly place scroll arrows #388 When the selector body was being sized by the header or footer (as opposed to option+desc length), our scroll arrows are misplaced. They now land properly. Mouse clicks are properly placed now, and screenshots have been updated in the guide. --- src/lib/selector.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/lib/selector.c b/src/lib/selector.c index b7ed7d8de..448723b7d 100644 --- a/src/lib/selector.c +++ b/src/lib/selector.c @@ -77,14 +77,16 @@ ncselector_draw(ncselector* n){ for(int i = xoff + 1 ; i < dimx - 1 ; ++i){ ncplane_putc(n->ncp, &n->background); } + const int bodyoffset = dimx - bodywidth + 2; if(n->maxdisplay && n->maxdisplay < n->itemcount){ n->ncp->channels = n->descchannels; - ncplane_putegc_yx(n->ncp, yoff, bodywidth - (n->longdesc + 3) + xoff, "↑", NULL); + n->arrowx = bodyoffset + n->longop; + ncplane_putegc_yx(n->ncp, yoff, n->arrowx, "↑", NULL); + }else{ + n->arrowx = -1; } - n->arrowx = bodywidth - (n->longdesc + 3) + xoff; n->uarrowy = yoff; unsigned printidx = n->startdisp; - int bodyoffset = dimx - bodywidth + 2; unsigned printed = 0; for(yoff += 1 ; yoff < dimy - 2 ; ++yoff){ if(n->maxdisplay && printed == n->maxdisplay){ @@ -116,7 +118,7 @@ ncselector_draw(ncselector* n){ } if(n->maxdisplay && n->maxdisplay < n->itemcount){ n->ncp->channels = n->descchannels; - ncplane_putegc_yx(n->ncp, yoff, bodywidth - (n->longdesc + 3) + xoff, "↓", NULL); + ncplane_putegc_yx(n->ncp, yoff, n->arrowx, "↓", NULL); } n->darrowy = yoff; return notcurses_render(n->ncp->nc);