force LTR override on UC_BIDI_AL #1204

This commit is contained in:
nick black 2020-12-15 03:26:14 -05:00
parent 1bbbdd9dc0
commit 2ff20108c8
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
4 changed files with 29 additions and 6 deletions

View File

@ -67,8 +67,8 @@ allglyphs(struct notcurses* nc, struct ncplane* column, int legendy,
random() % 192 + 64,
random() % 192 + 64,
random() % 192 + 64);
struct timespec ts = { .tv_sec = 0, .tv_nsec = 100000000, };
nanosleep(&ts, NULL);
//struct timespec ts = { .tv_sec = 0, .tv_nsec = 100000000, };
//nanosleep(&ts, NULL);
}
}
}

View File

@ -950,7 +950,8 @@ egc_rtl(const char* egc, int* bytes){
return NULL;
}
const int bidic = uc_bidi_category(w);
if(bidic != UC_BIDI_R && bidic != UC_BIDI_RLE && bidic != UC_BIDI_RLO){
//fprintf(stderr, "BIDI CAT (%lc): %d\n", w, bidic);
if(bidic != UC_BIDI_R && bidic != UC_BIDI_AL && bidic != UC_BIDI_RLE && bidic != UC_BIDI_RLO){
return NULL;
}
// insert U+200E, "LEFT-TO-RIGHT MARK". This ought reset the text direction

View File

@ -74,7 +74,7 @@ progbar_redraw(ncprogbar* n){
while((delt < 0 && pos > progress) || (delt > 0 && pos < progress)){
double chunk = n->progress - (covered * eachcell);
const wchar_t egc = egcs[chunk >= eachcell ? 7 : (int)(chunk / (eachcell / 8))];
fprintf(stderr, "nprog: %g egc: %lc progress: %g pos: %d range: %d delt: %d chunk: %g each: %g\n", n->progress, egc, progress, pos, range, delt, chunk, eachcell);
//fprintf(stderr, "nprog: %g egc: %lc progress: %g pos: %d range: %d delt: %d chunk: %g each: %g\n", n->progress, egc, progress, pos, range, delt, chunk, eachcell);
if(horizontal){
for(int freepos = 0 ; freepos < dimy ; ++freepos){
if(notcurses_canutf8(ncplane_notcurses(ncprogbar_plane(n)))){

View File

@ -2,10 +2,10 @@
#include <notcurses/notcurses.h>
int main(void){
struct notcurses_options nopts = {
struct notcurses_options opts = {
.flags = NCOPTION_NO_ALTERNATE_SCREEN,
};
struct notcurses* nc = notcurses_init(&nopts, NULL);
struct notcurses* nc = notcurses_init(&opts, NULL);
if(!nc){
return EXIT_FAILURE;
}
@ -23,6 +23,28 @@ int main(void){
notcurses_stop(nc);
return EXIT_FAILURE;
}
const char* brew = "םבעברஸீரோகிரிﻧﻠﻘﺻﺮﻴﻧﻖﺻﺭoshitﻠﺷﻮﻗﻠﺴﻛﺮﻳﺓ";
const char *b = brew;
for(int y = dimy / 2 + 2 ; y < dimy ; ++y){
for(int x = 0 ; x < dimx ; ++x){
int bytes;
if(ncplane_putegc_yx(n, y, x, b, &bytes) <= 0){
break;
}
b += bytes;
if(!*b){
b = brew;
}
}
}
struct ncplane_options nopts = {
.y = dimy / 2 + 3,
.x = 8,
.rows = dimy - (dimy / 2 + 5),
.cols = dimx - 8 * 2,
};
struct ncplane* top = ncplane_create(n, &nopts);
ncplane_set_base(top, " ", 0, 0);
if(notcurses_render(nc)){
notcurses_stop(nc);
return EXIT_FAILURE;