don't call egc_rtl() on negative bytes

This commit is contained in:
nick black 2020-12-05 00:38:04 -05:00 committed by Nick Black
parent 0cba073cc9
commit ea18be772a

View File

@ -983,11 +983,9 @@ pool_blit_direct(egcpool* pool, cell* c, const char* gcluster, int bytes, int co
static inline int static inline int
pool_load_direct(egcpool* pool, cell* c, const char* gcluster, int bytes, int cols){ pool_load_direct(egcpool* pool, cell* c, const char* gcluster, int bytes, int cols){
if(bytes <= 1){ char* rtl = NULL;
c->channels &= ~(CELL_WIDEASIAN_MASK | CELL_NOBACKGROUND_MASK); if(cols < 2){
}else if(cols < 2){
c->channels &= ~CELL_WIDEASIAN_MASK; c->channels &= ~CELL_WIDEASIAN_MASK;
// FIXME also shaded blocks! ░ etc. are there combined EGCs involving these?
if(bytes == 3 && memcmp(gcluster, "\xe2\x96\x88", 4) == 0){ if(bytes == 3 && memcmp(gcluster, "\xe2\x96\x88", 4) == 0){
c->channels |= CELL_NOBACKGROUND_MASK; c->channels |= CELL_NOBACKGROUND_MASK;
}else{ }else{
@ -997,7 +995,9 @@ pool_load_direct(egcpool* pool, cell* c, const char* gcluster, int bytes, int co
c->channels |= CELL_WIDEASIAN_MASK; c->channels |= CELL_WIDEASIAN_MASK;
c->channels &= ~CELL_NOBACKGROUND_MASK; c->channels &= ~CELL_NOBACKGROUND_MASK;
} }
char* rtl = egc_rtl(gcluster, &bytes); // checks for RTL and adds U+200E if so if(bytes >= 0){
rtl = egc_rtl(gcluster, &bytes); // checks for RTL and adds U+200E if so
}
if(rtl){ if(rtl){
gcluster = rtl; gcluster = rtl;
} }