From patchwork Thu Jan 22 04:11:29 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1760 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055134; bh=lX8iTN0dOK0FBdYqe2xn4LLDtddFJPyROxFQRrZFQCE=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=ceby6hC4+Orovj9sluv4K7vnAO1tsUyKYl9ep0CZvMsmHuSwnVjVT1eucp4B4+tQD khJTD5hpkJBtKAIZcovW8vPyxEOEjL44JDQ7Wj+ll/WeCQ+YUtEY/rNiF1T5qC3P8y tzOKCtE6OCXdjtqDNfq9qq6VlhY/vg3RzrXtwF1XkRZvhZcSU2rpxSdUrJNdLPgOHW lCKymsIsNBYY+YB06SqVq/Dw/KPpolu4ZXTA0LDMnREXg+giqbiGlk0hjjNbntOs8V T/sB66qYkZYyg4Lv7Ivxa202tBvuS/tfwc/KvIpmeyGHdJZ9pGjYnCgaq4HoX5A8W9 2J/zQ4yVH6ATA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9E1246962D for ; Wed, 21 Jan 2026 21:12:14 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 7YZiw9Ve5FbY for ; Wed, 21 Jan 2026 21:12:14 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055132; bh=lX8iTN0dOK0FBdYqe2xn4LLDtddFJPyROxFQRrZFQCE=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=bJ0O67oJUqJcavh4gj2j+CENSidwO4Vcn9Xj4bvA0Qml6b/S7N9UeH5oiq3Os+4rM 3PApFGOzUVcDYJSYfF6rvhAGYgt1O1vwLGXqcovr1HZR4dHcnixzg/U6POFk6IuEhy lGOoasTanu0URk0f6+tv6hl7/Dk1L417tSr7fNUWJoumOylXTe4ZQb298uonEmT/7j JWM3ZZL5On6hZUNkLqe5e9TdkbiNeZaQNtFLeWOSHhWDjWzuJipygXh7E8BN7jdyme fMUEB6swLE9am6WcdGEMiX+0HNa84aBhLOQc/jnXYMYBUySdKsA/JYjkJIpCClLMuU Ly5cH+FpOUr3Q== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9E5E369636 for ; Wed, 21 Jan 2026 21:12:12 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055131; bh=xl/IL5KhbjpZu6YtzcMKP8P+qeK/g+EyBIMmitqoesw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XX3D8huKoG7tJjWnyVV2OubSemGw6WVhzn1zC3i6HGvO/B0rNCTv6dgPYwpn6dCNO wJRjikVht4jQUFcZhsg8kPM144mNF4aML8hSv836SgSIcQuQ8GFxGRmiaedal8S+YV DpMrScMnLBkbtRhuoutm+n5xsEaWzd1Eg4YLSYjAeUTO38UkZAmvQdy1gK7QebpYeh D7a15hUergFlrDNNTcXe1W1SdWpvxWhaalUNekWEXKSZ2gNjCaknzdVwtuH6uiWIf2 B8p0F63YI7LNvJ8tROAiN7gbtmJOn2PIWsK0Qgy5rxmXqCfSloAs4R5Q7gmYralF4W SbYt3CKk8Sz4g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id DF578694CC; Wed, 21 Jan 2026 21:12:11 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id tAXnqOVM-PbW; Wed, 21 Jan 2026 21:12:11 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055131; bh=JZAesGw1oF2lfaSKxoDvjpbFhq1AodSu46a7mJBzdTs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u15ePjg0ct5P0a3E5a7ZSLVGEwmmwLn9E/w02TphWjyjlgZmfWlJE0c074EnSCoB2 /VT1odW5cOh2nP7AWkV9GW40Nb7AI66cVYnY5VoyIbJvss9qzx5Heim5ddyJ5dLywk ONmzgfO1GBkSuPtjSqr3kc5f389KHsagHuJW5toj9AkHrhVGxhqSyFCj8p/MKY1bzo 426pfDlz9WbDOGRMWyo8Icktt0ThyNwH8k8LQQu4eQJhMF3ucxe8BbmCF59z5WKL8t k8IKrcXE732wEmbcsHCw7yS23u0Hu8cwoH5hDd9RiWwMWNTjKiV+TnTOUt/3l9eKni RdxJ1HRP3GyRA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 4BF8669486; Wed, 21 Jan 2026 21:12:11 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 21 Jan 2026 21:11:29 -0700 Message-ID: <20260122041155.174721-2-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260122041155.174721-1-sjg@u-boot.org> References: <20260122041155.174721-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 47C2B6J3DOE4ZXVG6PVJJLWIQYEROREI X-Message-ID-Hash: 47C2B6J3DOE4ZXVG6PVJJLWIQYEROREI X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 01/16] video: Update vidconsole_idle() to process all contexts List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Update vidconsole_idle() to handle cursor display for all contexts, not just the default one. This ensures that cursors in client-allocated contexts (such as expo text-input objects) are properly shown during idle time. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- drivers/video/vidconsole-uclass.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index b6bd3133037..513c8f3bacb 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -1064,9 +1064,8 @@ void vidconsole_set_bitmap_font(struct udevice *dev, struct vidconsole_ctx *ctx, ctx->xstart_frac = 0; } -void vidconsole_idle(struct udevice *dev) +static void vidconsole_idle_ctx(struct udevice *dev, struct vidconsole_ctx *ctx) { - struct vidconsole_ctx *ctx = vidconsole_ctx(dev); struct vidconsole_cursor *curs = &ctx->curs; /* Only handle cursor if it's enabled */ @@ -1080,6 +1079,15 @@ void vidconsole_idle(struct udevice *dev) } } +void vidconsole_idle(struct udevice *dev) +{ + struct vidconsole_priv *priv = dev_get_uclass_priv(dev); + struct vidconsole_ctx **ctxp; + + alist_for_each(ctxp, &priv->ctx_list) + vidconsole_idle_ctx(dev, *ctxp); +} + #ifdef CONFIG_CURSOR void vidconsole_readline_start(struct udevice *dev, void *vctx, bool indent) { From patchwork Thu Jan 22 04:11:30 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1761 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055138; bh=7048jpdLtrRp+aDglourQTZ93M0pClO+ZhQu2BE6z34=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=bRy4Mwbd/8OzZT6Go2tj1vfVy/bmYfraJ97QBYHoBeERXZwPvpBeuhItICIEI8YPY ac50QEE0MFpCRAl5IU1rhVFuik8FE+s/7GUur76G4uT2MDiG0zoN7w16ZmEOp8nZH2 FhX8Jhx3hueZNSFLixQRsMvzQjbHlJCGiOy7iuHunXPpmUjAgecditwtNQyT+b2aj3 8D4sSmw9X07yf3dPhhIQwG/OvHgIcCwcoE1942NSqrrox7Bvlcw9xZNQA1W+gtGCsg HRgvYYPcFzQ/eYkueOHWSiAKYD89DVkQHXIJvP/iMRsuo969GbcHnUZA2dC0QedAhV PoXOTPwM50eBw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6266A6962C for ; Wed, 21 Jan 2026 21:12:18 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id Y8WkFqN0qQSC for ; Wed, 21 Jan 2026 21:12:18 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055138; bh=7048jpdLtrRp+aDglourQTZ93M0pClO+ZhQu2BE6z34=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=bRy4Mwbd/8OzZT6Go2tj1vfVy/bmYfraJ97QBYHoBeERXZwPvpBeuhItICIEI8YPY ac50QEE0MFpCRAl5IU1rhVFuik8FE+s/7GUur76G4uT2MDiG0zoN7w16ZmEOp8nZH2 FhX8Jhx3hueZNSFLixQRsMvzQjbHlJCGiOy7iuHunXPpmUjAgecditwtNQyT+b2aj3 8D4sSmw9X07yf3dPhhIQwG/OvHgIcCwcoE1942NSqrrox7Bvlcw9xZNQA1W+gtGCsg HRgvYYPcFzQ/eYkueOHWSiAKYD89DVkQHXIJvP/iMRsuo969GbcHnUZA2dC0QedAhV PoXOTPwM50eBw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4FF9269628 for ; Wed, 21 Jan 2026 21:12:18 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055136; bh=dTBGCVVnlztztDyaCYwnHDa5hnHenDIqNmP22f+91rw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m6XGfQQP2jxS+GESPWQr5C7DNGRkrYHIEEI0igQGt4g2EmOtDaIcFeWjdVQO72KBe j4UIOn7Px/tI5zqgXR1NmZJWi2kAwPo4Cy6A3R0EjhhlvSVbeIR2j2sT08osepq8hQ F5407kC0XPCXw0oyE/WoMZJSBvf5Pm39rFF3yjMm6F7FxIRTwNVXAKP34Q8DBg98aW 3k/uVV/L3Hd6IxHLierBRxpA/LAShkaDJ0uqXwBZqlwhENaMK8bX75q60Xd5y9tJaa C7SrtSvD48ulzSPWuuI/ajMr3jUrVHdC/7QI8zvwrMmwEi5huZfb/94rZM8AfO2e4p 88cD0RQ3hy3fw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E5953694CC; Wed, 21 Jan 2026 21:12:16 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id kJw5zPd1LqOC; Wed, 21 Jan 2026 21:12:16 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055132; bh=prmocH9srSrx+A9aDmB0tGs31yM3niqz9VA6VTfu1Hk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=flYXlw4RTHGT5iU0JkLuM3YIIHXI2v8ouQzavEfDSJLbqxFymG1lXSt7cE+M8NhO8 ScXqCJ/GFkhbVRtyLSiRfi+TaoKkjlzn0lbCcsOcDzByXQW2dWn/5OFY8k3lgvSkiZ fZcYlb/by1YnvhpUhwhpT7qUckRS2RgM5el0ufuexRtqyRNGA9XlfrHVqeOPBhKlWl ixq3P1kjBt1prrMDyetqJPLcWp4Ey/ZQ2WNbuIRScB1PP2EHVPcXel+gxa0RINyvdH 6gtIfpqYjxmidIyHhBDR5ECeATYujaedR1uCAgV7uin54DvAMe9AlNaT6aecQU1sEz XMb4EKbL8j9yQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 68BBB69631; Wed, 21 Jan 2026 21:12:12 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 21 Jan 2026 21:11:30 -0700 Message-ID: <20260122041155.174721-3-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260122041155.174721-1-sjg@u-boot.org> References: <20260122041155.174721-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 7IAVTNWPRNCMDGVOQ7YINW37KOXIHZYC X-Message-ID-Hash: 7IAVTNWPRNCMDGVOQ7YINW37KOXIHZYC X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 02/16] expo: Add tin parameter to scene_txtin_close() List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Add a text-input info parameter to scene_txtin_close() to prepare for passing the vidconsole context when closing. For now the caller passes NULL but this will be updated in a later commit. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- boot/scene_internal.h | 3 ++- boot/scene_txtin.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/boot/scene_internal.h b/boot/scene_internal.h index d9ca1fef90e..71cbc85c358 100644 --- a/boot/scene_internal.h +++ b/boot/scene_internal.h @@ -588,8 +588,9 @@ int scene_txtin_open(struct scene *scn, struct scene_obj *obj, * Close out the text editor after use * * @scn: Scene containing the object + * @tin: Text-input info */ -void scene_txtin_close(struct scene *scn); +void scene_txtin_close(struct scene *scn, struct scene_txtin *tin); /** * scene_obj_calc_bbox() - Calculate bounding boxes for an object diff --git a/boot/scene_txtin.c b/boot/scene_txtin.c index 9b8edcc6439..1dfa3a02a6a 100644 --- a/boot/scene_txtin.c +++ b/boot/scene_txtin.c @@ -106,7 +106,7 @@ static void scene_txtin_putch(struct cli_line_state *cls, int ch) vidconsole_put_char(scn->expo->cons, NULL, ch); } -void scene_txtin_close(struct scene *scn) +void scene_txtin_close(struct scene *scn, struct scene_txtin *tin) { /* cursor is not needed now */ vidconsole_readline_end(scn->expo->cons, NULL); @@ -180,7 +180,7 @@ int scene_txtin_send_key(struct scene_obj *obj, struct scene_txtin *tin, memcpy(abuf_data(&tin->buf), abuf_data(&scn->buf), abuf_size(&scn->buf)); - scene_txtin_close(scn); + scene_txtin_close(scn, NULL); } else { event->type = EXPOACT_QUIT; log_debug("menu quit\n"); From patchwork Thu Jan 22 04:11:31 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1762 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055141; bh=oMu+emmXZv57t+Gu8VuNWjAscu45klghRgskKiUzO8U=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=ZpXisIJ4ii4sPfm8dRWiBwJc6ubkgLm1r2d23p1Y2xL2LJPuylAVi136tU0hpdVT/ iJ7IHGUl38YN4nbowChiLrnbub2ds2ItqsYejzZwYKTPDtrXcFhFGCp1ojFX3C+Pjo 68cDoZnXPHmTctPUXVy1CmCy7IeDjizW6aF7KDFNsiSxTXXRDeYCbyH2MgAFiVd7yv +KkKZ1ncMi9uqaDSpHE0Lffi4FJZL6lu6auMbnNdipb8ErdCBjD4L5wnP/Dj0zuYne Pumn8DOuFI0eM3YFLoxbxNbiAzyuVWtUGslesLIhCEjHsF8MsHKlDpWdV+2nUdyJmE nM57iyJdBCI7w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0E56E6962D for ; Wed, 21 Jan 2026 21:12:21 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id l4QetoNo3Roq for ; Wed, 21 Jan 2026 21:12:20 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055139; bh=oMu+emmXZv57t+Gu8VuNWjAscu45klghRgskKiUzO8U=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=X0oSgVc9s3OwGkRPYboHiR4TU2/u+BEhf66jiqt6dbDHeiyXCNL2WIeWDg0g2SloE BR0tpu6omromA6IiyNr1gkd2U8oIPllapNcpFn7D5OyjSYZjDdEKSh5zq+eoTMqSpy Sakls51EhnnBO85TLfBVbkKGm1nZ3Zs2dhqFP5XTEJqtZCgp0PuV0uXidwuubSlPgZ 1fk1JW/IvUh1/uPfNPrE8Khi2mTnfXR8DwCu2aMmW7dl2XwSUXgjEz2L0bcgAH0z/l s+dKSFViLXxaLlfeeMRPSQfoKXK/NuhSFvYbSYotb2TM+Vgw3J14cDZMBBEazcexDN L28zzPE+6YBlw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0B8DB694CC for ; Wed, 21 Jan 2026 21:12:19 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055137; bh=cqEZ9o8yQMslFq4aZej0qwS3XMeh4PSKEuVv2uW2Spg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pTDh9y6EvMq0+wP+ODNvUHE9DlKBT5KxxBRr8dhObQGv5s6nAYNHZ88Slp1HE+yAc x0m53ik2am+KuKs6QLtB/ZnA/c4hABd9RQCJnif1ux305TVEtEnb0/ctWuqvUQshAT lXKsARU9Bz58M+cZPqG3uJarAlLN7pBYbNnG2o3bUtdXbN15o1FktUAtEpWRZLblT8 Sw7SjFaF/+45aBEPale9ZWxBjjnwpaaGowg5hQyFO5u/ARyuGohlazQ0QES+6tielE f20O5bQBhs2EG6XQTsPtgF/ZyliINVQEPB4iajIyiXTl8P+OfRvEcMK/2glfZXkm5c P1xNptkiUgyEA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id BAC20694CC; Wed, 21 Jan 2026 21:12:17 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id FRDBqIlIws6z; Wed, 21 Jan 2026 21:12:17 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055137; bh=jNSKMMCaHI/mj861gwTbXjGjsr+1WdaJRqxWqxR+83o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F1fcRpZ5ft6NKzn/ZcGuV/Cq3MVt1Dm8kvjCxxk3Ithum7CFcuEAD62y49HgUktHg +A34MybU8C4QT1zZ+YKeruvkdNQKYXJAp2YoWpUsKnnhid/vVC36isClFzdm9cLbDm 2ydSyOFPAsYTBqVbVixaSKtV4uwCrQYdIgDKg6ITeM6h6MXzdEkgVjdqUviaxGYOWX INsAa9AG2MNoF0KzljOFWT68n/cWWAWJi3goUoPA36M3Y54uL2+t+U6MYd6g/BDnZe 6NA2qzXJfTdcWw1ddJfUjdBmV3nZKOi4YRmTsyenFQMZj2rKrwRLSi3AgJFBSKiwKq gBdybZiArzXCg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 3FA2F69616; Wed, 21 Jan 2026 21:12:17 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 21 Jan 2026 21:11:31 -0700 Message-ID: <20260122041155.174721-4-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260122041155.174721-1-sjg@u-boot.org> References: <20260122041155.174721-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: KSG3YOEANG5YVH5GXHYGN7E22IXLSHCG X-Message-ID-Hash: KSG3YOEANG5YVH5GXHYGN7E22IXLSHCG X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 03/16] test: expo: Use expo_enter_mode() in textline render test List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass The expo_render_textline test renders text-input objects without calling expo_enter_mode(). This leaves manual_sync disabled, allowing the video idle function to run and show cursors unexpectedly during rendering. Add expo_enter_mode() at the start of the test and expo_exit_mode() at the end to enable manual sync mode, preventing idle cursor updates from interfering with the framebuffer comparisons. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- test/boot/expo.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/boot/expo.c b/test/boot/expo.c index f94927eb6b7..2ace10994b6 100644 --- a/test/boot/expo.c +++ b/test/boot/expo.c @@ -1433,6 +1433,7 @@ static int expo_render_textline(struct unit_test_state *uts) ut_assertok(create_test_expo(uts, &exp, &scn, &menu, &buf, &logo_copy)); dev = exp->display; + expo_enter_mode(exp); id = scene_textline(scn, "textline", OBJ_TEXTLINE, 20, &tline); ut_assert(id > 0); @@ -1528,6 +1529,7 @@ static int expo_render_textline(struct unit_test_state *uts) abuf_uninit(&buf); abuf_uninit(&logo_copy); + expo_exit_mode(exp); expo_destroy(exp); return 0; From patchwork Thu Jan 22 04:11:32 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1763 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055145; bh=J8lTpJK4F1tZVvVUL6R+W/WY560/+Ka2/YHP8NlmNnY=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=XXQv7d/StCR2V+6IvsTwg+lTUaAB071TJ9c6gCWdqsWF6oA4LkpYMJahJFRSjm/EI ChqjzpAYJ1Q/L72VqyTm/2IbgAPDxwNAiAA+gUXWgb+4bu5rLrpaPuQGCz7/HV1N95 gcwfqssRT0M5Z3ThE1UWMzjDzWmGpwmABSMu4rZ1fXYr4WQz3qFVtS8aWBsLaV3VAm IgqN00qGJPgqP0l7SSNLcvmwuMCduQD1VcibewhcqsXjGIOxfjQK9d7YaZItWDOF3G 8gDvYh+zvF79JiWjkSaI5/kWTJ/AWDIJCzuzihRU0eZsqijNkDHJeYJf2TuvDvlPIk xaFfqlarSLsiQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id EA1E96962A for ; Wed, 21 Jan 2026 21:12:25 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id p_rH6ZLXBj2V for ; Wed, 21 Jan 2026 21:12:25 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055145; bh=J8lTpJK4F1tZVvVUL6R+W/WY560/+Ka2/YHP8NlmNnY=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=XXQv7d/StCR2V+6IvsTwg+lTUaAB071TJ9c6gCWdqsWF6oA4LkpYMJahJFRSjm/EI ChqjzpAYJ1Q/L72VqyTm/2IbgAPDxwNAiAA+gUXWgb+4bu5rLrpaPuQGCz7/HV1N95 gcwfqssRT0M5Z3ThE1UWMzjDzWmGpwmABSMu4rZ1fXYr4WQz3qFVtS8aWBsLaV3VAm IgqN00qGJPgqP0l7SSNLcvmwuMCduQD1VcibewhcqsXjGIOxfjQK9d7YaZItWDOF3G 8gDvYh+zvF79JiWjkSaI5/kWTJ/AWDIJCzuzihRU0eZsqijNkDHJeYJf2TuvDvlPIk xaFfqlarSLsiQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D954769627 for ; Wed, 21 Jan 2026 21:12:25 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055143; bh=MgvnZeOgEBCWOuVb6EvGXFx7G4BACspRN+EVYGBCWq0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wGWzlAENxQlY/mIUr/uwFIDjCOjGuugaP3TXIg+1MoaVA7L5/SSDZe3s7VLx4tBsM jXKVdsFa1Eox5jdwGWP5BWCCm8+JONutLTw8zp6WeSSka4bYF1jqd/HrnernZ6YcEI 7P+EoL1sMD6fMMsRJZzXkb0dxXCKAKMcK6vwA2iS6KFZfDz+gwAn3DIjAjZYZ9Cqda HBGiV/Z7uEPFKA4lSkIcay8atqB6nxYwl4L8kUFohNxCm0OQybJ6nr+Q4L/cBfLGSr BTbDmcJaxu5G46X7PHO4Vnm5zawaTgxgYRJJ1UOeoHU0ytyHo8JYRLOR0UWAroLcAf R+qDjCLEvG16Q== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 58B3E69616; Wed, 21 Jan 2026 21:12:23 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id 1aRNh_tNnATV; Wed, 21 Jan 2026 21:12:23 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055138; bh=APCv7RKxa5kjra59IBgGYBNCOaBI1XkXE0gZ9qY+lAk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wm2yQylohDjs18snZhP7ZOdxB7PT+G9bG0ftXnSosmvoel0lbhXMQye7dNvf1ZGOa F9H8aPgPeZ5+WfsDRDmhzNX9LPUsjr3iFLyHBDsWKMAg8IxG/UKmviAxy9gWUKs6z+ KS3X63difjA+7mjj++zbJnMUecE2porUVERDmqlqaAqU/HFaXPtY9D7Dc9GqT3f50m hmmMaaxL0VO6kteuWVtEODBiqZDHFwhi3aAZzDxuBObXF/bVO9USdR+Pcni9hvNDXg CXanNPtUcElXnVhYB6AqEvVpK5iGRQxORFZf4jpzcVroFGNbfh90XZmljFHR38+Jo9 OHxwHIixsSy8w== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 4ABC869627; Wed, 21 Jan 2026 21:12:18 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 21 Jan 2026 21:11:32 -0700 Message-ID: <20260122041155.174721-5-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260122041155.174721-1-sjg@u-boot.org> References: <20260122041155.174721-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 4TBZOQ5WRHPCVZ72XHWD4OWHJ2FBKIIN X-Message-ID-Hash: 4TBZOQ5WRHPCVZ72XHWD4OWHJ2FBKIIN X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 04/16] expo: Use a dedicated vidconsole-context for text input List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Currently text-input objects (textline, textedit) use the default vidconsole context (NULL). This causes the cursor state to be shared with other vidconsole operations, leading to interference. Add a dedicated vidconsole context (ctx) to struct scene_txtin and use it for all vidconsole operations. The context is created when the text-input is opened and disposed when the object is destroyed. Also add scene_txtin_destroy() to properly clean up the text buffer and vidconsole context when text-input objects are destroyed. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- boot/scene.c | 3 +++ boot/scene_internal.h | 10 ++++++++++ boot/scene_txtin.c | 37 ++++++++++++++++++++++++++++--------- include/expo.h | 2 ++ 4 files changed, 43 insertions(+), 9 deletions(-) diff --git a/boot/scene.c b/boot/scene.c index 7cef20dbb1b..1ea0d1b1c46 100644 --- a/boot/scene.c +++ b/boot/scene.c @@ -108,6 +108,9 @@ void scene_obj_destroy(struct scene_obj *obj) { if (obj->type == SCENEOBJT_MENU) scene_menu_destroy((struct scene_obj_menu *)obj); + else if (obj->type == SCENEOBJT_TEXTLINE || + obj->type == SCENEOBJT_TEXTEDIT) + scene_txtin_destroy(obj->scene, scene_obj_txtin(obj)); free(obj->name); free(obj); } diff --git a/boot/scene_internal.h b/boot/scene_internal.h index 71cbc85c358..3c22b10c2f4 100644 --- a/boot/scene_internal.h +++ b/boot/scene_internal.h @@ -521,6 +521,16 @@ void scene_menu_calc_bbox(struct scene_obj_menu *menu, */ int scene_txtin_init(struct scene_txtin *tin, uint size, uint line_chars); +/** + * scene_txtin_destroy() - Destroy a text-input object's resources + * + * Frees memory allocated for the text buffer and vidconsole context + * + * @scn: Scene containing the object + * @tin: Text-input info to destroy + */ +void scene_txtin_destroy(struct scene *scn, struct scene_txtin *tin); + /** * scene_txtin_arrange() - Arrange common parts of a text-input object * diff --git a/boot/scene_txtin.c b/boot/scene_txtin.c index 1dfa3a02a6a..457d782b4cf 100644 --- a/boot/scene_txtin.c +++ b/boot/scene_txtin.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include "scene_internal.h" @@ -30,6 +31,13 @@ int scene_txtin_init(struct scene_txtin *tin, uint size, uint line_chars) return 0; } +void scene_txtin_destroy(struct scene *scn, struct scene_txtin *tin) +{ + abuf_uninit(&tin->buf); + if (tin->ctx && scn->expo->cons) + vidconsole_ctx_dispose(scn->expo->cons, tin->ctx); +} + int scene_txtin_arrange(struct scene *scn, struct expo_arrange_info *arr, struct scene_obj *obj, struct scene_txtin *tin) { @@ -66,6 +74,7 @@ int scene_txtin_render_deps(struct scene *scn, struct scene_obj *obj, struct cli_line_state *cls = &tin->cls; const bool open = obj->flags & SCENEOF_OPEN; struct udevice *cons = scn->expo->cons; + void *ctx = tin->ctx; uint i; /* if open, render the edit text on top of the background */ @@ -75,16 +84,16 @@ int scene_txtin_render_deps(struct scene *scn, struct scene_obj *obj, ret = vidconsole_entry_restore(cons, &scn->entry_save); if (ret) return log_msg_ret("sav", ret); - scene_render_obj(scn, tin->edit_id, NULL); + scene_render_obj(scn, tin->edit_id, ctx); /* move cursor back to the correct position */ for (i = cls->num; i < cls->eol_num; i++) - vidconsole_put_char(cons, NULL, '\b'); + vidconsole_put_char(cons, ctx, '\b'); ret = vidconsole_entry_save(cons, &scn->entry_save); if (ret) return log_msg_ret("sav", ret); - vidconsole_show_cursor(cons, NULL); + vidconsole_show_cursor(cons, ctx); } return 0; @@ -101,15 +110,16 @@ int scene_txtin_render_deps(struct scene *scn, struct scene_obj *obj, */ static void scene_txtin_putch(struct cli_line_state *cls, int ch) { + struct scene_txtin *tin = container_of(cls, struct scene_txtin, cls); struct scene *scn = cls->priv; - vidconsole_put_char(scn->expo->cons, NULL, ch); + vidconsole_put_char(scn->expo->cons, tin->ctx, ch); } void scene_txtin_close(struct scene *scn, struct scene_txtin *tin) { /* cursor is not needed now */ - vidconsole_readline_end(scn->expo->cons, NULL); + vidconsole_readline_end(scn->expo->cons, tin->ctx); } int scene_txtin_open(struct scene *scn, struct scene_obj *obj, @@ -118,8 +128,17 @@ int scene_txtin_open(struct scene *scn, struct scene_obj *obj, struct cli_line_state *cls = &tin->cls; struct udevice *cons = scn->expo->cons; struct scene_obj_txt *txt; + void *ctx; int ret; + ctx = tin->ctx; + if (!ctx) { + ret = vidconsole_ctx_new(cons, &ctx); + if (ret) + return log_msg_ret("ctx", ret); + tin->ctx = ctx; + } + /* Copy the text into the scene buffer in case the edit is cancelled */ memcpy(abuf_data(&scn->buf), abuf_data(&tin->buf), abuf_size(&scn->buf)); @@ -129,8 +148,8 @@ int scene_txtin_open(struct scene *scn, struct scene_obj *obj, if (!txt) return log_msg_ret("cur", -ENOENT); - vidconsole_set_cursor_pos(cons, NULL, txt->obj.bbox.x0, txt->obj.bbox.y0); - vidconsole_entry_start(cons, NULL); + 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); cls->insert = true; cls->putch = scene_txtin_putch; @@ -141,7 +160,7 @@ int scene_txtin_open(struct scene *scn, struct scene_obj *obj, return log_msg_ret("sav", ret); /* make sure the cursor is visible */ - vidconsole_readline_start(cons, NULL, true); + vidconsole_readline_start(cons, ctx, true); return 0; } @@ -180,7 +199,7 @@ int scene_txtin_send_key(struct scene_obj *obj, struct scene_txtin *tin, memcpy(abuf_data(&tin->buf), abuf_data(&scn->buf), abuf_size(&scn->buf)); - scene_txtin_close(scn, NULL); + scene_txtin_close(scn, tin); } else { event->type = EXPOACT_QUIT; log_debug("menu quit\n"); diff --git a/include/expo.h b/include/expo.h index afaf1e8d107..adbe02922ab 100644 --- a/include/expo.h +++ b/include/expo.h @@ -509,6 +509,7 @@ struct scene_menitem { * @edit_id: ID of the editable text object (not string ID) * @line_chars: Nominal number of characters in a line * @buf: Text buffer containing current text + * @ctx: Vidconsole context for this text-input object * @cls: CLI line state for text editing */ struct scene_txtin { @@ -516,6 +517,7 @@ struct scene_txtin { uint edit_id; uint line_chars; struct abuf buf; + void *ctx; struct cli_line_state cls; }; From patchwork Thu Jan 22 04:11:33 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1764 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055150; bh=SL7Hp4fXmrzjoQP7nOzro0WJef3y4hoRzr64ud9HBmA=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=tEGKs9Edh+Cwm+d/Er3KZr3dlxsoBNgH82mIp5GxWr0fCfmL4+OsvBmaBEV8h+Md5 xbAaarlinLa7gFNzX0ZoNCOv8ZxPySKwYNNBJWS4npsw+VHZQXMqDGkzif0WILU8ZH LMuCDnESioC9m87M02dK6VZ4ovwnRCuEDrf1w6u6oYKrGhEj+7aWibf0g5S40uZQpb fSU+NN4I3m6stnr5cI/XyaB72HngRstpO8ERInTh8/cK0f57hTzGZNtL7mEZPmuval RTExKKw88St/0jK9nFDYL3x9SWzUaqNSP32CBMTk4aDB13Z5A8UAC/zlXDCWNypGMu VuvWXCp/viC7w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 756986962C for ; Wed, 21 Jan 2026 21:12:30 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id LeXLJM_YMwvA for ; Wed, 21 Jan 2026 21:12:30 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055150; bh=SL7Hp4fXmrzjoQP7nOzro0WJef3y4hoRzr64ud9HBmA=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=tEGKs9Edh+Cwm+d/Er3KZr3dlxsoBNgH82mIp5GxWr0fCfmL4+OsvBmaBEV8h+Md5 xbAaarlinLa7gFNzX0ZoNCOv8ZxPySKwYNNBJWS4npsw+VHZQXMqDGkzif0WILU8ZH LMuCDnESioC9m87M02dK6VZ4ovwnRCuEDrf1w6u6oYKrGhEj+7aWibf0g5S40uZQpb fSU+NN4I3m6stnr5cI/XyaB72HngRstpO8ERInTh8/cK0f57hTzGZNtL7mEZPmuval RTExKKw88St/0jK9nFDYL3x9SWzUaqNSP32CBMTk4aDB13Z5A8UAC/zlXDCWNypGMu VuvWXCp/viC7w== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 63C5069627 for ; Wed, 21 Jan 2026 21:12:30 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055148; bh=hXaowbvh7DDI/H255KlySvo4bnMhuY8Y/zjXUziVjQ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uyjWTCekpd0pEbmlYbUZ7CDUy+1h/ETGaF+2woGAxLo7/hGgOTJhTyjEKYfhhx++u 7HxOKJU3CG34xPIi7TLsPe3QHwcaE1Xsr4JQekfGICYjRPeRO6zQuVK0FYVIgQfnTx WzOodzqyRn9ze4ASjuY179owMiXp3iZfxmTaTJEUdgz28NBN3QLfZ5wsnaMGzJUk0f +R5RiaLSLBeQjd0GkzQQyCD177OLNR5nZ4M3sz82gn3HMDmUTgU1IvmLp5Smgf/x/U mHAeCWZkaI6H9FhHXuZlWbnV19PYmFNwOTUQhTrwxqi53MUx7JK15tSGMhxmqvBIU1 hm4u5Nsx3xm8g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 716EF69627; Wed, 21 Jan 2026 21:12:28 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id hBPqcLd4ph0e; Wed, 21 Jan 2026 21:12:28 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055143; bh=tyVjh4BTVPSn6EGYPcuzrKe+gj4HemvD7/dK9yUF01g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BXK4abJZVs/6IWVYBE6FolmyHjRgLYbzNyx74U7LG82vvgEYDluNy9h/AW5JlbWhC nQUGktmCPhG8oUW6CORxd6IhhlnXndefqQGYy5gEmoS54QiLWNLzU8gCVEPkIXtc6o fvc9NF0wSa/AKbr2jZX9EF0+xik2FquLe+ohhHvxaoVBbhfb4xx+gkIUZeruPYNJOa 4+c/Br7KAYVu5zcxMuiNKB+HNho44Deor0arQ9pbYWPrOWNIr36TKAyaKOBg6j56cC hfYCmFc5/niPcXvnjCE00ACa5CDxdrYxgj4KxW4ZzTItlZATgBk2mLULUGTgZ5aHxj 8n5o5o+D4iBqA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 3CDA1694CC; Wed, 21 Jan 2026 21:12:23 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 21 Jan 2026 21:11:33 -0700 Message-ID: <20260122041155.174721-6-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260122041155.174721-1-sjg@u-boot.org> References: <20260122041155.174721-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 6ATBG7UFF3G2NMVNAPYFJRCVTDB7MBHJ X-Message-ID-Hash: 6ATBG7UFF3G2NMVNAPYFJRCVTDB7MBHJ X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 05/16] expo: Drop entry save/restore in textline rendering List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass With per-object vidconsole contexts, each text-input object maintains its own cursor position and state. The entry save/restore calls in scene_txtin_render_deps() are no longer needed since the context persists between renders. Remove the vidconsole_entry_save() and vidconsole_entry_restore() calls, simplifying the rendering code. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- boot/scene_txtin.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/boot/scene_txtin.c b/boot/scene_txtin.c index 457d782b4cf..1829fabf9cc 100644 --- a/boot/scene_txtin.c +++ b/boot/scene_txtin.c @@ -79,19 +79,11 @@ int scene_txtin_render_deps(struct scene *scn, struct scene_obj *obj, /* if open, render the edit text on top of the background */ if (open) { - int ret; - - ret = vidconsole_entry_restore(cons, &scn->entry_save); - if (ret) - return log_msg_ret("sav", ret); scene_render_obj(scn, tin->edit_id, ctx); /* move cursor back to the correct position */ for (i = cls->num; i < cls->eol_num; i++) vidconsole_put_char(cons, ctx, '\b'); - ret = vidconsole_entry_save(cons, &scn->entry_save); - if (ret) - return log_msg_ret("sav", ret); vidconsole_show_cursor(cons, ctx); } From patchwork Thu Jan 22 04:11:34 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1765 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055154; bh=yU3a3MlPq7gazTJYLQMphCXYWAriegr+URxvLV882WE=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=J6QnOC47Yn3hfCkcj/gZxqIxJfYstEgTEq6UkrSwTE75NP4vZzx3ljyAXjRrGRuZx WMgBCJtZFCfmbdvLdjZktx1NvHIL9pqoSiMLrqORBWm5f/2LouPDR7uP8ld+CjjzQK cXURI65yfIiQFkBxRSC2kLqWzxKPyBaej04c04QCbWB2hYaN40VDDSMRzDtDP1gqwv 8TT2tj7sgKz0Od2ihmsnB6FglxsbRw90QYfWsfrH8uVJfLau+EkCzdDhFzZrgUPwOL P+DNLCxUXtw33f/MJV+5Wuf8HUoIiypwpAaWtol4QkW05YigpcOArKKVGCdIT3Qskh 5uTI3mqelGH0A== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id ECAE66962C for ; Wed, 21 Jan 2026 21:12:34 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 2rOkn1MEQTGu for ; Wed, 21 Jan 2026 21:12:34 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055154; bh=yU3a3MlPq7gazTJYLQMphCXYWAriegr+URxvLV882WE=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=J6QnOC47Yn3hfCkcj/gZxqIxJfYstEgTEq6UkrSwTE75NP4vZzx3ljyAXjRrGRuZx WMgBCJtZFCfmbdvLdjZktx1NvHIL9pqoSiMLrqORBWm5f/2LouPDR7uP8ld+CjjzQK cXURI65yfIiQFkBxRSC2kLqWzxKPyBaej04c04QCbWB2hYaN40VDDSMRzDtDP1gqwv 8TT2tj7sgKz0Od2ihmsnB6FglxsbRw90QYfWsfrH8uVJfLau+EkCzdDhFzZrgUPwOL P+DNLCxUXtw33f/MJV+5Wuf8HUoIiypwpAaWtol4QkW05YigpcOArKKVGCdIT3Qskh 5uTI3mqelGH0A== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id DA6E369627 for ; Wed, 21 Jan 2026 21:12:34 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055152; bh=JMCqpWLMsik3+i6znb73Z6sQrUt2fzfNLDMR8nBaj2U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uQ9KoSt2Q1fEFGQyuRAiDmvB0dbvTiTByGEf6eqJPAx1erzudX9jI2Mm0xsHJJM8u 4Ffbvxa1EjijQiq/pQYL99D706rhpMQYomsbKzHjuAML74l0dMueGy72qG8qKCTTEL oWeNXy7Ht9eQ7eMoB5zyYLKL14n2zpQ6B15jzLbGBPw8FC2JFSfEuYxHqPB/Uu4bLP zgTyghpSVUxvGYx0ERK0zxmGKjfQyc/R7C55URKNlygsv9/irwYFmQXEpwNuf8E1sh lUBQDTymSIQahE0+R6SMzew8awQ3J860liX+DWvanij81zJEumMFm7ckwgGGoffPxY 8vCGAfNQ0GiGQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E5FF4694CC; Wed, 21 Jan 2026 21:12:32 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id jmhmaHpDBw9Z; Wed, 21 Jan 2026 21:12:32 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055148; bh=rChJZPLeGddmB5Wkf3itQGSffOMMpRd74mdjh/VA0TY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=etDX4sBEq2OvXL5Q2n3O5/ACCMhybKQL64Ll4yGmG6EYLwlKDwSzvTs9E6N/x+Ie1 K1RdldzeGV3z9ziIPR/DITqrxGAaBcNDGrRREcGBMyJbbAa+kkuXEm1lKjIv1pfZp8 RfEgsiF/GuWH9WiNKNDYO05TJ8Ci/5Np7hEFu6RoYy81a2UoVkIl8xFkRcadu/QAaf IbTcDAoJe/o7MyA/XLknwVztYFU17E/Udrk/aI2dGHt7n+eqcqZX354VJPGV6RCffW Vh3LIrTJrH/vtX4+kSDnx/LJgiA2jz6A+/aP64f/u1ViDpMipHCFnGhWmgrlWWx7L1 oJ/DnUZobnyIg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 195AE69616; Wed, 21 Jan 2026 21:12:28 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 21 Jan 2026 21:11:34 -0700 Message-ID: <20260122041155.174721-7-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260122041155.174721-1-sjg@u-boot.org> References: <20260122041155.174721-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: PNQ5FSYWOZZUYXAS2TYCI2QTN7RCW7QN X-Message-ID-Hash: PNQ5FSYWOZZUYXAS2TYCI2QTN7RCW7QN X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 06/16] video: Remove vidconsole_entry_save/restore() List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass With per-object vidconsole contexts, entry save/restore is no longer needed. Each text-input object maintains its own context which persists across renders and key handling. Remove vidconsole_entry_save() and vidconsole_entry_restore() along with the entry_save and entry_restore ops from vidconsole drivers. Also remove the entry_save field from struct scene and the associated tests. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- boot/scene.c | 2 - boot/scene_txtin.c | 17 +------- drivers/video/console_normal.c | 32 --------------- drivers/video/console_truetype.c | 34 +--------------- drivers/video/vidconsole-uclass.c | 31 -------------- include/expo.h | 2 - include/video_console.h | 48 ---------------------- test/dm/video.c | 67 ------------------------------- 8 files changed, 3 insertions(+), 230 deletions(-) diff --git a/boot/scene.c b/boot/scene.c index 1ea0d1b1c46..52cb7055eb3 100644 --- a/boot/scene.c +++ b/boot/scene.c @@ -92,7 +92,6 @@ int scene_new(struct expo *exp, const char *name, uint id, struct scene **scnp) free(scn); return log_msg_ret("buf", -ENOMEM); } - abuf_init(&scn->entry_save); INIT_LIST_HEAD(&scn->obj_head); scn->id = resolve_id(exp, id); @@ -122,7 +121,6 @@ void scene_destroy(struct scene *scn) list_for_each_entry_safe(obj, next, &scn->obj_head, sibling) scene_obj_destroy(obj); - abuf_uninit(&scn->entry_save); abuf_uninit(&scn->buf); free(scn->name); free(scn); diff --git a/boot/scene_txtin.c b/boot/scene_txtin.c index 1829fabf9cc..da8d49af04f 100644 --- a/boot/scene_txtin.c +++ b/boot/scene_txtin.c @@ -147,9 +147,6 @@ int scene_txtin_open(struct scene *scn, struct scene_obj *obj, cls->putch = scene_txtin_putch; cls->priv = scn; cli_cread_add_initial(cls); - ret = vidconsole_entry_save(cons, &scn->entry_save); - if (ret) - return log_msg_ret("sav", ret); /* make sure the cursor is visible */ vidconsole_readline_start(cons, ctx, true); @@ -204,20 +201,10 @@ int scene_txtin_send_key(struct scene_obj *obj, struct scene_txtin *tin, event->select.id = obj->id; key = '\n'; fallthrough; - default: { - struct udevice *cons = scn->expo->cons; - int ret; - - ret = vidconsole_entry_restore(cons, &scn->entry_save); - if (ret) - return log_msg_ret("sav", ret); - ret = cread_line_process_ch(cls, key); - ret = vidconsole_entry_save(cons, &scn->entry_save); - if (ret) - return log_msg_ret("sav", ret); + default: + cread_line_process_ch(cls, key); break; } - } return 0; } diff --git a/drivers/video/console_normal.c b/drivers/video/console_normal.c index d36a5c0ff8f..303900d73cb 100644 --- a/drivers/video/console_normal.c +++ b/drivers/video/console_normal.c @@ -133,36 +133,6 @@ static __maybe_unused int console_get_cursor_info(struct udevice *dev, return 0; } -static __maybe_unused int normal_entry_save(struct udevice *dev, - struct abuf *buf) -{ - struct console_ctx *ctx = vidconsole_ctx(dev); - const uint size = sizeof(*ctx); - - if (xpl_phase() <= PHASE_SPL) - return -ENOSYS; - - if (!abuf_realloc(buf, size)) - return log_msg_ret("sav", -ENOMEM); - - memcpy(abuf_data(buf), ctx, size); - - return 0; -} - -static __maybe_unused int normal_entry_restore(struct udevice *dev, - struct abuf *buf) -{ - struct console_ctx *ctx = vidconsole_ctx(dev); - - if (xpl_phase() <= PHASE_SPL) - return -ENOSYS; - - memcpy(ctx, abuf_data(buf), sizeof(*ctx)); - - return 0; -} - static int console_putc_xy(struct udevice *dev, void *vctx, uint x_frac, uint y, int cp) { @@ -179,8 +149,6 @@ struct vidconsole_ops console_ops = { .ctx_new = console_simple_ctx_new, #ifdef CONFIG_CURSOR .get_cursor_info = console_get_cursor_info, - .entry_save = normal_entry_save, - .entry_restore = normal_entry_restore, #endif }; diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c index 25cc8241bf7..78683f8de13 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c @@ -1156,34 +1156,6 @@ static int truetype_ctx_new(struct udevice *dev, void *vctx) return 0; } -static int truetype_entry_save(struct udevice *dev, struct abuf *buf) -{ - struct console_tt_ctx *ctx = vidconsole_ctx(dev); - const uint size = sizeof(*ctx); - - if (xpl_phase() <= PHASE_SPL) - return -ENOSYS; - - if (!abuf_realloc(buf, size)) - return log_msg_ret("sav", -ENOMEM); - - memcpy(abuf_data(buf), ctx, size); - - return 0; -} - -static int truetype_entry_restore(struct udevice *dev, struct abuf *buf) -{ - struct console_tt_ctx *ctx = vidconsole_ctx(dev); - - if (xpl_phase() <= PHASE_SPL) - return -ENOSYS; - - memcpy(ctx, abuf_data(buf), sizeof(*ctx)); - - return 0; -} - static int truetype_get_cursor_info(struct udevice *dev, void *vctx) { struct console_tt_ctx *ctx = vctx; @@ -1196,9 +1168,7 @@ static int truetype_get_cursor_info(struct udevice *dev, void *vctx) return -ENOSYS; /* - * figure out where to place the cursor. This driver ignores the - * passed-in values, since an entry_restore() must have been done before - * calling this function. + * Figure out where to place the cursor. * * A current quirk is that the cursor is always at xcur_frac, since we * output characters directly to the console as they are typed by the @@ -1315,8 +1285,6 @@ struct vidconsole_ops console_truetype_ops = { .measure = truetype_measure, .nominal = truetype_nominal, .ctx_new = truetype_ctx_new, - .entry_save = truetype_entry_save, - .entry_restore = truetype_entry_restore, .get_cursor_info = truetype_get_cursor_info, .mark_start = truetype_mark_start, }; diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index 513c8f3bacb..0f9e9e35a98 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -801,37 +801,6 @@ int vidconsole_ctx_dispose(struct udevice *dev, void *vctx) return 0; } -int vidconsole_entry_save(struct udevice *dev, struct abuf *buf) -{ - struct vidconsole_ops *ops = vidconsole_get_ops(dev); - int ret; - - if (ops->entry_save) { - ret = ops->entry_save(dev, buf); - if (ret != -ENOSYS) - return ret; - } - - /* no data so make sure the buffer is empty */ - abuf_realloc(buf, 0); - - return 0; -} - -int vidconsole_entry_restore(struct udevice *dev, struct abuf *buf) -{ - struct vidconsole_ops *ops = vidconsole_get_ops(dev); - int ret; - - if (ops->entry_restore) { - ret = ops->entry_restore(dev, buf); - if (ret != -ENOSYS) - return ret; - } - - return 0; -} - #ifdef CONFIG_CURSOR int vidconsole_show_cursor(struct udevice *dev, void *vctx) { diff --git a/include/expo.h b/include/expo.h index adbe02922ab..d63fbd0c8ad 100644 --- a/include/expo.h +++ b/include/expo.h @@ -208,7 +208,6 @@ struct expo_string { * @highlight_id: ID of highlighted object, if any * @cls: cread state to use for input * @buf: Buffer for input - * @entry_save: Buffer to hold vidconsole text-entry information * @sibling: Node to link this scene to its siblings * @obj_head: List of objects in the scene */ @@ -221,7 +220,6 @@ struct scene { uint highlight_id; struct cli_line_state cls; struct abuf buf; - struct abuf entry_save; struct list_head sibling; struct list_head obj_head; }; diff --git a/include/video_console.h b/include/video_console.h index c047d45cf53..13d32dea2a9 100644 --- a/include/video_console.h +++ b/include/video_console.h @@ -405,30 +405,6 @@ struct vidconsole_ops { */ int (*ctx_dispose)(struct udevice *dev, void *ctx); - /** - * entry_save() - Save any text-entry information for later use - * - * Saves text-entry context such as a list of positions for each - * character in the string. - * - * @dev: Console device to use - * @buf: Buffer to hold saved data - * Return: 0 if OK, -ENOMEM if out of memory - */ - int (*entry_save)(struct udevice *dev, struct abuf *buf); - - /** - * entry_restore() - Restore text-entry information for current use - * - * Restores text-entry context such as a list of positions for each - * character in the string. - * - * @dev: Console device to use - * @buf: Buffer containing data to restore - * Return: 0 if OK, -ve on error - */ - int (*entry_restore)(struct udevice *dev, struct abuf *buf); - /** * get_cursor_info() - Get cursor position info * @@ -558,30 +534,6 @@ int vidconsole_ctx_new(struct udevice *dev, void **ctxp); */ int vidconsole_ctx_dispose(struct udevice *dev, void *ctx); -/** - * vidconsole_entry_save() - Save any text-entry information for later use - * - * Saves text-entry context such as a list of positions for each - * character in the string. - * - * @dev: Console device to use - * @buf: Buffer to hold saved data - * Return: 0 if OK, -ENOMEM if out of memory - */ -int vidconsole_entry_save(struct udevice *dev, struct abuf *buf); - -/** - * entry_restore() - Restore text-entry information for current use - * - * Restores text-entry context such as a list of positions for each - * character in the string. - * - * @dev: Console device to use - * @buf: Buffer containing data to restore - * Return: 0 if OK, -ve on error - */ -int vidconsole_entry_restore(struct udevice *dev, struct abuf *buf); - #ifdef CONFIG_CURSOR /** * vidconsole_show_cursor() - Show the cursor diff --git a/test/dm/video.c b/test/dm/video.c index b4a1200e481..fe6407dad35 100644 --- a/test/dm/video.c +++ b/test/dm/video.c @@ -1516,70 +1516,3 @@ static int dm_test_video_context_alloc(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_video_context_alloc, UTF_SCAN_PDATA | UTF_SCAN_FDT); - -/* Test vidconsole entry save/restore */ -static int check_entry_save(struct unit_test_state *uts, struct udevice *con) -{ - struct vidconsole_priv *priv; - struct vidconsole_ctx *ctx; - int xcur_frac, ycur; - struct abuf buf; - - priv = dev_get_uclass_priv(con); - ctx = priv->ctx; - - /* Move cursor to a known position */ - vidconsole_position_cursor(con, 5, 3); - xcur_frac = ctx->xcur_frac; - ycur = ctx->ycur; - - /* Save the state */ - abuf_init(&buf); - ut_assertok(vidconsole_entry_save(con, &buf)); - - /* Move cursor to a different position */ - vidconsole_position_cursor(con, 10, 7); - ut_assert(ctx->xcur_frac != xcur_frac || ctx->ycur != ycur); - - /* Restore the state */ - ut_assertok(vidconsole_entry_restore(con, &buf)); - - /* Verify cursor is back at saved position */ - ut_asserteq(xcur_frac, ctx->xcur_frac); - ut_asserteq(ycur, ctx->ycur); - - abuf_uninit(&buf); - - return 0; -} - -/* Test entry save/restore with bitmap font */ -static int dm_test_video_entry_save(struct unit_test_state *uts) -{ - struct udevice *dev, *con; - - ut_assertok(select_vidconsole(uts, "vidconsole0")); - ut_assertok(video_get_nologo(uts, &dev)); - ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); - ut_assertok(vidconsole_select_font(con, NULL, "8x16", 0)); - - ut_assertok(check_entry_save(uts, con)); - - return 0; -} -DM_TEST(dm_test_video_entry_save, UTF_SCAN_PDATA | UTF_SCAN_FDT); - -/* Test entry save/restore with truetype font */ -static int dm_test_video_entry_save_tt(struct unit_test_state *uts) -{ - struct udevice *dev, *con; - - ut_assertok(video_get_nologo(uts, &dev)); - ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); - ut_assertok(vidconsole_select_font(con, NULL, NULL, 30)); - - ut_assertok(check_entry_save(uts, con)); - - return 0; -} -DM_TEST(dm_test_video_entry_save_tt, UTF_SCAN_PDATA | UTF_SCAN_FDT); From patchwork Thu Jan 22 04:11:35 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1766 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055159; bh=Ntv45gqkELXiAcXeQTB/91SPM6ZXjjSl7HSXJMF1wS4=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=qmSTlrO5smk5YHFiiL3v8qLoPsBSwHhD1vsZW8is9O4VmBZyac4+AU4yV5arSOoZ9 2pTX/MBGJQYUC1QGedJk1ehwfRVG3dc9ajAa3PZqmxyyeCHyLzZFK/6fQbUVTTvLSN 1Gs4iDqzFVIFh+djHeJGZ/rLkGlcd3Ax++NITX9G8DkRsgHPwUbX46yIi0sih0CGS4 Yyv5UDeszjSkccqm0izr1o/kl4A1h/z8gGitI9c6IVfhRkykc03A3Pi/GYKkoxHkl2 nyKus0xjws2Aihp5z5VjOPY5QAxdeU8o/WHPc8/eZUU6EXohT7r2rmcN3Al15TYILD fvpSAt7cXy4NA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id EB3BA6962D for ; Wed, 21 Jan 2026 21:12:39 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id TcPQF25lzqFn for ; Wed, 21 Jan 2026 21:12:39 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055159; bh=Ntv45gqkELXiAcXeQTB/91SPM6ZXjjSl7HSXJMF1wS4=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=qmSTlrO5smk5YHFiiL3v8qLoPsBSwHhD1vsZW8is9O4VmBZyac4+AU4yV5arSOoZ9 2pTX/MBGJQYUC1QGedJk1ehwfRVG3dc9ajAa3PZqmxyyeCHyLzZFK/6fQbUVTTvLSN 1Gs4iDqzFVIFh+djHeJGZ/rLkGlcd3Ax++NITX9G8DkRsgHPwUbX46yIi0sih0CGS4 Yyv5UDeszjSkccqm0izr1o/kl4A1h/z8gGitI9c6IVfhRkykc03A3Pi/GYKkoxHkl2 nyKus0xjws2Aihp5z5VjOPY5QAxdeU8o/WHPc8/eZUU6EXohT7r2rmcN3Al15TYILD fvpSAt7cXy4NA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id DA9E86962A for ; Wed, 21 Jan 2026 21:12:39 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055157; bh=z86Q3G0rVvbo8YnLQfjq/yP+wp8UGx/K1bWLzvrYvIk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=epSx7TrJVe0lVTmk4eYDy291I/ZolRVjS8/XKzbURGP9gTJteJI6QF4ACniC0n4/n rn7ct9G6NOssmskR3Gu9PPfroCbFsgtvHte3oNfvN5c3V3XP3k5SDqgv7wZfadHWcL ljgMLKS6lquIFsL+iUxsmeBUC2XHo8MnpU/3pivcIof25L+KEJKeOB3qV/Aaftl8GB wVxTtlYd5vvpAN5dNB84XHltFyS5yudyHNrEAQ4Cm52dYfz4AezrScCJ/CdIcKdbT9 wLMz/NsLemZRQCVOKWtee7xIciEdTF3mCqPvQzfsmtyyIhj4pbU3dtwCQNq7AZTOtM eMex0FTpn71Yw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7397B694CC; Wed, 21 Jan 2026 21:12:37 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id PN3n4GqSQCY5; Wed, 21 Jan 2026 21:12:37 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055153; bh=rpe4JOLlJ3qxQLJzIaf9n2WarE+kvOCUYVAUh96GLtM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rqfMUCESJdf2F2AWFc2JibINSKa8tzV6a1zq3/hw/QyUPAteTf6c4iA0v/LWql21Y qf1MqgHt/fErDwg3Cs0VWpKUclpDAgzrE+2Tw1xN0Pl0DCQURgRPSlqh7V/SMcTB1c +HWAyXpeZDecpPL935u2OZ43nTLMdkJuwWd/PMNXSTkIPNxJj9u2V4k7DBkkFw/aQX BPkoi3n3p5CQ2VwocE1wqlCqOwXXK1eBse5AH9yAfTc5CrXx+X3OL7n5AxqhIcruv2 IcDQ7lsspLdr+IM2X9pokDjAsTKItxc6ugIpy4zK14H7ltT8uvu0OLu6T0v10gj+rz JKmzfKZvD7pJw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 21E1769616; Wed, 21 Jan 2026 21:12:33 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 21 Jan 2026 21:11:35 -0700 Message-ID: <20260122041155.174721-8-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260122041155.174721-1-sjg@u-boot.org> References: <20260122041155.174721-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: L2AH2PKRMII4CYFJCS5TBY7KGT7ZNNCV X-Message-ID-Hash: L2AH2PKRMII4CYFJCS5TBY7KGT7ZNNCV X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 07/16] test: video: Add tests for independent vidconsole contexts List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Add tests to verify that multiple vidconsole contexts operate independently. The tests create two contexts, set different cursor positions in each, write text to each context, and verify that operations on one context do not affect the other. Two tests are added: - dm_test_video_context_indep: Tests with bitmap font - dm_test_video_context_indep_tt: Tests with truetype font Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- test/dm/video.c | 88 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) diff --git a/test/dm/video.c b/test/dm/video.c index fe6407dad35..d3ecb62b43a 100644 --- a/test/dm/video.c +++ b/test/dm/video.c @@ -1516,3 +1516,91 @@ static int dm_test_video_context_alloc(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_video_context_alloc, UTF_SCAN_PDATA | UTF_SCAN_FDT); + +/* Test that two vidconsole contexts are independent */ +static int dm_test_video_context_indep(struct unit_test_state *uts) +{ + struct vidconsole_ctx *ctx1, *ctx2; + struct udevice *dev, *con; + + ut_assertok(select_vidconsole(uts, "vidconsole0")); + ut_assertok(video_get_nologo(uts, &dev)); + ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); + ut_assertok(vidconsole_select_font(con, NULL, "8x16", 0)); + + /* Create two contexts */ + ut_assertok(vidconsole_ctx_new(con, (void **)&ctx1)); + ut_assertok(vidconsole_ctx_new(con, (void **)&ctx2)); + + /* Set different cursor positions in each context */ + vidconsole_set_cursor_pos(con, ctx1, 100, 50); + vidconsole_set_cursor_pos(con, ctx2, 200, 100); + + /* Verify positions are independent */ + ut_asserteq(VID_TO_POS(100), ctx1->xcur_frac); + ut_asserteq(50, ctx1->ycur); + ut_asserteq(VID_TO_POS(200), ctx2->xcur_frac); + ut_asserteq(100, ctx2->ycur); + + /* Write to ctx1, verify ctx2 is unchanged */ + vidconsole_put_string(con, ctx1, "Hello"); + ut_asserteq(VID_TO_POS(200), ctx2->xcur_frac); + ut_asserteq(100, ctx2->ycur); + + /* Write to ctx2, verify it moves independently */ + vidconsole_put_string(con, ctx2, "World"); + ut_assert(ctx2->xcur_frac > VID_TO_POS(200)); + ut_asserteq(100, ctx2->ycur); + + /* ctx1 should have moved from the first write */ + ut_assert(ctx1->xcur_frac > VID_TO_POS(100)); + ut_asserteq(50, ctx1->ycur); + + ut_assertok(vidconsole_ctx_dispose(con, ctx1)); + ut_assertok(vidconsole_ctx_dispose(con, ctx2)); + + return 0; +} +DM_TEST(dm_test_video_context_indep, UTF_SCAN_PDATA | UTF_SCAN_FDT); + +/* Test multiple contexts with truetype font */ +static int dm_test_video_context_indep_tt(struct unit_test_state *uts) +{ + struct vidconsole_ctx *ctx1, *ctx2; + struct udevice *dev, *con; + int ctx1_x, ctx2_x; + + ut_assertok(video_get_nologo(uts, &dev)); + ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); + ut_assertok(vidconsole_select_font(con, NULL, NULL, 30)); + + /* Create two contexts */ + ut_assertok(vidconsole_ctx_new(con, (void **)&ctx1)); + ut_assertok(vidconsole_ctx_new(con, (void **)&ctx2)); + + /* Set different cursor positions */ + vidconsole_set_cursor_pos(con, ctx1, 50, 100); + vidconsole_set_cursor_pos(con, ctx2, 300, 200); + + /* Write different text to each */ + vidconsole_put_string(con, ctx1, "First"); + ctx1_x = ctx1->xcur_frac; + + vidconsole_put_string(con, ctx2, "Second context"); + ctx2_x = ctx2->xcur_frac; + + /* Verify they moved independently */ + ut_asserteq(ctx1_x, ctx1->xcur_frac); /* ctx1 unchanged by ctx2 write */ + ut_asserteq(100, ctx1->ycur); + ut_asserteq(ctx2_x, ctx2->xcur_frac); + ut_asserteq(200, ctx2->ycur); + + /* ctx2 should have moved more (longer string) */ + ut_assert(ctx2_x - VID_TO_POS(300) > ctx1_x - VID_TO_POS(50)); + + ut_assertok(vidconsole_ctx_dispose(con, ctx1)); + ut_assertok(vidconsole_ctx_dispose(con, ctx2)); + + return 0; +} +DM_TEST(dm_test_video_context_indep_tt, UTF_SCAN_PDATA | UTF_SCAN_FDT); From patchwork Thu Jan 22 04:11:36 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1767 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055164; bh=XnwT6kqVu7VXIIHfES0BLCvNl4QKvS+5g9DmTcxI7vA=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=LG85GqZNaSjRcuvrySTTPDENHTK484HvS4kFySNydTIRKHrucrOPF+0D15IoRODuK NvWLadSsIO0xoKrSUGtWbaUwE+BD5meKKolvcYk2mD7MA+M9Ie4yz5GQ8mQfTyvdue 9tlT3jmq9m1pdtRp8G6BU8eTsfdGRNyy6BqBQkK7PL7Uo+w4PtKy/hSrnHFx58TBDq +bUC2elyDf1EruDS7I/NW8P4jkyeVnEidNQgj9KI7cBs7WAU5/HLDCYAIx+on1E7Zt 56abDb11XrasKa+ImLmGFLAdw0E8S50CupuRbs44EKGqD/fpB6VP3qaMs5ZHoe7mTb E+hkczhgWPVOQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 668476962D for ; Wed, 21 Jan 2026 21:12:44 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id CmCPOCZ2AxHC for ; Wed, 21 Jan 2026 21:12:44 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055164; bh=XnwT6kqVu7VXIIHfES0BLCvNl4QKvS+5g9DmTcxI7vA=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=LG85GqZNaSjRcuvrySTTPDENHTK484HvS4kFySNydTIRKHrucrOPF+0D15IoRODuK NvWLadSsIO0xoKrSUGtWbaUwE+BD5meKKolvcYk2mD7MA+M9Ie4yz5GQ8mQfTyvdue 9tlT3jmq9m1pdtRp8G6BU8eTsfdGRNyy6BqBQkK7PL7Uo+w4PtKy/hSrnHFx58TBDq +bUC2elyDf1EruDS7I/NW8P4jkyeVnEidNQgj9KI7cBs7WAU5/HLDCYAIx+on1E7Zt 56abDb11XrasKa+ImLmGFLAdw0E8S50CupuRbs44EKGqD/fpB6VP3qaMs5ZHoe7mTb E+hkczhgWPVOQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 568506962A for ; Wed, 21 Jan 2026 21:12:44 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055162; bh=IL/WlDzya7cdwzAXLOlI7KeJwDRQHKLN991PsKGV5+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TcSjpcQ8knVIOY+M2yEDdmXrb1wIOPeBy2Nz8QQbHQZniPCOoQwYg834kk8QB3rw/ wMehGqQvn33LJaq283tZ5N0hPRSJRiKxCyKEz85ylXJNfIkAak7hakToMs4HwgmwD8 0gWTFyg5iH4KY4OqaKJqwQYuQ7G+kMjT20lFN4+ExnB/vQae1C9Geg+UzWZeCywvqa zmB94Iwan6/Jn/sgpx6pHfSJDmFQNGRP4ZB/9R8Jw4Izhle4GJ/v00eOE5Tw14mD8b KO0n6qK24zfC7pyMKtDudc5pirI0qjJ9mc3zOWHXyz7EJTo6Srbnnn0ybY+RYBZFRb 0S1E+4J2nOQWQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6374B694CC; Wed, 21 Jan 2026 21:12:42 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id dQ5YfE4e7OJt; Wed, 21 Jan 2026 21:12:42 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055158; bh=aqvbsXyuX/ab5YkS1kPs+gurbcz4Joujl/NNqe198sA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KbhqI/jcsqrYHjlt/98MmEoTVzFl1l1kWKBtfRhU18lXlUNs7gYUImXAWsVn8MK4s kA6EFIKwFdI4RjX6qruY/mOGcGHJU4FzkiPj0QD8imX8xd/jxrWIL/fF8nx3QCa+8k Ziw6k9Vw/qXP8vgryeBxyeTuanl6yehng69FJcto2mZnGUJdZg7geUh2IHK7w4h0oF AeuMs+Eu2ZoI8GxtnBishL1s8mAyiL+tFqBXl5ktHx6OChOOSd8V78vZweiJmGkWRo jhUSBSlO1FNQS3On8gG+Qm/cVSHhNzKO0C3BcAQAAIHEOFMySj0pTatfkAlgPTYgI1 jzjHVkI9b3ZHw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id F048D69616; Wed, 21 Jan 2026 21:12:37 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 21 Jan 2026 21:11:36 -0700 Message-ID: <20260122041155.174721-9-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260122041155.174721-1-sjg@u-boot.org> References: <20260122041155.174721-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: AG2WIYS3LKXTCHV6A7ZLR22SEZB2JE5P X-Message-ID-Hash: AG2WIYS3LKXTCHV6A7ZLR22SEZB2JE5P X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 08/16] expo: Fix text-input close on BKEY_SELECT List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass When closing a text-input object (textline or textedit) with Enter (BKEY_SELECT), scene_txtin_close() is not called. This leaves the vidconsole context in a bad state, causing rendering issues. Also, the code falls through to process '\n' via cread_line_process_ch(), which incorrectly adds a newline character to the text buffer. Fix this by calling scene_txtin_close() for BKEY_SELECT, matching the behaviour of BKEY_QUIT, and breaking instead of falling through. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- boot/scene_txtin.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/boot/scene_txtin.c b/boot/scene_txtin.c index da8d49af04f..43a6c00d497 100644 --- a/boot/scene_txtin.c +++ b/boot/scene_txtin.c @@ -199,8 +199,8 @@ int scene_txtin_send_key(struct scene_obj *obj, struct scene_txtin *tin, break; event->type = EXPOACT_CLOSE; event->select.id = obj->id; - key = '\n'; - fallthrough; + scene_txtin_close(scn, tin); + break; default: cread_line_process_ch(cls, key); break; From patchwork Thu Jan 22 04:11:37 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1768 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055168; bh=5UMfQApcUB/Cql2fk3v/cXhA8fk7qfLFyuzVn+I01sY=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=u/61bBwZYYKGQJBnHsDkjq0J6IN+aTc/SGpJqjQlzPk/2ZtjLyDmPxDKBYkSvcD++ LQ/qiY+rLjmIpvwZF1c4N9KaArE6+Bj/gDbrk4wCHdJcSjUFDLzPbUamfHBffYFgDO AjL8p6hvlaCj7OWmXohX3AZ46sxE8D4NSmWw+EG1XbCzKdQe7z+eeywA38AQvY2v+D yir0i11Z186yNBWqvr1pvRJzLZ2xhXhEjuiTEddtMKDwKxZ8DygJGA/sgf/BJjGDZH 1kmXmhcBlIWMPY2QOC7evveXyXJ6lKkNsMv/D1udPwKMQiY1LubMCv/704ZbrQmDc/ +NSM1+veeypbQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id DFDBD6962D for ; Wed, 21 Jan 2026 21:12:48 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id lWAXOuuyZGHW for ; Wed, 21 Jan 2026 21:12:48 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055168; bh=5UMfQApcUB/Cql2fk3v/cXhA8fk7qfLFyuzVn+I01sY=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=u/61bBwZYYKGQJBnHsDkjq0J6IN+aTc/SGpJqjQlzPk/2ZtjLyDmPxDKBYkSvcD++ LQ/qiY+rLjmIpvwZF1c4N9KaArE6+Bj/gDbrk4wCHdJcSjUFDLzPbUamfHBffYFgDO AjL8p6hvlaCj7OWmXohX3AZ46sxE8D4NSmWw+EG1XbCzKdQe7z+eeywA38AQvY2v+D yir0i11Z186yNBWqvr1pvRJzLZ2xhXhEjuiTEddtMKDwKxZ8DygJGA/sgf/BJjGDZH 1kmXmhcBlIWMPY2QOC7evveXyXJ6lKkNsMv/D1udPwKMQiY1LubMCv/704ZbrQmDc/ +NSM1+veeypbQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id CB16E6962A for ; Wed, 21 Jan 2026 21:12:48 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055167; bh=cRrgaBZGy+a39hnlehtEmBTL5AdrTyltNyqY7vfyVIg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mr3gs+sEM2pQu+VH/C5bl0w2MJk89ksuwicmOH9I4yYENp0K8jC+vwNghJTGNy8cD crdbeLIdDVjGJ6gS6mirIVGwp55m283Kp/9GO4e2K7p1wi0wOHfFHK1cCsxOnD7WU+ a8Q2FWiHvYB0BojNfiyVzXGYc1q02RNdLuAbwAFWkJrBKIs7DwPiEeJD2xL62QI768 SKz6jC2SR1qNyWryF9LCZ9LpO+O2UIThU1MGQ2nSWD9x0krMboLWQw7YBFlDP4HuZy PbYERFu7t5sJEeHdFNGd9vXS3rtA1bAz+I0HPTgQ2R6trpFqW6P4iw2LE/iIwGBb30 xynO7ZnDjKKZA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 38128694CC; Wed, 21 Jan 2026 21:12:47 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id hsOBcS06_XO6; Wed, 21 Jan 2026 21:12:47 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055163; bh=LXp8BC3LFcdAlsKwK7ajfMZFLv6VHFQl1QjYlpHgb+U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n3mxxKR3XValHx1YB9Wz4Sfsm7giYFNOwWAPb7qGolwG1YfSN5LdKLPA3keIs91y0 JVUPFEvBbt9IKGR0ysOH5p4RBxbYNkRATPLEAn5US/lt9BNASKoEJMkWIcZSil2AmF t8/dhTAWbcq2AQFHsvHK1XALBs8Ol2wBxxUsdXVLaHS43UrM0wUCd4MFHrnFnFMmIE wcrZaBzOVm7C4pjLixg1rqjVFhygFsv+j8ZPeY2cCXfo4SXZGwi4uLNeuXZ3CLppEZ GRAYzycTGsZSJGI2AAU30whjxjaPTFxGbwTJ9NCHe10wDYhNSlX9Odu3iYhc84cRXT c1A+r22x7X3rw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id DD18369616; Wed, 21 Jan 2026 21:12:42 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 21 Jan 2026 21:11:37 -0700 Message-ID: <20260122041155.174721-10-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260122041155.174721-1-sjg@u-boot.org> References: <20260122041155.174721-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: DSKWE6LKW7AV5UTPKGD2LIBUYDOTKO2D X-Message-ID-Hash: DSKWE6LKW7AV5UTPKGD2LIBUYDOTKO2D X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 09/16] expo: Fix text-input buffer size for CLI editing List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass 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 Signed-off-by: Simon Glass --- boot/scene_txtin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; From patchwork Thu Jan 22 04:11:38 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1769 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055173; bh=dRbzkFIisBc8OKfVaa7fe7gZqQSZGArWjw+47xRhO4k=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=YknVsQFb+P6qfM/RAq0XRxZsjkOf/PLx+Q96jdAk0C0ac6gkh2y+FLKb7T3lRkabj Gbwewo6ng8jvqhaXbCqVpBJ2l0CW0IbHh5rQ1HCabYyMd4B1HyhQKVAtqx6IzD9JBE XD1ekKBPom8sofWPd897kYvFyJOBVh0JaPlLGWzG/mcXRvrxvUDlywbHK+k6KWHL69 BhGSd7/1avGzqKcz7V9VEhi0hhkDbSpBHKgm3iz8M1RFImCIj0Lpo/8T/ikt/JJ8Mp dHOJwQMcFoaUPX6Tg+j5PZDDy+SbgcoG4XzFuecT9gQxrYJQu7LdbgabXrKoMQpqc4 6J1Eox7SmM7cQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 972506962D for ; Wed, 21 Jan 2026 21:12:53 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id PhjwV-S1wp_5 for ; Wed, 21 Jan 2026 21:12:53 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055173; bh=dRbzkFIisBc8OKfVaa7fe7gZqQSZGArWjw+47xRhO4k=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=YknVsQFb+P6qfM/RAq0XRxZsjkOf/PLx+Q96jdAk0C0ac6gkh2y+FLKb7T3lRkabj Gbwewo6ng8jvqhaXbCqVpBJ2l0CW0IbHh5rQ1HCabYyMd4B1HyhQKVAtqx6IzD9JBE XD1ekKBPom8sofWPd897kYvFyJOBVh0JaPlLGWzG/mcXRvrxvUDlywbHK+k6KWHL69 BhGSd7/1avGzqKcz7V9VEhi0hhkDbSpBHKgm3iz8M1RFImCIj0Lpo/8T/ikt/JJ8Mp dHOJwQMcFoaUPX6Tg+j5PZDDy+SbgcoG4XzFuecT9gQxrYJQu7LdbgabXrKoMQpqc4 6J1Eox7SmM7cQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 86D806962A for ; Wed, 21 Jan 2026 21:12:53 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055172; bh=Dc4qYY1dkwUc+iSvW5mEeyba9Hbcv1mgvlqbyGPrFv8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IBf871LtrCxlrE7YOm9KtDPcMS0UmjRjEcNtZ7H0nkoETNJiUuBLnKvs5VnKLhvnK PYOlYqr7Ka/wpwksm0iGRFwvy5KND2WZ1uS7ws5uPxrZNjmfA25x4DnPRXe1YSzYCR SsLL4vQ1R1umZr4vIWdpkVEsG4UGu58dLrlsMonupLQyiHkx+tSpO4CSKjFEusIyDV CpduYdKZ3R3b1CswfQrtYeuH6ouoI0jpsEKcqaD3ZY9csFhOE0n1dzN0OR64FbL83u xxVCM2ImEYF5mx905OHL5kLp7uBcYEFQ7xLFn1Gg48oZHsGL6lTYMtSaEMxnfR883W nt5wyLmsN9QRg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 13460694CC; Wed, 21 Jan 2026 21:12:52 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id B2rqIOmPoa-1; Wed, 21 Jan 2026 21:12:52 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055168; bh=hmn1owvFz0Vd6sVHLp5/Gym2WWwGj6Rinfc87AD5tmI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G29hTENYE2kRJurVKt8cHqPx5+yVs7OdtjAx3+BI5o4nt32DhNEIYwgQxZMpjAWU9 6YyvvpkvR59BpysCl8Sg0yrFFHUwFKH+UuKV8CJcI4IaJILUXF2hCTu3Fx3DIMaEE3 7RIV5a53bg4Nk4NyoVjSBrLvCbxCz6pCvH24dMLqWl2T6L0XlV0oi9vQ3F6RRAuXlS cWPuwvxsgO//dfDNQcadYakIPQxE5u64BekJ5whb8ymLTqgxn6cYviiLSQPj9JlzHE qFWX53rd/gQJH9FvD/+galpFvaN5WxEava/jSTfieDNMAylE8O7K4Hf8AWEWdLIl/J 9/tGnXaSoL15A== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id B380969616; Wed, 21 Jan 2026 21:12:47 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 21 Jan 2026 21:11:38 -0700 Message-ID: <20260122041155.174721-11-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260122041155.174721-1-sjg@u-boot.org> References: <20260122041155.174721-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: SBJMIPB5I4IIXAGTIRLR5VVMJ4UFAMET X-Message-ID-Hash: SBJMIPB5I4IIXAGTIRLR5VVMJ4UFAMET X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 10/16] test: expo: Add open/close testing to expo_render_textedit List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Extend the expo_render_textedit() test to cover opening the textedit, rendering with the cursor visible, then closing it with BKEY_SELECT and verifying the display returns to its previous state. This tests the full open/close cycle similar to expo_render_textline. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- test/boot/expo.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/boot/expo.c b/test/boot/expo.c index 2ace10994b6..4a20b00b901 100644 --- a/test/boot/expo.c +++ b/test/boot/expo.c @@ -1542,6 +1542,7 @@ static int expo_render_textedit(struct unit_test_state *uts) struct scene_obj_txtedit *ted; struct scene_obj_menu *menu; struct abuf buf, logo_copy; + struct expo_action act; struct scene *scn; struct udevice *dev; struct expo *exp; @@ -1549,6 +1550,7 @@ static int expo_render_textedit(struct unit_test_state *uts) ut_assertok(create_test_expo(uts, &exp, &scn, &menu, &buf, &logo_copy)); dev = exp->display; + expo_enter_mode(exp); id = scene_texted(scn, "texted", OBJ_TEXTED, 40, &ted); ut_assert(id > 0); @@ -1580,9 +1582,33 @@ static int expo_render_textedit(struct unit_test_state *uts) ut_assertok(expo_render(exp)); ut_asserteq(21662, video_compress_fb(uts, dev, false)); + /* open the textedit and re-render */ + ut_assertok(scene_set_open(scn, OBJ_TEXTED, true)); + ut_assertok(scene_arrange(scn)); + ut_assertok(expo_render(exp)); + + /* the cursor should be at the end */ + ut_asserteq(100, ted->tin.cls.num); + ut_asserteq(100, ted->tin.cls.eol_num); + ut_asserteq(21526, video_compress_fb(uts, dev, false)); + + /* close the textedit with Enter (BKEY_SELECT) */ + ut_assertok(expo_send_key(exp, BKEY_SELECT)); + ut_assertok(expo_action_get(exp, &act)); + ut_asserteq(EXPOACT_CLOSE, act.type); + ut_asserteq(OBJ_TEXTED, act.select.id); + ut_assertok(scene_set_open(scn, act.select.id, false)); + + /* check the textedit is closed */ + ut_asserteq(0, ted->obj.flags & SCENEOF_OPEN); + ut_assertok(scene_arrange(scn)); + ut_assertok(expo_render(exp)); + ut_asserteq(21662, video_compress_fb(uts, dev, false)); + abuf_uninit(&buf); abuf_uninit(&logo_copy); + expo_exit_mode(exp); expo_destroy(exp); return 0; From patchwork Thu Jan 22 04:11:39 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1770 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055179; bh=RaDOseyqgi4q6DO4sbedB9N4Cg2Ylgn6PtRUzKelM0I=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=FxGXittnokqttmgXyXliJlTX/ppBVaANIDhoGMoZkPWMUddOygteywjQXiKRqsdJY uLk2kSRo2EFdONBh20x66puCCtGHD3Wl+spHNlywpJu8AGALJz756H8+o8DrTbxz3O eiBBgJEwSe02FNaMTMznbB2UjSASWto052NUub+DSzgKAHdRV2uJgrDdjOt2B3eW2l wK2rpZo2QLV60pzwwfQEU/ky2n32c04m/XX/ixoBjUBr2473IJ1d9ZUbQXYpEg/KiF Erna5/HvGMJoxSQU+xV4IuVp7FydpZ9LuvqNu1yoxx9DQqBiw63/+Q2Jb/juXWcDMY rqQEP+VVQoDpg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0FF8F6962D for ; Wed, 21 Jan 2026 21:12:59 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id dNj-a75QZOmc for ; Wed, 21 Jan 2026 21:12:59 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055178; bh=RaDOseyqgi4q6DO4sbedB9N4Cg2Ylgn6PtRUzKelM0I=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=Sm0jNXP37N4S4das4T36PBR48glThwdeuKmoMIyx88GgxMwFAFlqPWaJsYRV8LsGl H8LCH5W9PMh0RWBZqd9PrEYnd5WxUMPyevP3rYIESt/w7nZFqFulHZdB27n9vTIyue nPtC3dUarbzAwYOTta2al1lDqykwVqeJb2AMApxLLys69KVBK70kG6YkuptAtf1BzV CcZCnhj/c6WdmwTlT3ALUzBTLiPEwTAmaKof5mbdAmKTXY+wmuUAe4y5MmjV+d9cCo /cRDYyfDWHLqOBCPp13DwGMZxl6+102BFUpGyuYT3E9MFEBCtNT0PHksMOrEuXma4p H/k6Loaq48NQw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id F34756962A for ; Wed, 21 Jan 2026 21:12:58 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055176; bh=7MEt0egkOCij5dQb86A5EMOXzKHQmzWvkyf6aqfV79U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WO76v7OCwvM/T2e8jObYjpa63rN2FaTU57pBQGCoMeX6hfe8bNzgjZlxdk+VeS3MQ tPTGL53Tqw8KGAlSHi7gZpamUzKGwp6w3p7Zkm3H42ROC5V3FmslamcfHrbdXJlwgh sWSlzfW3GDUZ/Wir116tCPHCrPCSTHvl1bCdP9baxjmg2zL/G1fqAgO0AzlLMgrU+g DqZ3BkFgp4hVAs8imOy3fH8dlxsuKvj+G5BkUnY6Of9I2HQBb0I6eSTO0Zm/D5HAsp ZAaKBaE2qFtlcwaV90eMHnSJkr4HS2tbU+Uns6ojnZIfyyPU2aWs9iyodi6jEqp1Ws TBh1GTWwXKMMw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id ED9B9694CC; Wed, 21 Jan 2026 21:12:56 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id D_D_z39FJG8S; Wed, 21 Jan 2026 21:12:56 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055172; bh=jAEXPxiMLtBZeo6aYfsSWz5Y8A9shg0LQ2jNFs4UKD0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CxyIlsYU5tX1cLr8XbkFHlIq488exIGekIii0P+y+kafShVNBxlQF7onIPs/E5IAg qWBYOQhMA6gqfBSOZaEkiADnaDVpE206yhOB6/Gw0MragfQZf43i8/nq6nc3/ipm5X XQ1r14ji/MqPWVcQ3weO8hbsUietvLP+QQi3d0z8IpwZ2Wf3EPk3gaTciK1FI1EDWl px5qYrlJY6hzaaE3ustd4rirrzN4BW0CgNMZUogsI24d0RbHBv57qLA40frp0HtGuz YdeuMmPN3nrDqvHo+QD3t+SqEPGpIQHih0dIoS3coZ2P5r63TbeRD89sNpsBMQdHb4 ro9Iqn5MzjdUA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 9E46F69616; Wed, 21 Jan 2026 21:12:52 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 21 Jan 2026 21:11:39 -0700 Message-ID: <20260122041155.174721-12-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260122041155.174721-1-sjg@u-boot.org> References: <20260122041155.174721-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 5AELCOHRMXUP5XF2O2IXTPOAI5S2CLRI X-Message-ID-Hash: 5AELCOHRMXUP5XF2O2IXTPOAI5S2CLRI X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 11/16] test: expo: Add keypress tests to expo_render_textedit List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Extend the textedit rendering test to verify keypress handling. Add tests for: - Character input ('X') - Cursor movement (Ctrl-B to move left) - Character deletion (Ctrl-D to delete at cursor) Also check that the text content changes as expected. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- test/boot/expo.c | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/test/boot/expo.c b/test/boot/expo.c index 4a20b00b901..8598f32d341 100644 --- a/test/boot/expo.c +++ b/test/boot/expo.c @@ -1592,6 +1592,35 @@ static int expo_render_textedit(struct unit_test_state *uts) ut_asserteq(100, ted->tin.cls.eol_num); ut_asserteq(21526, video_compress_fb(uts, dev, false)); + /* send a keypress to add a character */ + ut_assertok(expo_send_key(exp, 'X')); + ut_asserteq(101, ted->tin.cls.num); + ut_asserteq(101, ted->tin.cls.eol_num); + ut_assertok(scene_arrange(scn)); + ut_assertok(expo_render(exp)); + ut_asserteq(21607, video_compress_fb(uts, dev, false)); + + ut_assertok(expo_send_key(exp, CTL_CH('b'))); + ut_assertok(expo_send_key(exp, CTL_CH('b'))); + ut_assertok(expo_send_key(exp, CTL_CH('b'))); + + /* check cursor moved back three positions, before 'e' */ + ut_asserteq(98, ted->tin.cls.num); + ut_asserteq(101, ted->tin.cls.eol_num); + ut_assertok(scene_arrange(scn)); + ut_assertok(expo_render(exp)); + ut_asserteq(21623, video_compress_fb(uts, dev, false)); + + /* delete a character at the cursor (removes 'e') */ + ut_assertok(expo_send_key(exp, CTL_CH('d'))); + + /* check character deleted at cursor position */ + ut_asserteq(98, ted->tin.cls.num); + ut_asserteq(100, ted->tin.cls.eol_num); + ut_assertok(scene_arrange(scn)); + ut_assertok(expo_render(exp)); + ut_asserteq(21541, video_compress_fb(uts, dev, false)); + /* close the textedit with Enter (BKEY_SELECT) */ ut_assertok(expo_send_key(exp, BKEY_SELECT)); ut_assertok(expo_action_get(exp, &act)); @@ -1599,11 +1628,14 @@ static int expo_render_textedit(struct unit_test_state *uts) ut_asserteq(OBJ_TEXTED, act.select.id); ut_assertok(scene_set_open(scn, act.select.id, false)); - /* check the textedit is closed */ + /* check the textedit is closed and text is changed */ ut_asserteq(0, ted->obj.flags & SCENEOF_OPEN); + ut_asserteq_str("This\nis the initial contents of the text " + "editor but it is quite likely that more will be added latrX", + abuf_data(&ted->tin.buf)); ut_assertok(scene_arrange(scn)); ut_assertok(expo_render(exp)); - ut_asserteq(21662, video_compress_fb(uts, dev, false)); + ut_asserteq(21659, video_compress_fb(uts, dev, false)); abuf_uninit(&buf); abuf_uninit(&logo_copy); From patchwork Thu Jan 22 04:11:40 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1771 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055184; bh=F8eGPQYfzOQq91/3mVXzwrQjjOeiy17xYIH7FfSqdNM=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=UD4FI/+fWfGwu6av2UdFLNeeYgbn6EORuOgEh8mo87sxTYm9znQBFBNBKJlvzK4Pl G/Pd0vrWlCB2ZgcHL/2LSJtqZWiKHUABYjL+dyUucqdCB+1bjAw4GO8VeRL0Y1nuiL ALhuUpBBiafEKVPUT639Ou+JOLp3qWFGnrfeREfY/PbNoJKS2Fxv8vBHn3BlzacOGm 3XklN/O0+vQDxjECEsPejPX1iqj69kg9GpK+meDU4OUYtEVsGIJhyJzFDv8c4NYrlo 1wGCCDU9dhERN4o3s+4D7dsgd3eREK6cbxAaeFKnIPwNy86oUJJJyeIhTsf04uRFxg YLtmhY3nm2Cww== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 780F96962D for ; Wed, 21 Jan 2026 21:13:04 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 7JjPOfgsiynO for ; Wed, 21 Jan 2026 21:13:04 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055184; bh=F8eGPQYfzOQq91/3mVXzwrQjjOeiy17xYIH7FfSqdNM=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=UD4FI/+fWfGwu6av2UdFLNeeYgbn6EORuOgEh8mo87sxTYm9znQBFBNBKJlvzK4Pl G/Pd0vrWlCB2ZgcHL/2LSJtqZWiKHUABYjL+dyUucqdCB+1bjAw4GO8VeRL0Y1nuiL ALhuUpBBiafEKVPUT639Ou+JOLp3qWFGnrfeREfY/PbNoJKS2Fxv8vBHn3BlzacOGm 3XklN/O0+vQDxjECEsPejPX1iqj69kg9GpK+meDU4OUYtEVsGIJhyJzFDv8c4NYrlo 1wGCCDU9dhERN4o3s+4D7dsgd3eREK6cbxAaeFKnIPwNy86oUJJJyeIhTsf04uRFxg YLtmhY3nm2Cww== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6728A6962A for ; Wed, 21 Jan 2026 21:13:04 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055181; bh=lUPY1xNC75WYzlDRD1UDoXSrGOpfX1LHw0ifRWwFXTM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WPc86nLGd3SiS1Z5uAQ/pBMBDClhMGyqIUE5z1Fw94xNfwjFc48Mrn4t26cmNM+7x df6ZebIPOOLy4L3sFUy5LTNsSPkk8ddf1snsbf4DbBj9WUUOyFcqEwUmDi1sjGutiA SS4K1TPaSSuf0OZr0AJGNTnKhrRPJWJKjA6RmWtucbAqSu7OdBCVIPMMTwGScTQjxY iOZIBEJmyoqX7uA9M6tpVVAFkCdGnCiNDwQ2rzwT7dgc1aoa/PCmvHWkgOP+0OU/L8 gPQUgM+GxQkCE2dfJtPY3JvjepcKXNm/Hdxvk5QnGAM1woLAM6pnl/jJZIEFcmxEId 0y+skvlTozrSQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C1E2B694CC; Wed, 21 Jan 2026 21:13:01 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id H4er0IEXq9cN; Wed, 21 Jan 2026 21:13:01 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055177; bh=ng7QAkB68g2tawt0FdlhzhwptzvSATv7qMP3Z6DuNF8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fsfvuhMlYIFAHTOLyzzD+KGKQET8a7Zfy0+keof98gF8+WvgiyZO4WKPTZbackDD5 EqFNqGSd8y8L/A4X7tyW0Oa5JxNa6kVsqIPtdURDOeuIT8vo+sODhXHQRnQO11hxF3 FnYfO+ZL5ulyh6S0cWE257LVPgh8bd8H024N2TzLfTT6HAeVUVNbwNCv8jtWNGjpUr ybtgdgTDdPeXZUAyn7WVRnPa1dsG4SqtfiSa3rF+Lj6TteXSSaiUI5yzsDyTEq4wCn z7z35iFc6lK8EsrWhItSoGar1DSOttICkOA+eoe8DmWpmtf3BSJO7nTiVivvKXlAbb EfoJB2yWp/vvQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 7451669616; Wed, 21 Jan 2026 21:12:57 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 21 Jan 2026 21:11:40 -0700 Message-ID: <20260122041155.174721-13-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260122041155.174721-1-sjg@u-boot.org> References: <20260122041155.174721-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 4NFW2AIXCJ6XT47WH3XXGZ3KDQU25MXV X-Message-ID-Hash: 4NFW2AIXCJ6XT47WH3XXGZ3KDQU25MXV X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 12/16] cli: Add multiline support to CLI line editing List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Add support for multi-line input in CLI line editing: - Add multiline bool to indicate input may contain multiple lines - Add line_nav callback for Ctrl-P/N navigation between visual lines When multiline is true, Ctrl-P/N call the line_nav callback instead of accessing command history. The callback returns the new cursor position or a negative value if at the boundary. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- common/cli_readline.c | 17 +++++++++++++++++ include/cli.h | 9 ++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/common/cli_readline.c b/common/cli_readline.c index 27fecd835a0..38f825184df 100644 --- a/common/cli_readline.c +++ b/common/cli_readline.c @@ -405,6 +405,23 @@ int cread_line_process_ch(struct cli_line_state *cls, char ichar) break; case CTL_CH('p'): case CTL_CH('n'): + if (cls->multiline && cls->line_nav) { + int new_num; + + new_num = cls->line_nav(cls, ichar == CTL_CH('p')); + if (new_num < 0) { + getcmd_cbeep(cls); + break; + } + + /* + * Just update the position - the callback handles + * cursor display since backspaces don't work across + * wrapped line boundaries + */ + cls->num = new_num; + break; + } if (cls->history) { char *hline; diff --git a/include/cli.h b/include/cli.h index a02e228bf8a..f1e5887fa56 100644 --- a/include/cli.h +++ b/include/cli.h @@ -34,10 +34,15 @@ struct cli_ch_state { * @history: true if history should be accessible * @cmd_complete: true if tab completion should be enabled (requires @prompt to * be set) + * @multiline: true if input may contain multiple lines (enables Ctrl-P/N for + * line navigation instead of history) * @buf: Buffer containing line * @prompt: Prompt for the line * @putch: Function to call to output a character (NULL to use putc()) - * @priv: Private data for putch callback + * @line_nav: Function to call for multi-line navigation (Ctrl-P/N). Called with + * @up true for previous line, false for next. Returns new cursor position, + * or -ve if at boundary + * @priv: Private data for callbacks */ struct cli_line_state { uint num; @@ -46,9 +51,11 @@ struct cli_line_state { bool insert; bool history; bool cmd_complete; + bool multiline; char *buf; const char *prompt; void (*putch)(struct cli_line_state *cls, int ch); + int (*line_nav)(struct cli_line_state *cls, bool up); void *priv; }; From patchwork Thu Jan 22 04:11:41 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1772 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055189; bh=w+43iceiYzZOHOEed9buG1+iJzsDJY1hw0dBEMM8YXo=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=GgVltukDCXW+HymsMOqBmA0GMEfES9mjcLlhfS5PAevwM9qWzXvu3h7ifepajRwrP 82pT1ox7ulQSgFqWjNlTcnaTXXfj208P9hqrde2AI3jRLHDJILHktc81AM5O5HDdrQ yZEIVY3zlrA4n0A98agN1fLDORMwVlWZkvTlDqdvSrz1CgB3263GAVaE9aIFBgiTLv IVg830FkhTdzXXZkEx/srrGuBEVzY9KowVRBeqWXZC4IF+0vCYLJ5aivfNOPdPYR5b hXHLZrUtkKn6+d5J4ThugNznSoyABXbHZtueX++PzxWfaR7htYeXNKPIOyw/g9u6+4 g6ln1Q1k374Zg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 394ED6962E for ; Wed, 21 Jan 2026 21:13:09 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id si027JeirWtX for ; Wed, 21 Jan 2026 21:13:09 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055189; bh=w+43iceiYzZOHOEed9buG1+iJzsDJY1hw0dBEMM8YXo=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=GgVltukDCXW+HymsMOqBmA0GMEfES9mjcLlhfS5PAevwM9qWzXvu3h7ifepajRwrP 82pT1ox7ulQSgFqWjNlTcnaTXXfj208P9hqrde2AI3jRLHDJILHktc81AM5O5HDdrQ yZEIVY3zlrA4n0A98agN1fLDORMwVlWZkvTlDqdvSrz1CgB3263GAVaE9aIFBgiTLv IVg830FkhTdzXXZkEx/srrGuBEVzY9KowVRBeqWXZC4IF+0vCYLJ5aivfNOPdPYR5b hXHLZrUtkKn6+d5J4ThugNznSoyABXbHZtueX++PzxWfaR7htYeXNKPIOyw/g9u6+4 g6ln1Q1k374Zg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2800D6962C for ; Wed, 21 Jan 2026 21:13:09 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055186; bh=vbTpOMFIUIzxMG6q2MN6T3C+sqtHtTeekRnmlQRbq40=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tebHawQ4MHz0BGWKmGttsELccxj/4GfeD+hLG1/0cSGbMNGr7/JQBKeIuxOj23ill JC1BKM0RlUHFCO0UnGjiui5iK7dLDXGQ7wX6uTqqAQOCSiLqn6b73/rxYctMvSYTsa IRiHfhxShAjMN2MkrswdRhTAGHd+UnWMGxLt22EWBUl4YHEJOJxi6A52imECODDM+8 BcQAoRMGHkDZnodxw1LpEdi26OwY+XYmfhqmPDTi6ZzSPhhkoXhymsaQaUhVYwchFi wTHtKo0i3CGOMTY+WJMbK1059wYRG5az+xRpiFkLaaZeFxGx5hdOJWLEfutouBPzez EGU+//xh7CrJw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E07E2694CC; Wed, 21 Jan 2026 21:13:06 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id WU1YAdqzQRoq; Wed, 21 Jan 2026 21:13:06 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055182; bh=nupaMu+rDpQenfrd57AQ//N6gpw79ZHjmUm8/UbwaEo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BeH3ozmPR3gRBfq+YTshXaAU2y3HSN5VKn1J+kjexVxlk2U8JuFmao6R0CxmrtcDe TZX4Mgr+SiorRSaVARHyvU/H5jtb1Xet6dLgNAbD8HlI9ftCtUVWR/XY5KyeCBVAcQ 32aDCKXKwpUDaHJ8EJkPP1Q/oDasIp6GIY1/GdNFl11XToKky1uSp3DcVALRBuwLCy tVcCJEl08hPc0ggFIyjXsPIgdevHkZAS1D7WvN7hl7bxSFcOTiqGlxL3tN8gy8ihUV qUKK2I70cMnrTo23be0h/GYl3O+Px/n9YRvjIlvXMYtmggVXLLgf7VWnGaWr/1Crrt rgNAmC6c9xhnA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 4E01569616; Wed, 21 Jan 2026 21:13:02 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 21 Jan 2026 21:11:41 -0700 Message-ID: <20260122041155.174721-14-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260122041155.174721-1-sjg@u-boot.org> References: <20260122041155.174721-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: APQBOT2UPGFJZ7SUYLJ4EJFE2E3KEZVK X-Message-ID-Hash: APQBOT2UPGFJZ7SUYLJ4EJFE2E3KEZVK X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 13/16] video: Add len parameter to vidconsole_measure() List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Add a len parameter to vidconsole_measure() to allow measuring a substring of the input text. This is useful for measuring text up to a specific cursor position, which is needed for cursor-positioning with multi-line text input. Also return the position of the character where the substring ended, needed for cursor positioning. Pass -1 for len to measure the whole string (existing behaviour). Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- boot/scene.c | 2 +- drivers/video/console_truetype.c | 9 ++++++--- drivers/video/vidconsole-uclass.c | 7 ++++--- include/video_console.h | 8 ++++++-- test/dm/video.c | 6 +++--- 5 files changed, 20 insertions(+), 12 deletions(-) diff --git a/boot/scene.c b/boot/scene.c index 52cb7055eb3..ff21b524843 100644 --- a/boot/scene.c +++ b/boot/scene.c @@ -538,7 +538,7 @@ int scene_obj_get_hw(struct scene *scn, uint id, int *widthp) obj->req_bbox.x1 - obj->req_bbox.x0 : -1; ret = vidconsole_measure(scn->expo->cons, gen->font_name, - gen->font_size, str, limit, &bbox, + gen->font_size, str, -1, limit, &bbox, &gen->lines); if (ret) return log_msg_ret("mea", ret); diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c index 78683f8de13..25df22e31b0 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c @@ -1004,12 +1004,12 @@ static int truetype_select_font(struct udevice *dev, void *vctx, } static int truetype_measure(struct udevice *dev, const char *name, uint size, - const char *text, int pixel_limit, + const char *text, int len, int pixel_limit, struct vidconsole_bbox *bbox, struct alist *lines) { struct console_tt_metrics *met; struct vidconsole_mline mline; - const char *s, *last_space; + const char *s, *last_space, *end; int width, last_width; stbtt_fontinfo *font; int lsb, advance; @@ -1030,6 +1030,7 @@ static int truetype_measure(struct udevice *dev, const char *name, uint size, if (pixel_limit != -1) limit = tt_ceil((double)pixel_limit / met->scale); + end = len < 0 ? NULL : text + len; font = &met->font; width = 0; bbox->y1 = 0; @@ -1037,7 +1038,7 @@ static int truetype_measure(struct udevice *dev, const char *name, uint size, start = 0; last_space = NULL; last_width = 0; - for (lastch = 0, s = text; *s; s++) { + for (lastch = 0, s = text; *s && s != end; s++) { int neww; int ch = *s; @@ -1069,6 +1070,7 @@ static int truetype_measure(struct udevice *dev, const char *name, uint size, mline.bbox.x0 = 0; mline.bbox.y0 = bbox->y1; mline.bbox.x1 = tt_ceil((double)width * met->scale); + mline.xpos = (int)((double)width * met->scale); bbox->x1 = max(bbox->x1, mline.bbox.x1); bbox->y1 += met->font_size; mline.bbox.y1 = bbox->y1; @@ -1095,6 +1097,7 @@ static int truetype_measure(struct udevice *dev, const char *name, uint size, mline.bbox.x0 = 0; mline.bbox.y0 = bbox->y1; mline.bbox.x1 = tt_ceil((double)width * met->scale); + mline.xpos = (int)((double)width * met->scale); bbox->y1 += met->font_size; mline.bbox.y1 = bbox->y1; mline.start = start; diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index 0f9e9e35a98..d13b4eac272 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -665,7 +665,7 @@ int vidconsole_select_font(struct udevice *dev, void *ctx, const char *name, } int vidconsole_measure(struct udevice *dev, const char *name, uint size, - const char *text, int limit, + const char *text, int len, int limit, struct vidconsole_bbox *bbox, struct alist *lines) { struct vidconsole_ctx *ctx = vidconsole_ctx(dev); @@ -675,7 +675,8 @@ int vidconsole_measure(struct udevice *dev, const char *name, uint size, if (ops->measure) { if (lines) alist_empty(lines); - ret = ops->measure(dev, name, size, text, limit, bbox, lines); + ret = ops->measure(dev, name, size, text, len, limit, bbox, + lines); if (ret != -ENOSYS) return ret; } @@ -683,7 +684,7 @@ int vidconsole_measure(struct udevice *dev, const char *name, uint size, bbox->valid = true; bbox->x0 = 0; bbox->y0 = 0; - bbox->x1 = ctx->x_charsize * strlen(text); + bbox->x1 = ctx->x_charsize * (len < 0 ? strlen(text) : len); bbox->y1 = ctx->y_charsize; return 0; diff --git a/include/video_console.h b/include/video_console.h index 13d32dea2a9..1861138c152 100644 --- a/include/video_console.h +++ b/include/video_console.h @@ -221,11 +221,13 @@ struct vidconsole_bbox { * vidconsole_mline - Holds information about a line of measured text * * @bbox: Bounding box of the line, assuming it starts at 0,0 + * @xpos: Cursor x position at end of line (truncated, not ceiled like bbox.x1) * @start: String index of the first character in the line * @len: Number of characters in the line */ struct vidconsole_mline { struct vidconsole_bbox bbox; + int xpos; int start; int len; }; @@ -355,6 +357,7 @@ struct vidconsole_ops { * @name: Font name to use (NULL to use default) * @size: Font size to use (0 to use default) * @text: Text to measure + * @len: Number of characters to measure, or -1 for whole string * @limit: Width limit for each line, or -1 if none * @bbox: Returns bounding box of text, assuming it is positioned * at 0,0 @@ -365,7 +368,7 @@ struct vidconsole_ops { * Returns: 0 on success, -ENOENT if no such font */ int (*measure)(struct udevice *dev, const char *name, uint size, - const char *text, int limit, + const char *text, int len, int limit, struct vidconsole_bbox *bbox, struct alist *lines); /** @@ -485,6 +488,7 @@ int vidconsole_select_font(struct udevice *dev, void *ctx, const char *name, * @name: Font name to use (NULL to use default) * @size: Font size to use (0 to use default) * @text: Text to measure + * @len: Number of characters to measure, or -1 for whole string * @limit: Width limit for each line, or -1 if none * @bbox: Returns bounding box of text, assuming it is positioned * at 0,0 @@ -495,7 +499,7 @@ int vidconsole_select_font(struct udevice *dev, void *ctx, const char *name, * Returns: 0 on success, -ENOENT if no such font */ int vidconsole_measure(struct udevice *dev, const char *name, uint size, - const char *text, int limit, + const char *text, int len, int limit, struct vidconsole_bbox *bbox, struct alist *lines); /** * vidconsole_nominal() - Measure the expected width of a line of text diff --git a/test/dm/video.c b/test/dm/video.c index d3ecb62b43a..92b2ee9a6e3 100644 --- a/test/dm/video.c +++ b/test/dm/video.c @@ -982,7 +982,7 @@ static int dm_test_font_measure(struct unit_test_state *uts) ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); vidconsole_position_cursor(con, 0, 0); alist_init_struct(&lines, struct vidconsole_mline); - ut_assertok(vidconsole_measure(con, NULL, 0, test_string, -1, &bbox, + ut_assertok(vidconsole_measure(con, NULL, 0, test_string, -1, -1, &bbox, &lines)); ut_asserteq(0, bbox.x0); ut_asserteq(0, bbox.y0); @@ -1013,8 +1013,8 @@ static int dm_test_font_measure(struct unit_test_state *uts) ut_asserteq(strlen(test_string + nl + 1), line->len); /* now use a limit on the width */ - ut_assertok(vidconsole_measure(con, NULL, 0, test_string, limit, &bbox, - &lines)); + ut_assertok(vidconsole_measure(con, NULL, 0, test_string, -1, limit, + &bbox, &lines)); ut_asserteq(0, bbox.x0); ut_asserteq(0, bbox.y0); ut_asserteq(0x31e, bbox.x1); From patchwork Thu Jan 22 04:11:42 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1773 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055193; bh=VQtSTK3P9h4ibfJ5r317LEWqWCAcs5+XOc3J58nuI64=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=mvqQZ2mYf1DE+8O8QYwP2xJwcIxgZIcEqtOQph+1dbE6VKB8OOuDiOUEO39UVxSxW vHb9OaBfZG8/3rydEgYenZUhstdUNsQQQb5qvt/Qq516XtY4ZphiatSJSvP9Z10njU m1y8tN/0GNZp8328ggXCWvsNR0ydLzm/GngOjKDEWkqZUnceTjU0ucOxR9/+g4cewJ rw0yzV6WHMs3Mvnk4Ma2XLOR8AYCW7gYFxV3kqQhJeRs2T8WNgRY6pfgEtRoZyXjih AsWvTpM+UjyLteWcKGxcoGodl2mPgI6i7K4X0rhZdn3jHvpZCdQN0NNXfca0Lj99ro 4c34MAFoar/Kw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B26AC6962E for ; Wed, 21 Jan 2026 21:13:13 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id OTOKRhqQTrwm for ; Wed, 21 Jan 2026 21:13:13 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055193; bh=VQtSTK3P9h4ibfJ5r317LEWqWCAcs5+XOc3J58nuI64=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=mvqQZ2mYf1DE+8O8QYwP2xJwcIxgZIcEqtOQph+1dbE6VKB8OOuDiOUEO39UVxSxW vHb9OaBfZG8/3rydEgYenZUhstdUNsQQQb5qvt/Qq516XtY4ZphiatSJSvP9Z10njU m1y8tN/0GNZp8328ggXCWvsNR0ydLzm/GngOjKDEWkqZUnceTjU0ucOxR9/+g4cewJ rw0yzV6WHMs3Mvnk4Ma2XLOR8AYCW7gYFxV3kqQhJeRs2T8WNgRY6pfgEtRoZyXjih AsWvTpM+UjyLteWcKGxcoGodl2mPgI6i7K4X0rhZdn3jHvpZCdQN0NNXfca0Lj99ro 4c34MAFoar/Kw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A010E6962A for ; Wed, 21 Jan 2026 21:13:13 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055191; bh=BrfzBAQneVUfGc1AgZNbRIgN+Y02HcyOKhRBEavjQU0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V/9b8HroyVKzYAmcb6i0Q7S4srJ6a0FGNBD53MRLqcrfcsLK8IU3fw8bwgkgV+L18 rOE+BFki3aJtJNe0Gql72ODu5xLf9uZ1O6ZFZcrE+6pTVH+0ksXfaQMoBB0LIp1SrF DDddgqeY7GyTQHi9Ki0QknJxNvhKFdNGt81CzxX5E/7w/5rOvri5LowzE5+EFsb7ZS 78d4bf6BOoy0JpV00oaZ4HkP47r8SZsf0t68wKIBYIlZbs2p1TQ85/KYFIpPbKqZrH HKSdH6yV8AW/hV1tySLj76gZbmbUj2jZmWnhNf9T9b7MOxGYYT31RkS6Evw6XHiS2Z RbeiuKRPb56BA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A740D6962C; Wed, 21 Jan 2026 21:13:11 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id CNhbi1fvweZV; Wed, 21 Jan 2026 21:13:11 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055187; bh=5EQjkhtk383Id91rRQgd6bu9K/+3yiX7GNDgK05g6GM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nx0Gp95H9N7BbwYx1zt7mlT/xQaV8oJrJqoE+Zb9H4su6Ylg2kBiqkpYkSG2q8W+2 XwA3UWD7LZiFMzLicQzcVmhrMWCKQCY9cBX+M6BvoHowFn73PlkalJ0WRpWK82iMUc ut+CYjvwyKe0dBYYB7bNH3ZiyF1Wz/RAH9rCs8BSS3LC8dPh+KdMWb8sayRYIydAAa kepZNy96hchKHNertp+rb/BCnPxQL6Lhg3EyCBImj2axjQ+/r03+7kMCuXkFlNk712 dBhbjnPHgC2YshI+biCLBLFPsy5ySfif6hZpo//EbEMgCob8ibIrovS6OkzCnlY2Ms emJ3ugFALTFVA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 2648E69616; Wed, 21 Jan 2026 21:13:07 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 21 Jan 2026 21:11:42 -0700 Message-ID: <20260122041155.174721-15-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260122041155.174721-1-sjg@u-boot.org> References: <20260122041155.174721-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: MOVLD27VLCPC3L3ZDMYKCVKVIB7MM4YL X-Message-ID-Hash: MOVLD27VLCPC3L3ZDMYKCVKVIB7MM4YL X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 14/16] expo: support cursor positioning for multiline textedits List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass For multiline text input, using backspaces to position the cursor does not work correctly across wrapped line boundaries: the vidconsole cursor-position tracking goes wrong when backspacing at the start of a wrapped line. Fix this by using direct cursor-positioning via a call to vidconsole_set_cursor_pos() in scene_txtin_render_deps(), using the line-measurement info attached to the text object to calculate the correct position for the cursor. Single-line textline objects continue to use the backspace approach. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- boot/scene_txtin.c | 56 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 53 insertions(+), 3 deletions(-) diff --git a/boot/scene_txtin.c b/boot/scene_txtin.c index 338c7da63d3..72552222fe1 100644 --- a/boot/scene_txtin.c +++ b/boot/scene_txtin.c @@ -68,6 +68,46 @@ int scene_txtin_arrange(struct scene *scn, struct expo_arrange_info *arr, return x; } +/** + * set_cursor_pos() - Set cursor position for multiline text + * + * Finds the visual line containing the cursor and sets the cursor position + * to the correct pixel location within that line. + * + * @cons: Vidconsole device + * @ctx: Vidconsole context + * @txt: Text object containing line measurement info + * @buf: Text buffer + * @pos: Cursor position in buffer + */ +static void set_cursor_pos(struct udevice *cons, void *ctx, + struct scene_obj_txt *txt, const char *buf, uint pos) +{ + const struct vidconsole_mline *mline, *res; + struct vidconsole_bbox bbox; + struct alist lines; + uint i; + + alist_init_struct(&lines, struct vidconsole_mline); + for (i = 0; i < txt->gen.lines.count; i++) { + mline = alist_get(&txt->gen.lines, i, struct vidconsole_mline); + if (pos < mline->start || pos > mline->start + mline->len) + continue; + if (vidconsole_measure(cons, txt->gen.font_name, + txt->gen.font_size, buf + mline->start, + pos - mline->start, -1, &bbox, &lines)) + break; + /* measured text is within a single line, so only one result */ + res = alist_get(&lines, 0, struct vidconsole_mline); + if (!res) + break; + vidconsole_set_cursor_pos(cons, ctx, txt->obj.bbox.x0 + res->xpos, + txt->obj.bbox.y0 + mline->bbox.y0); + break; + } + alist_uninit(&lines); +} + int scene_txtin_render_deps(struct scene *scn, struct scene_obj *obj, struct scene_txtin *tin) { @@ -81,9 +121,19 @@ int scene_txtin_render_deps(struct scene *scn, struct scene_obj *obj, if (open) { scene_render_obj(scn, tin->edit_id, ctx); - /* move cursor back to the correct position */ - for (i = cls->num; i < cls->eol_num; i++) - vidconsole_put_char(cons, ctx, '\b'); + if (cls->multiline) { + /* for multiline, set cursor position directly */ + struct scene_obj_txt *txt; + + txt = scene_obj_find(scn, tin->edit_id, SCENEOBJT_NONE); + if (txt) + set_cursor_pos(cons, ctx, txt, cls->buf, + cls->num); + } else { + /* for single-line, use backspaces */ + for (i = cls->num; i < cls->eol_num; i++) + vidconsole_put_char(cons, ctx, '\b'); + } vidconsole_show_cursor(cons, ctx); } From patchwork Thu Jan 22 04:11:43 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1774 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055198; bh=EWhJMefZ7D4SJ+OegXAvKLelX4S+tlurY6h9CpoUxQk=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=bjRDR1Zo15rZ+cZ4rozDyLi3p8J6zUBiUy6MGrba502vIBPAaEg2gCJksYQ2ymTP1 XMK0fKDi85lOLVc0McwtBjbWMBYH0NPvDo3Ajbo+uRWyKfpBaB7sEnbRI3hymrQeOp 8df/Ciypo6EwSauMNU5dSbTdm3HkucP/kLJzyUJAInA2nQepc+iAgxlAKpL0p0ErBu pLkL2Km5gqkeyZVFyu30i1ogK8tV0OWzajKcD980eh7FA0yEjXZSDNcV05IPOEwhHN GqEKaI5rZ3jovnicrHoDWPByPvER1anM7xci45aGBI3+Qvl3ATaO2vBg0uslyUGleo 4cdWgQdpWTOLA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 41BAA6962E for ; Wed, 21 Jan 2026 21:13:18 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id V1kSLigWJmfq for ; Wed, 21 Jan 2026 21:13:18 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055198; bh=EWhJMefZ7D4SJ+OegXAvKLelX4S+tlurY6h9CpoUxQk=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=bjRDR1Zo15rZ+cZ4rozDyLi3p8J6zUBiUy6MGrba502vIBPAaEg2gCJksYQ2ymTP1 XMK0fKDi85lOLVc0McwtBjbWMBYH0NPvDo3Ajbo+uRWyKfpBaB7sEnbRI3hymrQeOp 8df/Ciypo6EwSauMNU5dSbTdm3HkucP/kLJzyUJAInA2nQepc+iAgxlAKpL0p0ErBu pLkL2Km5gqkeyZVFyu30i1ogK8tV0OWzajKcD980eh7FA0yEjXZSDNcV05IPOEwhHN GqEKaI5rZ3jovnicrHoDWPByPvER1anM7xci45aGBI3+Qvl3ATaO2vBg0uslyUGleo 4cdWgQdpWTOLA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2CF406962A for ; Wed, 21 Jan 2026 21:13:18 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055196; bh=GcwvnKpP78aYDtubhDyEj6xteEhBIcx2VYPjzFKXuNk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AEGHExwa9JRTM0vq5mGjQghTcnVKCkZWb0DaRi3H+eRlP1Y92UjxTibr/7I1HiSY2 vP7cZVLJ57Aurr25led0fuc9XyAIzmU1D4nu4HgvBxbSmRPPJzaws0RukKUz/W/Kfk J1ps+GlOZy7FDBC55hqvmYom0Qo6lZU3bFhfGZOhhXMseksTCJOGf0F5tOWO9HdUuu mQWJRZptuyZluRx2uY8uLyXB9wrKIFlh4JgFl1Pc5aIKJSa0EVPXVrq9PTEpSIp7g5 Fqf85fO8MK3dg8603wBIFaKdItCGeHnee6ejuHTRCTgQeHS7TKd6+FGotx9srd36G1 OL+/Gdq0C89sA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 562CF69616; Wed, 21 Jan 2026 21:13:16 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id j2BCDyAhbGpz; Wed, 21 Jan 2026 21:13:16 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055192; bh=lGH6RdQU89zNm9u4x77toaDqgmK7Q8DUfM9anQ4ZqjM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WSDH8mecLRSiInNateZntRn6+Z1/nF2bLC1KzP9zQaaFX374W5N6h/5NZTL2bOVB+ yEjILSmdHZ3Ht5fmzOYZJLYMxYAR+aWjT1Ga8qIbWs6oj/eSNMjeE0CdyF9/Bp5nU9 p3Xd8Q93HfvHwBk+jvQtWNfjjcO2Hxp37mJaXU4HKbTgkai32pJgeRDDKWUwtYFvvl F+fYaAcyY6PFsH1mv3Cbd5yaKf6aTu0NX26LEcZ4jYY8gGZWR5wkQUjbiXGNQld3ok xvtJEwPYSJoP6OxFlTZyJXDmSOu1nl4kzQlsWtBORafNkVXrKwVOXaAO1gS+tehtrU tBK/d2XQmEPGA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id F0AB8694CC; Wed, 21 Jan 2026 21:13:11 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 21 Jan 2026 21:11:43 -0700 Message-ID: <20260122041155.174721-16-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260122041155.174721-1-sjg@u-boot.org> References: <20260122041155.174721-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: MZ4Y25CVPU4WYICSHE4BQ3CCWANECFHA X-Message-ID-Hash: MZ4Y25CVPU4WYICSHE4BQ3CCWANECFHA X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 15/16] expo: Add visual line navigation for multi-line textedit List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Add support for Ctrl-P and Ctrl-N to navigate between visual lines in multi-line text input. The navigation maintains the same horizontal pixel-position where possible, using text measurement to find the closest character position on the target line. For multi-line textedit objects: - Add scene_txtin_line_nav() callback that uses the visual line info attached to the text object - Set multiline=true and line_nav callback in scene_txtin_open() Also add multiline support to CLI line editing: - Add multiline bool and line_nav callback to struct cli_line_state - Handle Ctrl-P/N for multiline mode in cread_line_process_ch() Check the context positions as well. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- boot/scene_txtin.c | 96 ++++++++++++++++++++++++++++++++++++++++++++++ test/boot/expo.c | 27 ++++++++++++- 2 files changed, 122 insertions(+), 1 deletion(-) diff --git a/boot/scene_txtin.c b/boot/scene_txtin.c index 72552222fe1..cde9fdb8ccf 100644 --- a/boot/scene_txtin.c +++ b/boot/scene_txtin.c @@ -164,6 +164,98 @@ void scene_txtin_close(struct scene *scn, struct scene_txtin *tin) vidconsole_readline_end(scn->expo->cons, tin->ctx); } +/** + * scene_txtin_line_nav() - Navigate to previous/next line in multi-line input + * + * Moves the cursor to the previous or next line, trying to maintain the same + * horizontal pixel position. Uses the text measurement info attached to the + * edit text object. + * + * @cls: CLI line state + * @up: true to move to previous line, false for next line + * Return: New cursor position, or -ve if at boundary + */ +static int scene_txtin_line_nav(struct cli_line_state *cls, bool up) +{ + struct scene_txtin *tin = container_of(cls, struct scene_txtin, cls); + struct scene *scn = cls->priv; + struct scene_obj_txt *txt; + const struct vidconsole_mline *mline; + const struct vidconsole_mline *target; + struct vidconsole_bbox bbox; + uint pos = cls->num; + int cur_line, target_line; + int target_x, best_pos, best_diff; + int i, ret; + + txt = scene_obj_find(scn, tin->edit_id, SCENEOBJT_NONE); + if (!txt || !txt->gen.lines.count) + return -ENOENT; + + /* find which line the cursor is on */ + cur_line = -1; + for (i = 0; i < txt->gen.lines.count; i++) { + mline = alist_get(&txt->gen.lines, i, struct vidconsole_mline); + if (pos >= mline->start && pos <= mline->start + mline->len) { + cur_line = i; + break; + } + } + if (cur_line < 0) + return -EINVAL; + + /* find target line */ + target_line = up ? cur_line - 1 : cur_line + 1; + if (target_line < 0 || target_line >= txt->gen.lines.count) + return -EINVAL; + + /* measure text from line start to cursor to get x position */ + ret = vidconsole_measure(scn->expo->cons, txt->gen.font_name, + txt->gen.font_size, cls->buf + mline->start, + pos - mline->start, -1, &bbox, NULL); + if (ret) + return ret; + target_x = bbox.x1; + + /* find character position on target line closest to target_x */ + target = alist_get(&txt->gen.lines, target_line, struct vidconsole_mline); + best_pos = target->start; + best_diff = target_x; /* diff from position 0 */ + + for (i = 1; i <= target->len; i++) { + int diff; + + ret = vidconsole_measure(scn->expo->cons, txt->gen.font_name, + txt->gen.font_size, + cls->buf + target->start, i, -1, + &bbox, NULL); + if (ret) + break; + diff = abs(bbox.x1 - target_x); + if (diff < best_diff) { + best_diff = diff; + best_pos = target->start + i; + } + /* stop if we've gone past the target */ + if (bbox.x1 > target_x) + break; + } + + /* measure text to best_pos to get x coordinate for cursor */ + ret = vidconsole_measure(scn->expo->cons, txt->gen.font_name, + txt->gen.font_size, cls->buf + target->start, + best_pos - target->start, -1, &bbox, NULL); + if (ret) + return ret; + + /* set cursor position: text object position + line offset + char offset */ + vidconsole_set_cursor_pos(scn->expo->cons, tin->ctx, + txt->obj.bbox.x0 + bbox.x1, + txt->obj.bbox.y0 + target->bbox.y0); + + return best_pos; +} + int scene_txtin_open(struct scene *scn, struct scene_obj *obj, struct scene_txtin *tin) { @@ -196,6 +288,10 @@ int scene_txtin_open(struct scene *scn, struct scene_obj *obj, cls->insert = true; cls->putch = scene_txtin_putch; cls->priv = scn; + if (obj->type == SCENEOBJT_TEXTEDIT) { + cls->multiline = true; + cls->line_nav = scene_txtin_line_nav; + } cli_cread_add_initial(cls); /* make sure the cursor is visible */ diff --git a/test/boot/expo.c b/test/boot/expo.c index 8598f32d341..8006044c9c0 100644 --- a/test/boot/expo.c +++ b/test/boot/expo.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -1541,6 +1542,7 @@ static int expo_render_textedit(struct unit_test_state *uts) { struct scene_obj_txtedit *ted; struct scene_obj_menu *menu; + struct vidconsole_ctx *ctx; struct abuf buf, logo_copy; struct expo_action act; struct scene *scn; @@ -1590,15 +1592,20 @@ static int expo_render_textedit(struct unit_test_state *uts) /* the cursor should be at the end */ ut_asserteq(100, ted->tin.cls.num); ut_asserteq(100, ted->tin.cls.eol_num); + ctx = ted->tin.ctx; + ut_asserteq(343, VID_TO_PIXEL(ctx->xcur_frac)); + ut_asserteq(260, ctx->ycur); ut_asserteq(21526, video_compress_fb(uts, dev, false)); /* send a keypress to add a character */ ut_assertok(expo_send_key(exp, 'X')); ut_asserteq(101, ted->tin.cls.num); ut_asserteq(101, ted->tin.cls.eol_num); + ut_asserteq(353, VID_TO_PIXEL(ctx->xcur_frac)); + ut_asserteq(260, ctx->ycur); ut_assertok(scene_arrange(scn)); ut_assertok(expo_render(exp)); - ut_asserteq(21607, video_compress_fb(uts, dev, false)); + ut_asserteq(21612, video_compress_fb(uts, dev, false)); ut_assertok(expo_send_key(exp, CTL_CH('b'))); ut_assertok(expo_send_key(exp, CTL_CH('b'))); @@ -1609,6 +1616,9 @@ static int expo_render_textedit(struct unit_test_state *uts) ut_asserteq(101, ted->tin.cls.eol_num); ut_assertok(scene_arrange(scn)); ut_assertok(expo_render(exp)); + /* check cursor position after render (render_deps corrects it) */ + ut_asserteq(329, VID_TO_PIXEL(ctx->xcur_frac)); + ut_asserteq(260, ctx->ycur); ut_asserteq(21623, video_compress_fb(uts, dev, false)); /* delete a character at the cursor (removes 'e') */ @@ -1619,8 +1629,23 @@ static int expo_render_textedit(struct unit_test_state *uts) ut_asserteq(100, ted->tin.cls.eol_num); ut_assertok(scene_arrange(scn)); ut_assertok(expo_render(exp)); + /* check cursor position after render (render_deps corrects it) */ + ut_asserteq(329, VID_TO_PIXEL(ctx->xcur_frac)); + ut_asserteq(260, ctx->ycur); ut_asserteq(21541, video_compress_fb(uts, dev, false)); + /* move cursor to previous visual line at same x position */ + ut_assertok(expo_send_key(exp, CTL_CH('p'))); + ut_asserteq(67, ted->tin.cls.num); + ut_asserteq(100, ted->tin.cls.eol_num); + ut_asserteq(328, VID_TO_PIXEL(ctx->xcur_frac)); + ut_asserteq(240, ctx->ycur); + ut_assertok(scene_arrange(scn)); + ut_assertok(expo_render(exp)); + ut_asserteq(327, VID_TO_PIXEL(ctx->xcur_frac)); + ut_asserteq(240, ctx->ycur); + ut_asserteq(21538, video_compress_fb(uts, dev, false)); + /* close the textedit with Enter (BKEY_SELECT) */ ut_assertok(expo_send_key(exp, BKEY_SELECT)); ut_assertok(expo_action_get(exp, &act)); From patchwork Thu Jan 22 04:11:44 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1775 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055203; bh=wbFBZIcUOFW5hpDWZ3cGBZULIgygAcHhuzCUNZ7mo7g=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=FSLDl5Aou0obPmqEx/+C58lnXheer8MHpccfMTVgD2ZARcZ52A+cEUrHYS+M8gH5l K+SiEXWmL9OBOYKwYPwdpuKoBy8NbiGFuz3041w+1pwuOm24pB5kF/N78qTXnHKqtE dD7F3ioeMs0iYdM+Y5pTWCqq59ZPxf90qxjadIQlugThFKhgS74IgMhrBorJZKLi/E gWCWbKWmmUlqnP4ixd/JS5jdHy/DO1JBPJB1y6fgnYXUuu4zWspZhl6y2ZKO5XsUB3 VYRUkqD2qQ5GuPEbxOT8jQVt+evVTfICjLuTsjhpT93Ce+wZMToLywgrPDWyp0oj0r k+6dp6C5CL88w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 18EA36962C for ; Wed, 21 Jan 2026 21:13:23 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id MGi5xME2lhQt for ; Wed, 21 Jan 2026 21:13:23 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055203; bh=wbFBZIcUOFW5hpDWZ3cGBZULIgygAcHhuzCUNZ7mo7g=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=FSLDl5Aou0obPmqEx/+C58lnXheer8MHpccfMTVgD2ZARcZ52A+cEUrHYS+M8gH5l K+SiEXWmL9OBOYKwYPwdpuKoBy8NbiGFuz3041w+1pwuOm24pB5kF/N78qTXnHKqtE dD7F3ioeMs0iYdM+Y5pTWCqq59ZPxf90qxjadIQlugThFKhgS74IgMhrBorJZKLi/E gWCWbKWmmUlqnP4ixd/JS5jdHy/DO1JBPJB1y6fgnYXUuu4zWspZhl6y2ZKO5XsUB3 VYRUkqD2qQ5GuPEbxOT8jQVt+evVTfICjLuTsjhpT93Ce+wZMToLywgrPDWyp0oj0r k+6dp6C5CL88w== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 07E0B69616 for ; Wed, 21 Jan 2026 21:13:23 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055201; bh=pyzpllo2xlwZniT/4yLXt05B8Ep7a6ko31EY8qMicH4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wzk3RwJsPEZFh0z5LclbPUK+TXgBtFHkdrhZLhaUK2Txgt69/6GWXRy+3BPOB9o5R 2ZQatu0frm6INn6uQ3xxaijaT8eUP3AZGkHtZNxguikT/bWS6CKdpZt6t1tfr6qBHi ORPgEJLF/5gqNBZ+DhMThUdAiyEQjz9v4TmMJI2tdfjxr4TgO2q0jDpogCGWKrwQ4V 1dY7XYo+CtttpoZfPe3JMHMqzbeDY7JtWuHycAtG6CzbNP6kJ2T3jkHt4x32BeedNa aFsE6GkWE7r7O1BC6hvKmhYSf/9PSlMjjoMW6UcOWcjAO/hUQTY2Ugg0/Xu2Pfx45q OgTh4zydrUEAQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2C75B69616; Wed, 21 Jan 2026 21:13:21 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id kgJ38JnXDr7K; Wed, 21 Jan 2026 21:13:21 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055197; bh=Lbnb6+mRPoL28FyDcS0TL1D9UmcAoRFLXQt3JZiRDHA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I4aWrWiGI941NhKOVDvvMoeHyQOh8TrTmAv8RefvWhpVuZ59+kTdPTFSvfFSyai1Q IEt3Jy6TtRFT7bAs0g7ZcvtB/ESdkwHUaQSRHlt64Un2hCDEs2s62R1f+ktNGNkiAo OdMQ0s1ZRRWtJ8aFkyUyLuhg5EVJWNrLEqcVjzW5eGSvYQb+5mRdS7ZkQENrcGBDLp lRcBopKm3wwnDxLfwMnyclziK6TbahM3eN+RCVIqNXHC23KGQt+MB3gQzw939UB+NH +aDcUyf1utx7/UQusk5PRFDlWqfIf/XOs7Pi+nGMq4tbGNa5ogMItgTXU6jmD52ku+ fP/QDzTLdGkbA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id C721E694CC; Wed, 21 Jan 2026 21:13:16 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 21 Jan 2026 21:11:44 -0700 Message-ID: <20260122041155.174721-17-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260122041155.174721-1-sjg@u-boot.org> References: <20260122041155.174721-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: DAG3H5V573Y2WH7YDP7CL2ZEAKYZIYWZ X-Message-ID-Hash: DAG3H5V573Y2WH7YDP7CL2ZEAKYZIYWZ X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 16/16] test: expo: Add more keypress tests for textedit List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Add tests for additional keypress operations in expo_render_textedit: - Ctrl-W twice to delete words ("lik" then "quite ") - Ctrl-B four times to move back 4 characters - Ctrl-N to move cursor to next visual line at same x position - Ctrl-A to go to start of buffer - Ctrl-D to delete character at cursor - Ctrl-E to go to end of buffer - Backspace to delete character before cursor Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- test/boot/expo.c | 63 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 60 insertions(+), 3 deletions(-) diff --git a/test/boot/expo.c b/test/boot/expo.c index 8006044c9c0..824fd0cca38 100644 --- a/test/boot/expo.c +++ b/test/boot/expo.c @@ -1646,6 +1646,63 @@ static int expo_render_textedit(struct unit_test_state *uts) ut_asserteq(240, ctx->ycur); ut_asserteq(21538, video_compress_fb(uts, dev, false)); + /* delete the word before cursor (deletes "lik" from "likely") */ + ut_assertok(expo_send_key(exp, CTL_CH('w'))); + ut_asserteq(64, ted->tin.cls.num); + ut_asserteq(97, ted->tin.cls.eol_num); + ut_assertok(scene_arrange(scn)); + ut_assertok(expo_render(exp)); + ut_asserteq(21462, video_compress_fb(uts, dev, false)); + + /* delete another word (deletes "quite ") */ + ut_assertok(expo_send_key(exp, CTL_CH('w'))); + ut_asserteq(58, ted->tin.cls.num); + ut_asserteq(91, ted->tin.cls.eol_num); + ut_assertok(scene_arrange(scn)); + ut_assertok(expo_render(exp)); + ut_asserteq(21241, video_compress_fb(uts, dev, false)); + + /* go back 4 characters */ + ut_assertok(expo_send_key(exp, CTL_CH('b'))); + ut_assertok(expo_send_key(exp, CTL_CH('b'))); + ut_assertok(expo_send_key(exp, CTL_CH('b'))); + ut_assertok(expo_send_key(exp, CTL_CH('b'))); + ut_asserteq(54, ted->tin.cls.num); + ut_asserteq(91, ted->tin.cls.eol_num); + ut_assertok(scene_arrange(scn)); + ut_assertok(expo_render(exp)); + ut_asserteq(21225, video_compress_fb(uts, dev, false)); + + /* move cursor to next visual line at same x position */ + ut_assertok(expo_send_key(exp, CTL_CH('n'))); + ut_asserteq(87, ted->tin.cls.num); + ut_asserteq(91, ted->tin.cls.eol_num); + ut_assertok(scene_arrange(scn)); + ut_assertok(expo_render(exp)); + ut_asserteq(21211, video_compress_fb(uts, dev, false)); + + /* go to start of buffer and delete a character */ + ut_assertok(expo_send_key(exp, CTL_CH('a'))); + ut_asserteq(0, ted->tin.cls.num); + ut_asserteq(91, ted->tin.cls.eol_num); + ut_assertok(expo_send_key(exp, CTL_CH('d'))); + ut_asserteq(0, ted->tin.cls.num); + ut_asserteq(90, ted->tin.cls.eol_num); + ut_assertok(scene_arrange(scn)); + ut_assertok(expo_render(exp)); + ut_asserteq(21147, video_compress_fb(uts, dev, false)); + + /* go to end of buffer and backspace */ + ut_assertok(expo_send_key(exp, CTL_CH('e'))); + ut_asserteq(90, ted->tin.cls.num); + ut_asserteq(90, ted->tin.cls.eol_num); + ut_assertok(expo_send_key(exp, '\x7f')); + ut_asserteq(89, ted->tin.cls.num); + ut_asserteq(89, ted->tin.cls.eol_num); + ut_assertok(scene_arrange(scn)); + ut_assertok(expo_render(exp)); + ut_asserteq(21083, video_compress_fb(uts, dev, false)); + /* close the textedit with Enter (BKEY_SELECT) */ ut_assertok(expo_send_key(exp, BKEY_SELECT)); ut_assertok(expo_action_get(exp, &act)); @@ -1655,12 +1712,12 @@ static int expo_render_textedit(struct unit_test_state *uts) /* check the textedit is closed and text is changed */ ut_asserteq(0, ted->obj.flags & SCENEOF_OPEN); - ut_asserteq_str("This\nis the initial contents of the text " - "editor but it is quite likely that more will be added latrX", + ut_asserteq_str("his\nis the initial contents of the text " + "editor but it is ely that more will be added latr", abuf_data(&ted->tin.buf)); ut_assertok(scene_arrange(scn)); ut_assertok(expo_render(exp)); - ut_asserteq(21659, video_compress_fb(uts, dev, false)); + ut_asserteq(21230, video_compress_fb(uts, dev, false)); abuf_uninit(&buf); abuf_uninit(&logo_copy);