From nobody Mon Nov 04 04:58:23 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 4XhfPC45J2z5c9FQ; Mon, 04 Nov 2024 04:58:23 +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 4XhfPC3Z22z4fvZ; Mon, 4 Nov 2024 04:58:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730696303; 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=fBVMcQCU1RcyZXCJ7XttIhG0th+sh1To8Hf3EuSI3mE=; b=dCJ1oLPOz9+reyuXekc8U5JSuI2TcC9gLTYp6iY0ysszFT3chAFSyRaMMSrR/dBk5xFwyT p7I34IvNuewg0r90ct/dtLOQUoxCPWcb3eE/KuVnnMa859Fg33L/fUKSphUC9nsp8+cEgS p5ER61Vio2K07CwemkdxgJFEyogKybBDV8dokTFiUmxTflMoRj++VWtieOm8zyCpwjuw9V /b7gWaEGpXOtnwbJtoDsqln8LQEatsj34c5U73mmONTCW8NKrybTxLV7YEYACSdccNPXkd rgfsGtuo3S+tBksRv/N5+VOYlYPIie6nj/b8QxIafIZ1rmwi6ZOjHi1hj9GNfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730696303; 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=fBVMcQCU1RcyZXCJ7XttIhG0th+sh1To8Hf3EuSI3mE=; b=q/4DCW58JrEVnfVUsxpomQ4MXNyQeN42/i2DDginLoPxloiSxK+p6Fxb1QPi9ASaeW9eUt HwZlScH7J2dR9XzInUwSEjgWv9u+IpVmi7PkP0c6Rcgfr5spvalgr3C2iXONOakBfcIk6U ZJGzDOUFd3SLan32DaVCoAPzxeDDHvDvqi03g0A+54OvbThF6hc6SlWmNjlmsBeb67nj6T HDBqydAHwlV51Dfkedrm9c0Sew3pEfuwwKkKxF4ruOBCfZ1ijy3w9k5Aqd3k8ZIdaEe3J6 V09AUlNX59pPtGScAM5BYY9Io6qKdJIesCeV8teRtw/+q6TCrcjM7Wdu6D3lPw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1730696303; a=rsa-sha256; cv=none; b=t7TABmhT/iMaSfJO0HXLO/mzq9jAJ7uJ1U5Rp+etKTWVkt6oWU0mEh2Jsj5EuV+TWMjqX8 rhGrSnZPTNKrgAiM3DFJm7bLgy4t5I0uDc/mvY7m3CdBmFW6yO8m7eeFvwo3BZtHFM0ghX 0fnUvTDaWxErCObJBvD8m6Jg0ZVfuYbksIPvL9h4HApTpKKdB4wi66/Ify3aP36wHcLpxC N7nt3TIdvOGl49riAwZ1zMtqe0iH+nwaa91CXowlpDT2dYW3Sn9xYA9SO7WI/i8NG1JFUV l5schr0xNE4c4xJxCphk4o/h9jBzssStrRZFCMPu+LearUwt7qqbPOmV/pyjuA== 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 4XhfPC337ZzKR1; Mon, 4 Nov 2024 04:58:23 +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 4A44wNmH049226; Mon, 4 Nov 2024 04:58:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4A44wNFj049223; Mon, 4 Nov 2024 04:58:23 GMT (envelope-from git) Date: Mon, 4 Nov 2024 04:58:23 GMT Message-Id: <202411040458.4A44wNFj049223@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: f2103edaf522 - stable/14 - 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/stable/14 X-Git-Reftype: branch X-Git-Commit: f2103edaf5229271f3f6769844c0c747d8352228 Auto-Submitted: auto-generated The branch stable/14 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f2103edaf5229271f3f6769844c0c747d8352228 commit f2103edaf5229271f3f6769844c0c747d8352228 Author: Warner Losh AuthorDate: 2024-11-02 22:02:44 +0000 Commit: Warner Losh CommitDate: 2024-11-04 00:51:24 +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) --- 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.