From: Simon Glass <simon.glass@canonical.com>
When a textline is open, we must render the edit string and show the
cursor. The easiest way to do this is to draw the string again, then
move the cursor back to the correct place.
There is no need to change the font, since the rendering function
handles this.
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---
boot/scene_textline.c | 29 +++++++++++------------------
1 file changed, 11 insertions(+), 18 deletions(-)
@@ -189,28 +189,21 @@ int scene_textline_render_deps(struct scene *scn,
{
const bool open = tline->obj.flags & SCENEOF_OPEN;
struct udevice *cons = scn->expo->cons;
- struct scene_obj_txt *txt;
- int ret;
-
- scene_render_deps(scn, tline->label_id);
- scene_render_deps(scn, tline->edit_id);
+ uint i;
- /* show the vidconsole cursor if open */
+ /* if open, render the edit text on top of the background */
if (open) {
- /* get the position within the field */
- txt = scene_obj_find(scn, tline->edit_id, SCENEOBJT_NONE);
- if (!txt)
- return log_msg_ret("cur", -ENOENT);
-
- if (txt->gen.font_name || txt->gen.font_size) {
- ret = vidconsole_select_font(cons,
- txt->gen.font_name,
- txt->gen.font_size);
- } else {
- ret = vidconsole_select_font(cons, NULL, 0);
- }
+ int ret;
ret = vidconsole_entry_restore(cons, &scn->entry_save);
+ if (ret)
+ return log_msg_ret("sav", ret);
+ scene_render_obj(scn, tline->edit_id);
+
+ /* move cursor back to the correct position */
+ for (i = scn->cls.num; i < scn->cls.eol_num; i++)
+ vidconsole_put_char(cons, '\b');
+ ret = vidconsole_entry_save(cons, &scn->entry_save);
if (ret)
return log_msg_ret("sav", ret);