aboutsummaryrefslogtreecommitdiff
path: root/render.c
diff options
context:
space:
mode:
Diffstat (limited to 'render.c')
-rw-r--r--render.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/render.c b/render.c
index 0828e21a..9b86cc72 100644
--- a/render.c
+++ b/render.c
@@ -2212,7 +2212,7 @@ render_search_box(struct terminal *term)
/* Calculate the width of each character */
int widths[text_len + 1];
for (size_t i = 0; i < text_len; i++)
- widths[i] = max(1, wcwidth(text[i]));
+ widths[i] = max(0, wcwidth(text[i]));
widths[text_len] = 0;
const size_t total_cells = wcswidth(text, text_len);
@@ -2403,10 +2403,16 @@ render_search_box(struct terminal *term)
x + glyph->x, y + font_baseline(term) - glyph->y,
glyph->width, glyph->height);
} else {
+ int combining_ofs = width == 0
+ ? (glyph->x < 0
+ ? width * term->cell_width
+ : (width - 1) * term->cell_width)
+ : 0; /* Not a zero-width character - no additional offset */
pixman_image_t *src = pixman_image_create_solid_fill(&fg);
pixman_image_composite32(
PIXMAN_OP_OVER, src, glyph->pix, buf->pix[0], 0, 0, 0, 0,
- x + glyph->x, y + font_baseline(term) - glyph->y,
+ x + combining_ofs + glyph->x,
+ y + font_baseline(term) - glyph->y,
glyph->width, glyph->height);
pixman_image_unref(src);
}