ncplot: don't print spaces #695

This commit is contained in:
nick black 2020-06-09 04:46:54 -04:00
parent 0e1617811f
commit 827c2f2013
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
2 changed files with 18 additions and 15 deletions

View File

@ -12,6 +12,7 @@ Run unit tests (`make && make test`):
Run, using `valgrind --tool=memcheck --leak-check=full`:
* `notcurses-demo` in each of the three multimedia configurations
* `notcurses-demo` with `USE_QRCODEGEN=off`
* `notcurses-demo` in ASCII mode (`export LANG=C`)
* `notcurses-ncreel`
* `notcurses-input`
* `notcurses-view` with each scaling mode and an image + video, in three

View File

@ -202,22 +202,24 @@ class ncppplot {
// we would have errored out during construction). even then, however,
// we need handle ASCII differently, since it can't print full block.
// in ASCII mode, egcidx != means swap colors and use space.
if(notcurses_canutf8(ncplane_notcurses(ncp)) || !sumidx){
if(ncplane_putwc_yx(ncp, dimy - y - 1, x, egc[sumidx]) <= 0){
return -1;
if(sumidx){
if(notcurses_canutf8(ncplane_notcurses(ncp))){
if(ncplane_putwc_yx(ncp, dimy - y - 1, x, egc[sumidx]) <= 0){
return -1;
}
}else{
const uint64_t swapbg = channels_bchannel(channels);
const uint64_t swapfg = channels_fchannel(channels);
channels_set_bchannel(&channels, swapfg);
channels_set_fchannel(&channels, swapbg);
ncplane_set_channels(ncp, channels);
if(ncplane_putsimple_yx(ncp, dimy - y - 1, x, ' ') <= 0){
return -1;
}
channels_set_bchannel(&channels, swapbg);
channels_set_fchannel(&channels, swapfg);
ncplane_set_channels(ncp, channels);
}
}else{
const uint64_t swapbg = channels_bchannel(channels);
const uint64_t swapfg = channels_fchannel(channels);
channels_set_bchannel(&channels, swapfg);
channels_set_fchannel(&channels, swapbg);
ncplane_set_channels(ncp, channels);
if(ncplane_putsimple_yx(ncp, dimy - y - 1, x, ' ') <= 0){
return -1;
}
channels_set_bchannel(&channels, swapbg);
channels_set_fchannel(&channels, swapfg);
ncplane_set_channels(ncp, channels);
}
if(done){
break;