Improve flipimage(); function, enable pango for item, add rtl lang support

for items with SGR colors
This commit is contained in:
speedie 2023-03-04 19:59:36 +01:00
parent 57f963c9ee
commit c1990916e3
4 changed files with 33 additions and 35 deletions

View file

@ -57,8 +57,9 @@ drawitem(struct item *item, int x, int y, int w)
if (item->text[rd + alen + 2] == 'm') { /* character is 'm' which is the last character in the sequence */
buffer[wr] = '\0'; /* clear out character */
rw = pango_item ? TEXTWM(buffer) : TEXTW(buffer) - lrpad;
drw_text(drw, x, y, rw + lp, bh, lp, buffer, 0, pango_item ? True : False);
apply_fribidi(buffer);
rw = TEXTW(buffer) - lrpad;
drw_text(drw, x, y, rw + lp, bh, lp, isrtl ? fribidi_text : buffer, 0, pango_item ? True : False);
x += rw + lp;
ib = 1;

View file

@ -1,15 +1,19 @@
void
flipimage(void)
{
if (!flip) return;
if (flip == 1) { /* horizontal */
switch (flip) {
case 1: /* horizontal */
imlib_image_flip_horizontal();
} else if (flip == 2) {
break;
case 2: /* vertical */
imlib_image_flip_vertical();
} else if (flip == 3) {
break;
case 3: /* diagonal */
imlib_image_flip_diagonal();
} else {
flip = 1;
break;
default:
flip = flip ? 1 : 0;
return;
}
}
@ -27,22 +31,15 @@ cleanupimage(void)
imlib_free_image();
image = NULL;
}
return;
}
void
drawimage(void)
{
#if !USEIMAGE
return;
#endif
int width = 0, height = 0;
char *limg = NULL;
if (!lines) return;
if (hideimage) return;
if (!lines || hideimage) return;
if (sel && sel->image && strcmp(sel->image, limg ? limg : "")) {
if (longestedge)

View file

@ -137,7 +137,7 @@ static char col_sgrcolor14[] = "#00ffff"; /* SGR color #14 */
static char col_sgrcolor15[] = "#ffffff"; /* SGR color #15 */
/* Pango options */
static int pango_item = 0; /* Enable support for pango markup for the items */
static int pango_item = 1; /* Enable support for pango markup for the items */
static int pango_highlight = 1; /* Enable support for pango markup for the highlighting */
static int pango_prompt = 1; /* Enable support for pango markup for the prompt */
static int pango_input = 1; /* Enable support for pango markup for user input */

View file

@ -30,7 +30,6 @@
#define USEXINERAMA 0
#endif
/* include right to left language library */
#if USERTL
#include <fribidi.h>
@ -750,6 +749,7 @@ navigatehistfile(int dir)
}
break;
}
if (p == NULL) {
return;
}