mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-18 03:25:55 +00:00
special-case double/rounded boxes in ASCII #325
This commit is contained in:
parent
7b4ebed07d
commit
25baa10f72
@ -2008,11 +2008,9 @@ cells_load_box(struct ncplane* n, uint32_t attrs, uint64_t channels,
|
||||
return -1;
|
||||
}
|
||||
|
||||
static inline int
|
||||
cells_rounded_box(struct ncplane* n, uint32_t attr, uint64_t channels,
|
||||
cell* ul, cell* ur, cell* ll, cell* lr, cell* hl, cell* vl){
|
||||
return cells_load_box(n, attr, channels, ul, ur, ll, lr, hl, vl, "╭╮╰╯─│");
|
||||
}
|
||||
API int cells_rounded_box(struct ncplane* n, uint32_t attr, uint64_t channels,
|
||||
cell* ul, cell* ur, cell* ll, cell* lr,
|
||||
cell* hl, cell* vl);
|
||||
|
||||
static inline int
|
||||
ncplane_rounded_box(struct ncplane* n, uint32_t attr, uint64_t channels,
|
||||
@ -2039,11 +2037,9 @@ ncplane_rounded_box_sized(struct ncplane* n, uint32_t attr, uint64_t channels,
|
||||
x + xlen - 1, ctlword);
|
||||
}
|
||||
|
||||
static inline int
|
||||
cells_double_box(struct ncplane* n, uint32_t attr, uint64_t channels,
|
||||
cell* ul, cell* ur, cell* ll, cell* lr, cell* hl, cell* vl){
|
||||
return cells_load_box(n, attr, channels, ul, ur, ll, lr, hl, vl, "╔╗╚╝═║");
|
||||
}
|
||||
API int cells_double_box(struct ncplane* n, uint32_t attr, uint64_t channels,
|
||||
cell* ul, cell* ur, cell* ll, cell* lr,
|
||||
cell* hl, cell* vl);
|
||||
|
||||
static inline int
|
||||
ncplane_double_box(struct ncplane* n, uint32_t attr, uint64_t channels,
|
||||
|
@ -2122,3 +2122,24 @@ char* ncplane_contents(const ncplane* nc, int begy, int begx, int leny, int lenx
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int cells_ascii_box(struct ncplane* n, uint32_t attr, uint64_t channels,
|
||||
cell* ul, cell* ur, cell* ll, cell* lr, cell* hl, cell* vl){
|
||||
return cells_load_box(n, attr, channels, ul, ur, ll, lr, hl, vl, "/\\\\/-|");
|
||||
}
|
||||
|
||||
int cells_double_box(struct ncplane* n, uint32_t attr, uint64_t channels,
|
||||
cell* ul, cell* ur, cell* ll, cell* lr, cell* hl, cell* vl){
|
||||
if(enforce_utf8(n->nc)){
|
||||
return cells_load_box(n, attr, channels, ul, ur, ll, lr, hl, vl, "╔╗╚╝═║");
|
||||
}
|
||||
return cells_ascii_box(n, attr, channels, ul, ur, ll, lr, hl, vl);
|
||||
}
|
||||
|
||||
int cells_rounded_box(struct ncplane* n, uint32_t attr, uint64_t channels,
|
||||
cell* ul, cell* ur, cell* ll, cell* lr, cell* hl, cell* vl){
|
||||
if(enforce_utf8(n->nc)){
|
||||
return cells_load_box(n, attr, channels, ul, ur, ll, lr, hl, vl, "╭╮╰╯─│");
|
||||
}
|
||||
return cells_ascii_box(n, attr, channels, ul, ur, ll, lr, hl, vl);
|
||||
}
|
||||
|
@ -495,12 +495,11 @@ ncmultiselector_draw(ncmultiselector* n){
|
||||
if(printidx == n->current){
|
||||
n->ncp->channels = (uint64_t)channels_bchannel(n->descchannels) << 32u | channels_fchannel(n->descchannels);
|
||||
}
|
||||
// FIXME this is the wrong place to do this. see https://github.com/dankamongmen/notcurses/issues/451
|
||||
if(enforce_utf8(n->ncp->nc)){
|
||||
if(enforce_utf8(n->ncp->nc)){
|
||||
ncplane_putegc_yx(n->ncp, yoff, bodyoffset, n->items[printidx].selected ? "☒" : "☐", NULL);
|
||||
}else{
|
||||
ncplane_putsimple_yx(n->ncp, yoff, bodyoffset, n->items[printidx].selected ? 'X' : '-');
|
||||
}
|
||||
}else{
|
||||
ncplane_putsimple_yx(n->ncp, yoff, bodyoffset, n->items[printidx].selected ? 'X' : '-');
|
||||
}
|
||||
n->ncp->channels = n->opchannels;
|
||||
if(printidx == n->current){
|
||||
n->ncp->channels = (uint64_t)channels_bchannel(n->opchannels) << 32u | channels_fchannel(n->opchannels);
|
||||
|
Loading…
Reference in New Issue
Block a user