From patchwork Fri Jan 30 03:58: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: 1789 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org Authentication-Results: mail.u-boot.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=Z1KupLNe; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6C3BD697DF for ; Thu, 29 Jan 2026 20:59:45 -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 eicyckWcJner for ; Thu, 29 Jan 2026 20:59:45 -0700 (MST) Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5603F697CB for ; Thu, 29 Jan 2026 20:59:45 -0700 (MST) Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E09FD697C0 for ; Thu, 29 Jan 2026 20:59: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 10024) with ESMTP id uqskjwxbllni for ; Thu, 29 Jan 2026 20:59:42 -0700 (MST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.160.54; helo=mail-oa1-f54.google.com; envelope-from=sjg@chromium.org; receiver=u-boot.org Received: from mail-oa1-f54.google.com (mail-oa1-f54.google.com [209.85.160.54]) by mail.u-boot.org (Postfix) with ESMTPS id 7EF9C697DF for ; Thu, 29 Jan 2026 20:59:37 -0700 (MST) Received: by mail-oa1-f54.google.com with SMTP id 586e51a60fabf-408778a8ec4so1071050fac.0 for ; Thu, 29 Jan 2026 19:59:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1769745576; x=1770350376; darn=u-boot.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RQZ9ATFr9dBKZl9RUtzMP64cJbV9HCKKuBfrgZs8iEQ=; b=Z1KupLNeL7Z7zbTUpOJ1kxZiunL+hfo9xrNL01O50sjgR3BMv68o+pM9rODtvhXkcU ArfHOj5cmS8pFrV2VcfkQwlg50udD8d4LxcEAjm+jl6inltilkrY6DQ+Cl7iHTmflb6H XwDTIEvtm3VBMpBuOwh7jlcsbB40eKh33don4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769745576; x=1770350376; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=RQZ9ATFr9dBKZl9RUtzMP64cJbV9HCKKuBfrgZs8iEQ=; b=bsAC/PgEMN1WxoLngjb6u7nDh20ZXOorVaW2k1qYxpAhu6srzrqeh+glqu7mZpYQA5 y5fNe8JFyShmfOj5Ae43urTL9/SHeRv/WUefN8m4f5dRVk57Z4RKH/3stl6Lvv2axb+z uyqhr9eOVR/e6xbJSzHKlKmURIhIFTpnIayLPgBRERRVXp0Qu8RXOJ+w7UnW1reysG+s TUBTHoX1eL3kXcSxk3CbCzED8SpbfdWPfBwGo7oN9Rjb5UJnjR8dynyKM3d8VuscsB0k Nk6QtKs0DP8mu3gM1vWoW8h8XD9eCnt3k9h4zTyQw+XmNxU9b7fg7/L3Tvso7YMq8QRE HC7Q== X-Gm-Message-State: AOJu0YyqIGY/qbzSaOvPDVr4qtjYEVfCVGazD4mOHhRbZTw4cqZXaCEn aCHlP5O/wSWiwGAKqjFcFz57n8ZVYbdPQ2UIqdOr70OifQkJz9LtamA/xEcT+vwZYNrAFppG4fE ZWAF0Aw== X-Gm-Gg: AZuq6aJebTYBc76hXHYo/kI9Kgw5jCSawXOv0/aS9AyL6wIqwhkbuiKmtYUM1WyfvoA YJX7ZWFJNQq4xbA5ViJNqa2NNRDBsoO6HkLhO7lSFr+iy1hogEQRVVvkZus7SlzRE9ivAagBC5W bWSJIeT4rvZ/EdEEI/UTgsaKCixF9tDXrdwyQv6y0WHnuOWXjs0UK3GfScYsb9GcDrAp8OWTYCo Z/rpoZqLvNEkq5zvNUtts18cnhGaM9kbkpQVZGDVc/+6cl8H65ilFJj3K5EM0LUGLhyELsY6GIf ijgoNoNR64pmp/oRcOBLG0UPG/6iGCIaaHyrclZHEv2usDC+5uxrd9O4NjDvkZGtOLNWfSpiGnI EoRf6YD7Pe+Gm2gWA4d5HgujMN7DDSNQObOwbePGHISpd+Zu7fV4xFcanTS/+eCx0Efc2MecysQ FkDG38MiopCvjNGy07 X-Received: by 2002:a05:6820:3092:b0:662:c114:b28b with SMTP id 006d021491bc7-6630f00427fmr992165eaf.16.1769745576027; Thu, 29 Jan 2026 19:59:36 -0800 (PST) Received: from chromium.org ([73.34.74.121]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-662f9a4e491sm4128687eaf.16.2026.01.29.19.59.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Jan 2026 19:59:34 -0800 (PST) From: Simon Glass X-Google-Original-From: Simon Glass To: U-Boot Concept Date: Thu, 29 Jan 2026 20:58:37 -0700 Message-ID: <20260130035849.3580212-15-simon.glass@canonical.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260130035849.3580212-1-simon.glass@canonical.com> References: <20260130035849.3580212-1-simon.glass@canonical.com> MIME-Version: 1.0 Message-ID-Hash: PYKGEDSQG3RXCW24ZQDIUYZ7ZJB3TIQ5 X-Message-ID-Hash: PYKGEDSQG3RXCW24ZQDIUYZ7ZJB3TIQ5 X-MailFrom: sjg@chromium.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/19] expo: Convert BKEY_UP/DOWN to control characters 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: The expo keyboard handling converts arrow keys to BKEY_UP and BKEY_DOWN before sending them to scene objects. However, cread_line_process_ch() expects CTL_CH('p') and CTL_CH('n') for line navigation in multiline text editors. Add explicit handling for BKEY_UP and BKEY_DOWN in scene_txtin_send_key() to convert them back to the control characters that cread_line_process_ch() expects. This fixes arrow key navigation in textedit objects. Update the editenv_test_video() to use a longer string and a larger font size so we can test this. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- boot/scene_txtin.c | 6 ++++++ test/boot/editenv.c | 26 ++++++++++++++++++-------- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/boot/scene_txtin.c b/boot/scene_txtin.c index 79814891cdc..8b49daddd56 100644 --- a/boot/scene_txtin.c +++ b/boot/scene_txtin.c @@ -349,6 +349,12 @@ int scene_txtin_send_key(struct scene_obj *obj, struct scene_txtin *tin, event->select.id = obj->id; scene_txtin_close(scn, tin); break; + case BKEY_UP: + cread_line_process_ch(cls, CTL_CH('p')); + break; + case BKEY_DOWN: + cread_line_process_ch(cls, CTL_CH('n')); + break; default: cread_line_process_ch(cls, key); break; diff --git a/test/boot/editenv.c b/test/boot/editenv.c index 62a33f1ba0f..0f9db54474d 100644 --- a/test/boot/editenv.c +++ b/test/boot/editenv.c @@ -124,23 +124,33 @@ static int editenv_test_escape(struct unit_test_state *uts) } BOOTSTD_TEST(editenv_test_escape, UTF_DM | UTF_SCAN_FDT | UTF_CONSOLE); -/* Check expo_editenv() renders correctly */ +/* Check expo_editenv() renders correctly with multiline text and navigation */ static int editenv_test_video(struct unit_test_state *uts) { - struct udevice *dev; - char buf[256]; + struct udevice *dev, *con; + char buf[512]; int ret; ut_assertok(uclass_first_device_err(UCLASS_VIDEO, &dev)); + ut_assertok(uclass_first_device_err(UCLASS_VIDEO_CONSOLE, &con)); - /* Type "abc" then press Enter */ - console_in_puts("abc\x0d"); - ret = expo_editenv("testvar", "initial", buf, sizeof(buf)); + /* Set font size to 30 */ + ut_assertok(vidconsole_select_font(con, NULL, NULL, 30)); + + /* + * Navigate with up arrow, insert text, then press Enter. The up arrow + * should be converted to Ctrl-P by scene_txtin_send_key(). + * \x1b[A is the escape sequence for up arrow + */ + console_in_puts("\x1b[A!\x0d"); + ret = expo_editenv("testvar", initial, buf, sizeof(buf)); ut_assertok(ret); - ut_asserteq_str("initialabc", buf); + + /* The '!' should be inserted one visual line up from the end */ + ut_assert(strstr(buf, "tes!ted")); /* Check the framebuffer has expected content */ - ut_asserteq(1029, video_compress_fb(uts, dev, false)); + ut_asserteq(16829, video_compress_fb(uts, dev, false)); return 0; }