allglyph: only render at end of line

This commit is contained in:
nick black 2020-06-03 03:22:43 -04:00
parent c55e4bb7bf
commit 8c8d862d23
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

View File

@ -12,21 +12,21 @@
// works on a scrolling plane // works on a scrolling plane
static int static int
allglyphs(struct notcurses* nc, struct ncplane* column){ allglyphs(struct notcurses* nc, struct ncplane* column){
const int PERIOD = 8;
const int valid_planes[] = { const int valid_planes[] = {
0, 1, 2, 3, 14, 15, 16, -1 0, 1, 2, 3, 14, 15, 16, -1
}; };
int period = 0; const int dimx = ncplane_dim_x(column);
for(const int* plane = valid_planes ; *plane >= 0 ; ++plane){ for(const int* plane = valid_planes ; *plane >= 0 ; ++plane){
for(long int c = 0 ; c < 0x10000l ; ++c){ for(long int c = 0 ; c < 0x10000l ; ++c){
wchar_t w[2] = { *plane * 0x10000l + c, L'\0' }; wchar_t w[2] = { *plane * 0x10000l + c, L'\0', };
if(wcswidth(w, UINT_MAX) >= 1){ if(wcwidth(w[0]) >= 1){
int x;
if(ncplane_putwegc(column, w, NULL) < 0){ if(ncplane_putwegc(column, w, NULL) < 0){
return -1; return -1;
} }
if(++period % PERIOD == 0){ ncplane_cursor_yx(column, NULL, &x);
if(x >= dimx){
DEMO_RENDER(nc); DEMO_RENDER(nc);
period = 0;
} }
} }
} }