On Fri, Feb 26, 2021 at 02:53:47PM +0300, Egor Ignatov wrote: > 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. >
> >From a227f1a2c54aa420e016ffb5ca1c41fe93a2bd68 Mon Sep 17 00:00:00 2001 > From: Egor Ignatov <eg...@altlinux.org> > Date: Fri, 26 Feb 2021 12:08:23 +0300 > Subject: [PATCH] Fix backspace in username prompt May I ask you to use "git send-email" to send the patch? Additionally, could you explain in the commit message why this patch is needed and what it does? And of course add your SOB... > --- > 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"); Why could not you leave original grub_printf() call? > } > 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--; > + } I think you can leave original "if" as is. > + else if (virtual_screen.cursor_y > 0) > + { > + virtual_screen.cursor_y--; > + virtual_screen.cursor_x = virtual_screen.columns-2; > + } Daniel _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel