From nobody Thu Nov 07 00:50:35 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XkNlv2lNCz5c4YZ; Thu, 07 Nov 2024 00:50:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XkNlv2FSyz4WGM; Thu, 7 Nov 2024 00:50:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730940635; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=99VUfuXu8onszxJvJN7lFRcmhdwmIn02dXLlkE4Hnto=; b=vygczTQka3EWxMPQUiLdToCpHIsRGofNaVKuGeFUaZgnhx37YMElPSX3btOTvV9+iXX5CL wCaOiMJCn38AypIJr9SQPaVYT0P7/MMSJMwq2l+l8UqgwThSO8XQ4+OjBf/gMjn/niqtXt Q8mlmP4aDlWfz10AXxB8+ZNO16eED0PIQkb3Rd67uUSNQpRLHTJaOyr70sfX8QsiK4Jk7x Ii6vKj+0M7PEruH6f864IHkt201/exUC3RVHQfjeXAUoehdRGbAe2/UWYk1MIov14wxXiD YxkDS0dhoJip+5jC6zpUzwrR2ZADHoy6zMHCQf6qBtLWjnVNjov3Bow58j6OvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730940635; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=99VUfuXu8onszxJvJN7lFRcmhdwmIn02dXLlkE4Hnto=; b=s59ykMvRFz8gzKeP8jgJKWj4kyS09LibZaZireE/oabfOEIl411hKkFkOiLFw5IYJK9pSj 3sswTgqBXb04E6aUwOkxnoiaf9boUb0djQ8xU8+4X0uVjjsDFpVvXgsHAN7ku1PRKJPKTN rBND+VbqdKQg//kdcy6EqcqlZyOLu21hsqY40xsDLojoa4ZoOHftQkJBuPtOER36j86wBy 1iUUrCkDRWRRcy2G2mZzeu//A+m33JgfQFDG0h1RvXdez6AxEfQfT34DnX80WpeXAaIj3q mdY0mO+kS0LNiabmftVlWprrWuQ8hFqx3ac7y4uXmuoWZdlgfiveYuKrTOL19A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1730940635; a=rsa-sha256; cv=none; b=F0q4ltD5k6Izmm0kW4CKmiZsnZao44RsPXSQkUuVExZ1j339tYHA17mRb8NHwBV9o66bt+ ujopX8KOW3w5l9RZgrsUPYBU6lha6SNYYZkXZY2BlvH7zfig+otXWumabztWlP4IHLYcX1 EhOHjx0VW7SDRoAgLycHx0ZRehW9Bj7548BIrMAFGA2shNCGkNaalOgzE1sDBXctim4nbD g7YDckf4V2XlckeROcWQjZUTvSkswV6Vk65qFI7b4WWczfQQL3a9gxbQ9E2jncpPGWo08Z grziF2me6rkVyKnEIhD+LbGxEJxqDsE1Z7akQnLONo56xeRkYINqmQM0RXqTVA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XkNlv1rrTzNmy; Thu, 7 Nov 2024 00:50:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4A70oZtY010412; Thu, 7 Nov 2024 00:50:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4A70oZs1010409; Thu, 7 Nov 2024 00:50:35 GMT (envelope-from git) Date: Thu, 7 Nov 2024 00:50:35 GMT Message-Id: <202411070050.4A70oZs1010409@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 0d2b7892cd3a - releng/14.2 - loader: Fix boot menu on BIOS List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/releng/14.2 X-Git-Reftype: branch X-Git-Commit: 0d2b7892cd3aa4666dee7211a76a3a4d99c4c18b Auto-Submitted: auto-generated The branch releng/14.2 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=0d2b7892cd3aa4666dee7211a76a3a4d99c4c18b commit 0d2b7892cd3aa4666dee7211a76a3a4d99c4c18b Author: Warner Losh AuthorDate: 2024-11-02 22:02:44 +0000 Commit: Warner Losh CommitDate: 2024-11-06 23:13:14 +0000 loader: Fix boot menu on BIOS Only the gfx-enabled boot loader supports unicode. Otherwise, we have to use the old cons25 / ibmpc upper code page drawing characters. Check to see if we have the gfx.term_drawbox function. If we do, we support the unicode drawing characters. If we don't, then we have an older loader that doesn't support it *OR* we have the reduced function, text-only boot loader. In either of those cases, we need to use the old graphics characters. Abstract all those details into core.hasUnicode function. PR: 282465 MFC After: 2 day Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D47403 (cherry picked from commit c2ba66d4d01f23303352bfe3cbd50ff5d9a05947) (cherry picked from commit f2103edaf5229271f3f6769844c0c747d8352228) Approved-by: re (cperciva) --- stand/lua/core.lua | 9 +++++++++ stand/lua/drawer.lua | 32 +++++++++++++++++++++++++++----- 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/stand/lua/core.lua b/stand/lua/core.lua index 72b19462ae5c..3582720f2a81 100644 --- a/stand/lua/core.lua +++ b/stand/lua/core.lua @@ -543,6 +543,15 @@ function core.nextConsoleChoice() end end +-- The graphical-enabled loaders have unicode drawing character support. The +-- text-only ones do not. We check the old and new bindings for term_drawrect as +-- a proxy for unicode support, which will work on older boot loaders as well +-- as be future proof for when we remove the old binding. This also abstracts +-- out the test to one spot in case we start to export this notion more directly. +function core.hasUnicode() + return gfx.term_drawrect ~= nil or loader.term_drawrect ~= nil +end + -- Sanity check the boot loader revision -- Loaders with version 3.0 have everything that we need without backwards -- compatible hacks. Warn users that still have old versions to upgrade so diff --git a/stand/lua/drawer.lua b/stand/lua/drawer.lua index a009b78164df..612bd2f5317f 100644 --- a/stand/lua/drawer.lua +++ b/stand/lua/drawer.lua @@ -506,23 +506,45 @@ drawer.frame_styles = { top_right = "+", bottom_right = "+", }, - ["single"] = { +} + +if core.hasUnicode() then + -- unicode based framing characters + drawer.frame_styles["single"] = { horizontal = "\xE2\x94\x80", vertical = "\xE2\x94\x82", top_left = "\xE2\x94\x8C", bottom_left = "\xE2\x94\x94", top_right = "\xE2\x94\x90", bottom_right = "\xE2\x94\x98", - }, - ["double"] = { + } + drawer.frame_styles["double"] = { horizontal = "\xE2\x95\x90", vertical = "\xE2\x95\x91", top_left = "\xE2\x95\x94", bottom_left = "\xE2\x95\x9A", top_right = "\xE2\x95\x97", bottom_right = "\xE2\x95\x9D", - }, -} + } +else + -- non-unicode cons25-style framing characters + drawer.frame_styles["single"] = { + horizontal = "\xC4", + vertical = "\xB3", + top_left = "\xDA", + bottom_left = "\xC0", + top_right = "\xBF", + bottom_right = "\xD9", + } + drawer.frame_styles["double"] = { + horizontal = "\xCD", + vertical = "\xBA", + top_left = "\xC9", + bottom_left = "\xC8", + top_right = "\xBB", + bottom_right = "\xBC", + } +end function drawer.drawscreen(menudef) -- drawlogo() must go first.