diff options
author | terminaldweller <thabogre@gmail.com> | 2022-04-22 07:57:07 +0000 |
---|---|---|
committer | terminaldweller <thabogre@gmail.com> | 2022-04-22 07:57:07 +0000 |
commit | 56fea8379e38e010ca082a8d29e6de4be2697501 (patch) | |
tree | 49b7202142d4747569a39d8af02f79b84cdcb795 /dmenu-bidi-20210723-b34d318.diff | |
parent | remove center patch, it doesnt have a switch (diff) | |
download | dmenu-56fea8379e38e010ca082a8d29e6de4be2697501.tar.gz dmenu-56fea8379e38e010ca082a8d29e6de4be2697501.zip |
added the bidi patch
Diffstat (limited to '')
-rw-r--r-- | dmenu-bidi-20210723-b34d318.diff | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/dmenu-bidi-20210723-b34d318.diff b/dmenu-bidi-20210723-b34d318.diff new file mode 100644 index 0000000..9e0465c --- /dev/null +++ b/dmenu-bidi-20210723-b34d318.diff @@ -0,0 +1,54 @@ +diff --git a/dmenu.c b/dmenu.c +index 65f25ce..389916b 100644 +--- a/dmenu.c ++++ b/dmenu.c +@@ -113,6 +116,26 @@ cistrstr(const char *s, const char *sub) + return NULL; + } + ++static void ++apply_fribidi(char *str) ++{ ++ FriBidiStrIndex len = strlen(str); ++ FriBidiChar logical[BUFSIZ]; ++ FriBidiChar visual[BUFSIZ]; ++ FriBidiParType base = FRIBIDI_PAR_ON; ++ FriBidiCharSet charset; ++ fribidi_boolean result; ++ ++ fribidi_text[0] = 0; ++ if (len>0) ++ { ++ charset = fribidi_parse_charset("UTF-8"); ++ len = fribidi_charset_to_unicode(charset, str, len, logical); ++ result = fribidi_log2vis(logical, len, &base, visual, NULL, NULL, NULL); ++ len = fribidi_unicode_to_charset(charset, visual, len, fribidi_text); ++ } ++} ++ + static int + drawitem(struct item *item, int x, int y, int w) + { +@@ -123,7 +146,8 @@ drawitem(struct item *item, int x, int y, int w) + else + drw_setscheme(drw, scheme[SchemeNorm]); + +- return drw_text(drw, x, y, w, bh, lrpad / 2, item->text, 0); ++ apply_fribidi(item->text); ++ return drw_text(drw, x, y, w, bh, lrpad / 2, fribidi_text, 0); + } + + static void +@@ -143,7 +167,8 @@ drawmenu(void) + /* draw input field */ + w = (lines > 0 || !matches) ? mw - x : inputw; + drw_setscheme(drw, scheme[SchemeNorm]); +- drw_text(drw, x, 0, w, bh, lrpad / 2, text, 0); ++ apply_fribidi(text); ++ drw_text(drw, x, 0, w, bh, lrpad / 2, fribidi_text, 0); + + curpos = TEXTW(text) - TEXTW(&text[cursor]); + if ((curpos += lrpad / 2 - 1) < w) { +-- +2.32.0 + |