Re: [PATCH] password: Fix backspace in username prompt

2021-03-02 Thread Egor Ignatov
I used grub_printf 3 times, because for some reason (line wrapping I 
guess) if you print "\b \b" at once the backspace key doesn't work on 
the second last character in the terminal line. The visual cursor gets 
stuck there and doesn't remove characters anymore, although you can 
still type more.
This may be irrelevant because I doubt anyone is using a username longer 
than one line, but it solves the problem.


On 3/1/21 8:26 PM, Lennart Sorensen wrote:

On Mon, Mar 01, 2021 at 10:58:40AM +0300, Egor Ignatov wrote:

From: Egor Ignatov 

Make backspace work in superuser login prompt.

The problem was that bidi logical to visual ignored BN type,
so you couldn't print control characters.

Use grub_printf() 3 times, because a line wrap will cause
the cursor to get stuck at the end of the terminal line.

Resolves: #60114
Signed-off-by: Egor Ignatov 
---
  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;
}

Is this the part that the commit message refers to?  I must admit I
am not quite sure why this change makes a difference, but if it does,
perhaps it is important (and non obvious) enough that the code should
actually have a comment explaining it, or someone might come by and
clean it up again later.



___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] password: Fix backspace in username prompt

2021-03-01 Thread Lennart Sorensen
On Mon, Mar 01, 2021 at 10:58:40AM +0300, Egor Ignatov wrote:
> From: Egor Ignatov 
> 
> Make backspace work in superuser login prompt.
> 
> The problem was that bidi logical to visual ignored BN type,
> so you couldn't print control characters.
> 
> Use grub_printf() 3 times, because a line wrap will cause
> the cursor to get stuck at the end of the terminal line.
> 
> Resolves: #60114
> Signed-off-by: Egor Ignatov 
> ---
>  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;
>   }

Is this the part that the commit message refers to?  I must admit I
am not quite sure why this change makes a difference, but if it does,
perhaps it is important (and non obvious) enough that the code should
actually have a comment explaining it, or someone might come by and
clean it up again later.

-- 
Len Sorensen

___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel