aboutsummaryrefslogtreecommitdiff
path: root/render.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-08-30 17:42:33 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-08-30 17:42:33 +0000
commite8d187e4f3068f9a35d4b9752f913cc0efe90a23 (patch)
treea20d0e379faae3dabf60ad8a25ea64c007bc7d1a /render.c
parentsearch: implement move cursor word backward/forward (diff)
render: draw (cursor) bar using the same thickness as underlines
Diffstat (limited to 'render.c')
-rw-r--r--render.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/render.c b/render.c
index 1611b972..e5ec9c90 100644
--- a/render.c
+++ b/render.c
@@ -101,6 +101,7 @@ font_baseline(const struct terminal *term)
static void
draw_bar(const struct terminal *term, pixman_image_t *pix,
+ const struct font *font,
const pixman_color_t *color, int x, int y)
{
int baseline = y + font_baseline(term) - term->fextents.ascent;
@@ -108,7 +109,7 @@ draw_bar(const struct terminal *term, pixman_image_t *pix,
PIXMAN_OP_SRC, pix, color,
1, &(pixman_rectangle16_t){
x, baseline,
- 1, term->fextents.ascent + term->fextents.descent});
+ font->underline.thickness, term->fextents.ascent + term->fextents.descent});
}
static void
@@ -259,7 +260,7 @@ render_cell(struct terminal *term, pixman_image_t *pix,
cursor_color = fg;
if (term->cursor_style == CURSOR_BAR)
- draw_bar(term, pix, &cursor_color, x, y);
+ draw_bar(term, pix, font, &cursor_color, x, y);
else if (term->cursor_style == CURSOR_UNDERLINE)
draw_underline(
term, pix, attrs_to_font(term, &cell->attrs), &cursor_color,
@@ -734,6 +735,7 @@ render_search_box(struct terminal *term)
PIXMAN_OP_SRC, buf->pix, &color,
1, &(pixman_rectangle16_t){0, 0, width, height});
+ struct font *font = &term->fonts[0];
int x = margin;
int y = margin;
pixman_color_t fg = color_hex_to_pixman(0x000000);
@@ -741,9 +743,9 @@ render_search_box(struct terminal *term)
/* Text (what the user entered - *not* match(es)) */
for (size_t i = 0; i < term->search.len; i++) {
if (i == term->search.cursor)
- draw_bar(term, buf->pix, &fg, x, y);
+ draw_bar(term, buf->pix, font, &fg, x, y);
- const struct glyph *glyph = font_glyph_for_wc(&term->fonts[0], term->search.buf[i]);
+ const struct glyph *glyph = font_glyph_for_wc(font, term->search.buf[i]);
if (glyph == NULL)
continue;
@@ -758,7 +760,7 @@ render_search_box(struct terminal *term)
}
if (term->search.cursor >= term->search.len)
- draw_bar(term, buf->pix, &fg, x, y);
+ draw_bar(term, buf->pix, font, &fg, x, y);
wl_subsurface_set_position(
term->wl.search_sub_surface,