[Concept,09/16] expo: Fix text-input buffer size for CLI editing

Message ID 20260122041155.174721-10-sjg@u-boot.org
State New
Headers
Series expo: Add multiline editing support for textedit |

Commit Message

Simon Glass Jan. 22, 2026, 4:11 a.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

The CLI line-editing initialisation uses tin->line_chars as the buffer
size, but this is actually the nominal line width for text wrapping, not
the buffer capacity. For textline objects the two are the same, but for
textedit the buffer is much larger than a single line.

Use abuf_size() to get the actual buffer capacity instead.

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---

 boot/scene_txtin.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Patch

diff --git a/boot/scene_txtin.c b/boot/scene_txtin.c
index 43a6c00d497..338c7da63d3 100644
--- a/boot/scene_txtin.c
+++ b/boot/scene_txtin.c
@@ -142,7 +142,7 @@  int scene_txtin_open(struct scene *scn, struct scene_obj *obj,
 
 	vidconsole_set_cursor_pos(cons, ctx, txt->obj.bbox.x0, txt->obj.bbox.y0);
 	vidconsole_entry_start(cons, ctx);
-	cli_cread_init(cls, abuf_data(&tin->buf), tin->line_chars);
+	cli_cread_init(cls, abuf_data(&tin->buf), abuf_size(&tin->buf));
 	cls->insert = true;
 	cls->putch = scene_txtin_putch;
 	cls->priv = scn;