X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=src%2Fviewer.c;h=89365bf4b76911c4c30bc51cc331e7d8535a05cb;hb=7a83ae3f48dc8ef279fb9168bd809048def70406;hp=56291dbc8adb7581bff953f128bd6d7240076c43;hpb=94a28d11cee6db33d9c456b395ed59f2631b08e5;p=smdp.git diff --git a/src/viewer.c b/src/viewer.c index 56291db..89365bf 100644 --- a/src/viewer.c +++ b/src/viewer.c @@ -61,6 +61,18 @@ static short red_ramp_invert[24] = { 15, 231, 231, 224, 224, 225, 206, 207, 201, 200, 199, 199, 198, 198, 197, 197, 196, 196}; +// unordered list characters +// +// override via env vars: +// export MDP_LIST_OPEN1=" " MDP_LIST_OPEN2=" " MDP_LIST_OPEN3=" " +// export MDP_LIST_HEAD1=" ■ " MDP_LIST_HEAD2=" ● " MDP_LIST_HEAD3=" ▫ " +static const char *list_open1 = " | "; +static const char *list_open2 = " | "; +static const char *list_open3 = " | "; +static const char *list_head1 = " +- "; +static const char *list_head2 = " +- "; +static const char *list_head3 = " +- "; + int ncurses_display(deck_t *deck, int notrans, int nofade, int invert, int reload, int noreload, int slidenum) { int c = 0; // char @@ -517,51 +529,29 @@ int ncurses_display(deck_t *deck, int notrans, int nofade, int invert, int reloa return reload; } -static const char *list_open1 = " | "; -static const char *list_open2 = " | "; -static const char *list_open3 = " | "; -static const char *list_head1 = " +- "; -static const char *list_head2 = " +- "; -static const char *list_head3 = " +- "; -/* - -export MDP_LIST_OPEN3=" " -export MDP_LIST_OPEN2=" " -export MDP_LIST_OPEN3=" " -export MDP_LIST_HEAD1=" ■ " -export MDP_LIST_HEAD2=" ▫ " -export MDP_LIST_HEAD3=" ● " - -export MDP_LIST_OPEN2=" │ " -export MDP_LIST_OPEN2=" │ " -export MDP_LIST_OPEN3=" │ " -export MDP_LIST_HEAD1=" ▇─ " -export MDP_LIST_HEAD2=" ▓─ " -export MDP_LIST_HEAD3=" ▒─ " -* -*/ void setup_list_strings(void) { const char *str; - if ((str = getenv("MDP_LIST_OPEN")) != NULL) { + /* utf8 can require 6 bytes */ + if ((str = getenv("MDP_LIST_OPEN")) != NULL && strlen(str) <= 4*6) { list_open1 = list_open2 = list_open3 = str; } else { - if ((str = getenv("MDP_LIST_OPEN1")) != NULL) + if ((str = getenv("MDP_LIST_OPEN1")) != NULL && strlen(str) <= 4*6) list_open1 = str; - if ((str = getenv("MDP_LIST_OPEN2")) != NULL) + if ((str = getenv("MDP_LIST_OPEN2")) != NULL && strlen(str) <= 4*6) list_open2 = str; - if ((str = getenv("MDP_LIST_OPEN3")) != NULL) + if ((str = getenv("MDP_LIST_OPEN3")) != NULL && strlen(str) <= 4*6) list_open3 = str; } - if ((str = getenv("MDP_LIST_HEAD")) != NULL) { + if ((str = getenv("MDP_LIST_HEAD")) != NULL && strlen(str) <= 4*6) { list_head1 = list_head2 = list_head3 = str; } else { - if ((str = getenv("MDP_LIST_HEAD1")) != NULL) + if ((str = getenv("MDP_LIST_HEAD1")) != NULL && strlen(str) <= 4*6) list_head1 = str; - if ((str = getenv("MDP_LIST_HEAD2")) != NULL) + if ((str = getenv("MDP_LIST_HEAD2")) != NULL && strlen(str) <= 4*6) list_head2 = str; - if ((str = getenv("MDP_LIST_HEAD3")) != NULL) + if ((str = getenv("MDP_LIST_HEAD3")) != NULL && strlen(str) <= 4*6) list_head3 = str; } }