From c227fb7cc9e30d6a4330cdad34b0b2a53b014d93 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Mon, 9 May 2022 18:02:30 -0700 Subject: web: add support for child DOM elements and text nodes --- web/web_prompt.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'web/web_prompt.c') diff --git a/web/web_prompt.c b/web/web_prompt.c index 3b5bc68..3f5521a 100644 --- a/web/web_prompt.c +++ b/web/web_prompt.c @@ -89,13 +89,22 @@ static void flush_list_opts() for (int i = 0; i < list_optc; ++i) { struct dom_elem *e = dom_elem_init(NULL, "div", 2); - asprintf(&e->content, "[%d] %s", i + 1, list_optv[i]); dom_elem_add_attr(e, "class", "key"); char buf[64]; sprintf(buf, "append:%d;submit", i + 1); dom_elem_add_attr(e, "data-command", buf); + struct dom_elem *child; + child = dom_elem_init(NULL, "span", 1); + asprintf(&child->content, "[%d]", i + 1); + dom_elem_add_attr(child, "class", "keyboard-val"); + dom_elem_add_child(e, child); + + sprintf(buf, "\u2002%s", list_optv[i]); + child = dom_text_init(buf); + dom_elem_add_child(e, child); + elemv[i] = e; } -- cgit v1.2.3-70-g09d2