From nobody Sat Nov 2 22:03:02 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 4XgsDQ6sW0z5cqLY; Sat, 02 Nov 2024 22:03:02 +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 4XgsDQ4q70z4JlX; Sat, 2 Nov 2024 22:03:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730584982; 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=aJeizzkN4jWoykrX0DBVI3HHVIPAE0plnXS67MC4rB8=; b=FhmysAINDRohR1tUSWDcKeMnDM6EaxD/6XsrRfuxqITgzMMFSv/gvnFZB6nqQmQnyTEVwL mQD0Bt7kJ7gM3EedCCfMszAVXWwP/pjBMmST7RCRPJ8za2RFnTyKs3W1O8QEjfnOp72mzq Lr7g/NnvqDdobmmmncJDF5HJvgamUMrEQDGiLBUthk+vzJ0qE0+4zI6DDnEgv7+R2ci+j0 r20PBM1XpZNcbdyuTG3taE0jf87FPNMN9FuH9aT0X2La+DOPlyLyCm3GeyZg1Gbw/oN6ju uKkL4taFJaZYHqWav+gSuFXz9uktYQ73lXyL2g0rQOTw12rY+WoEydpbeym8BQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730584982; 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=aJeizzkN4jWoykrX0DBVI3HHVIPAE0plnXS67MC4rB8=; b=PsfaLsVlsA/06C2IbzPJZ+nw4IzZvUks3kVNkBFHdlEMn65vKHh6TLSXev6Z3M1E6H+ozq m2m2xvQYzCd1QJ5VKdHdYZoHqdKFKeDDn96bzSuMayhi6pbiH2APRsEsf7v7tF1i5fyuDA cwZbVgXz0nBzWjWucQptyLOeADZxvRl2+frKQ3RwMI6TQL0gV8Kky/66PX6NwxX0Qk63Uh zOof/7yK0AY8bDYV05xhbT+ul7i6KboNDlD15ESoUNtpk6vf3X5/u8pOfsG8uUkN/XpHME oJufQOfcLRFaCPkzWVV3vdeIuIFLdgO1AmYYybyr61esi5i8P0Ns8qjWciFBzw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1730584982; a=rsa-sha256; cv=none; b=fAASl2rKrj6Ms6cv5DE9VqErescZBRFvCtIv0GRzKCxy/n/s9avX4KCO0MnD0ShDQtUpmw fq6pyGzq3SMvqKVKnXpknM7ZbEk8nJBknXj4gHtY/VgyNVnxLpwa2kFAwOMZTSPxkExBOb 9TXcQC+n8gtj4/nw2gQyDs8LhLw2eV66BYI/29DBHt4+fhpaFJIdr146Y+1JBOp0ijUiu3 v4NDw788c1UzMArT4aH2WR17gU7+s0cJlp0G8A9OOAH0kraWvEsjmekrTQ6+Ru5uNpIcKZ 7/0UBKXQLv3Kt8VjrEDAxCDM6gw0v3o16X0FdMkbdjmh7gdFMKlhAIeh4uK8pg== 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 4XgsDQ4QLyzMdL; Sat, 2 Nov 2024 22:03:02 +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 4A2M323X012102; Sat, 2 Nov 2024 22:03:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4A2M322V012099; Sat, 2 Nov 2024 22:03:02 GMT (envelope-from git) Date: Sat, 2 Nov 2024 22:03:02 GMT Message-Id: <202411022203.4A2M322V012099@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: c2ba66d4d01f - main - 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/main X-Git-Reftype: branch X-Git-Commit: c2ba66d4d01f23303352bfe3cbd50ff5d9a05947 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=c2ba66d4d01f23303352bfe3cbd50ff5d9a05947 commit c2ba66d4d01f23303352bfe3cbd50ff5d9a05947 Author: Warner Losh AuthorDate: 2024-11-02 22:02:44 +0000 Commit: Warner Losh CommitDate: 2024-11-02 22:02:44 +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 --- 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 3a462930b86b..e55702ffee6c 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.