expo: Correct rendering of textlines when open

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>
This commit is contained in:
Simon Glass
2025-12-07 06:26:43 -07:00
parent 7c059e682e
commit 21f4b4d8dc

View File

@@ -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;
uint i;
scene_render_deps(scn, tline->label_id);
scene_render_deps(scn, tline->edit_id);
/* 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);