Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1lFbh2-0006lP-EI for mharc-grub-devel@gnu.org; Fri, 26 Feb 2021 06:54:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41242) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lFbh0-0006kd-Rw for grub-devel@gnu.org; Fri, 26 Feb 2021 06:53:58 -0500 Received: from air.basealt.ru ([194.107.17.39]:54048) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lFbgw-0002cy-RW for grub-devel@gnu.org; Fri, 26 Feb 2021 06:53:58 -0500 Received: by air.basealt.ru (Postfix, from userid 490) id 9380558950B; Fri, 26 Feb 2021 11:53:49 +0000 (UTC) Received: from [10.88.144.159] (obninsk.basealt.ru [217.15.195.17]) by air.basealt.ru (Postfix) with ESMTPSA id 011D658943C for ; Fri, 26 Feb 2021 11:53:47 +0000 (UTC) To: grub-devel@gnu.org From: Egor Ignatov Subject: bug #60114: The "Backspace" key doesn't work correctly in the superuser authentication prompt. Message-ID: <85c0d741-626c-4bd3-28cc-156e34330540@basealt.ru> Date: Fri, 26 Feb 2021 14:53:47 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------59A9E53EC68F76EA08B56444" Content-Language: en-US Received-SPF: pass client-ip=194.107.17.39; envelope-from=egori@basealt.ru; 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: Fri, 26 Feb 2021 11:53:59 -0000 This is a multi-part message in MIME format. --------------59A9E53EC68F76EA08B56444 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Hi, yesterday I submitted a bug report about wrong backspace key behavior in superuser login prompt and I finally found it. So I attach patch with my fix so it can be merged into upstream. --------------59A9E53EC68F76EA08B56444 Content-Type: text/x-patch; charset=UTF-8; name="0001-Fix-backspace-in-username-prompt.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-Fix-backspace-in-username-prompt.patch" From a227f1a2c54aa420e016ffb5ca1c41fe93a2bd68 Mon Sep 17 00:00:00 2001 From: Egor Ignatov Date: Fri, 26 Feb 2021 12:08:23 +0300 Subject: [PATCH] Fix backspace in username prompt --- grub-core/normal/auth.c | 4 +++- grub-core/normal/charset.c | 1 + grub-core/term/gfxterm.c | 11 +++++++++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/grub-core/normal/auth.c b/grub-core/normal/auth.c index 6be678c0d..ffbf6d890 100644 --- a/grub-core/normal/auth.c +++ b/grub-core/normal/auth.c @@ -177,7 +177,9 @@ grub_username_get (char buf[], unsigned buf_size) if (cur_len) { cur_len--; - grub_printf ("\b \b"); + grub_printf ("\b"); + grub_printf (" "); + grub_printf ("\b"); } continue; } diff --git a/grub-core/normal/charset.c b/grub-core/normal/charset.c index 4dfcc3107..77073c12f 100644 --- a/grub-core/normal/charset.c +++ b/grub-core/normal/charset.c @@ -931,6 +931,7 @@ grub_bidi_line_logical_to_visual (const grub_uint32_t *logical, pop_stack (); break; case GRUB_BIDI_TYPE_BN: + visual_len++; break; case GRUB_BIDI_TYPE_R: case GRUB_BIDI_TYPE_AL: diff --git a/grub-core/term/gfxterm.c b/grub-core/term/gfxterm.c index af7c090a3..130d33988 100644 --- a/grub-core/term/gfxterm.c +++ b/grub-core/term/gfxterm.c @@ -846,8 +846,15 @@ grub_gfxterm_putchar (struct grub_term_output *term, switch (c->base) { case '\b': - if (virtual_screen.cursor_x > 0) - virtual_screen.cursor_x--; + if (virtual_screen.cursor_x > 0) + { + virtual_screen.cursor_x--; + } + else if (virtual_screen.cursor_y > 0) + { + virtual_screen.cursor_y--; + virtual_screen.cursor_x = virtual_screen.columns-2; + } break; case '\n': -- 2.25.4 --------------59A9E53EC68F76EA08B56444--