widecolor-demo: fix up summary box

This commit is contained in:
nick black 2019-12-04 05:10:48 -05:00
parent 01a03424f9
commit c5db91e247
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
2 changed files with 21 additions and 9 deletions

View File

@ -8,12 +8,12 @@
static int static int
message(struct ncplane* n, int maxy, int maxx, int num, int total){ message(struct ncplane* n, int maxy, int maxx, int num, int total){
uint64_t channels = 0;
notcurses_fg_prep(&channels, 255, 255, 255);
ncplane_bg_default(n); ncplane_bg_default(n);
ncplane_cursor_move_yx(n, 3, 1); ncplane_cursor_move_yx(n, 3, 1);
ncplane_fg_rgb8(n, 0, 0, 0);
ncplane_bg_rgb8(n, 255, 255, 255);
ncplane_styles_on(n, CELL_STYLE_BOLD); ncplane_styles_on(n, CELL_STYLE_BOLD);
if(ncplane_rounded_box(n, 0, 0, 5, 57, 0)){ if(ncplane_rounded_box(n, 0, channels, 5, 57, 0)){
return -1; return -1;
} }
ncplane_cursor_move_yx(n, 3, 4); ncplane_cursor_move_yx(n, 3, 4);
@ -23,7 +23,7 @@ message(struct ncplane* n, int maxy, int maxx, int num, int total){
ncplane_cursor_move_yx(n, 1, 4); ncplane_cursor_move_yx(n, 1, 4);
ncplane_putegc(n, "", 0, 0, NULL); ncplane_putegc(n, "", 0, 0, NULL);
cell hl = CELL_TRIVIAL_INITIALIZER; cell hl = CELL_TRIVIAL_INITIALIZER;
cell_load(n, &hl, ""); cell_prime(n, &hl, "", 0, channels);
ncplane_hline(n, &hl, 15); ncplane_hline(n, &hl, 15);
cell_release(n, &hl); cell_release(n, &hl);
ncplane_cursor_move_yx(n, 1, 20); ncplane_cursor_move_yx(n, 1, 20);

View File

@ -1542,21 +1542,33 @@ int ncplane_box(ncplane* n, const cell* ul, const cell* ur,
} }
++yoff; ++yoff;
// middle rows (vertical lines) // middle rows (vertical lines)
if(yoff < ystop - 1){ if(yoff < ystop){
if(!(ctlword & NCBOXMASK_LEFT)){ if(!(ctlword & NCBOXMASK_LEFT)){
if(ncplane_cursor_move_yx(n, yoff, xoff)){ if(ncplane_cursor_move_yx(n, yoff, xoff)){
return -1; return -1;
} }
if(ncplane_vline_interp(n, vl, ystop - yoff + 1, ul->channels, ll->channels) < 0){ if((ctlword & (NCBOXGRAD_LEFT << 4u))){ // grad styling, ul->ll
return -1; if(ncplane_vline_interp(n, vl, ystop - yoff + 1, ul->channels, ll->channels) < 0){
return -1;
}
}else{
if(ncplane_vline(n, vl, ystop - yoff + 1) < 0){
return -1;
}
} }
} }
if(!(ctlword & NCBOXMASK_RIGHT)){ if(!(ctlword & NCBOXMASK_RIGHT)){
if(ncplane_cursor_move_yx(n, yoff, xstop)){ if(ncplane_cursor_move_yx(n, yoff, xstop)){
return -1; return -1;
} }
if(ncplane_vline_interp(n, vl, ystop - yoff + 1, ur->channels, lr->channels) < 0){ if((ctlword & (NCBOXGRAD_RIGHT << 4u))){ // grad styling, ur->lr
return -1; if(ncplane_vline_interp(n, vl, ystop - yoff + 1, ur->channels, lr->channels) < 0){
return -1;
}
}else{
if(ncplane_vline(n, vl, ystop - yoff + 1) < 0){
return -1;
}
} }
} }
} }