mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-02 09:40:15 +00:00
force LTR override on UC_BIDI_AL #1204
This commit is contained in:
parent
1bbbdd9dc0
commit
2ff20108c8
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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)))){
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user