From: Simon Glass <simon.glass@canonical.com>
Add scene_txtin_close() to handle closing a text-input object. This
hides the cursor by calling vidconsole_readline_end().
Update scene_textline_send_key() to use the new helper when closing
on BKEY_QUIT.
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---
boot/scene_internal.h | 15 +++++++++++----
boot/scene_textline.c | 3 +--
boot/scene_txtin.c | 6 ++++++
3 files changed, 18 insertions(+), 6 deletions(-)
@@ -582,15 +582,22 @@ int scene_txtin_open(struct scene *scn, struct scene_obj *obj,
struct scene_txtin *tin);
/**
- * scene_textline_close() - Close a textline object
+ * scene_txtin_close() - Close a text-input object
*
* Close out the text editor after use
*
- * @scn: Scene containing the textline
- * @tline: textline object
+ * @scn: Scene containing the object
+ */
+void scene_txtin_close(struct scene *scn);
+
+/**
+ * scene_obj_calc_bbox() - Calculate bounding boxes for an object
+ *
+ * @obj: Object to process
+ * @bbox: Returns bounding boxes for object
* Return: 0 if OK, -ve on error
*/
-int scene_textline_close(struct scene *scn, struct scene_obj_textline *tline);
+int scene_obj_calc_bbox(struct scene_obj *obj, struct vidconsole_bbox *bbox);
/**
* scene_calc_arrange() - Calculate sizes needed to arrange a scene
@@ -114,8 +114,7 @@ int scene_textline_send_key(struct scene *scn, struct scene_obj_textline *tline,
memcpy(abuf_data(&tline->tin.buf), abuf_data(&scn->buf),
abuf_size(&scn->buf));
- /* cursor is not needed now */
- vidconsole_readline_end();
+ scene_txtin_close(scn);
} else {
event->type = EXPOACT_QUIT;
log_debug("menu quit\n");
@@ -104,6 +104,12 @@ static void scene_txtin_putch(struct cli_line_state *cls, int ch)
vidconsole_put_char(scn->expo->cons, ch);
}
+void scene_txtin_close(struct scene *scn)
+{
+ /* cursor is not needed now */
+ vidconsole_readline_end();
+}
+
int scene_txtin_open(struct scene *scn, struct scene_obj *obj,
struct scene_txtin *tin)
{