aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-08-29 19:03:00 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-08-29 19:03:00 +0000
commit2ca7400cc6ed922582adcd6a2455b6608a5a5f20 (patch)
tree78d914b6335b25ed2b57f7a6d9d8cfb74158005a
parentterm: add a 'cursor' (position) to the search state (diff)
render: render_search_box: draw cursor as a bar
-rw-r--r--render.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/render.c b/render.c
index eaba6b03..0be0d3d4 100644
--- a/render.c
+++ b/render.c
@@ -740,6 +740,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);
+
const struct glyph *glyph = font_glyph_for_wc(&term->fonts[0], term->search.buf[i]);
if (glyph == NULL)
continue;
@@ -754,6 +757,9 @@ render_search_box(struct terminal *term)
x += glyph->width;
}
+ if (term->search.cursor >= term->search.len)
+ draw_bar(term, buf->pix, &fg, x, y);
+
wl_subsurface_set_position(
term->wl.search_sub_surface,
term->width - width - margin, term->height - height - margin);