Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1lgMGr-0008V8-0S for mharc-grub-devel@gnu.org; Tue, 11 May 2021 02:53:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45364) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lgMGl-0008Sl-AJ for grub-devel@gnu.org; Tue, 11 May 2021 02:53:28 -0400 Received: from air.basealt.ru ([194.107.17.39]:38490) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lgMGh-0001TU-Sp for grub-devel@gnu.org; Tue, 11 May 2021 02:53:26 -0400 Received: by air.basealt.ru (Postfix, from userid 490) id 8096158951E; Tue, 11 May 2021 06:53:19 +0000 (UTC) Received: from EGORI-MACHINE.malta.altlinux.ru (obninsk.basealt.ru [217.15.195.17]) by air.basealt.ru (Postfix) with ESMTPSA id B7EA258951C; Tue, 11 May 2021 06:53:17 +0000 (UTC) From: Egor Ignatov To: dkiper@net-space.pl Cc: grub-devel@gnu.org Subject: [PATCH v2] Fix backspace in the username login prompt Date: Tue, 11 May 2021 09:52:39 +0300 Message-Id: <20210511065239.163350-1-egori@altlinux.org> X-Mailer: git-send-email 2.29.3 In-Reply-To: <20210507151010.7fzbexpdg4y7og73@tomti.i.net-space.pl> References: <20210507151010.7fzbexpdg4y7og73@tomti.i.net-space.pl> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=194.107.17.39; envelope-from=egori@altlinux.org; helo=air.basealt.ru X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 May 2021 06:53:28 -0000 This patch fixes a bug when backspace key does not work in the username login prompt. It allows backspace characters in the BIDI visual line. Thus grub_gfxterm_putchar receives '\b' chars that were previously ignored. Signed-off-by: Egor Ignatov --- > Did you test this patch with other BIDI type BN characters [1]? I am not You are right, I added a check to handle only backspace characters > convinced it works with them as expected. I think earlier version of your > patch was more promising... Earlier versions of my patch included workaround for special case when the password is longer than one line. This scenario is not very realistic and I dont think it's worth complicating the codebase. Thank you for your response. Let me know if you have any concerns about this version. Egor grub-core/normal/charset.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/grub-core/normal/charset.c b/grub-core/normal/charset.c index 4dfcc3107..8e7add1f8 100644 --- a/grub-core/normal/charset.c +++ b/grub-core/normal/charset.c @@ -931,6 +931,8 @@ grub_bidi_line_logical_to_visual (const grub_uint32_t *logical, pop_stack (); break; case GRUB_BIDI_TYPE_BN: + if (visual[visual_len].base == '\b') + visual_len++; break; case GRUB_BIDI_TYPE_R: case GRUB_BIDI_TYPE_AL: -- 2.29.3