Skip to contentSkip to conversation

regression fix

PATCH Carles Pina i Estany 2 participants 3 messages Dec 26, 2009

lore
Share & tools
lore
#0 lore raw

Hi,

Commit 1949 introduced a bug using TAB due a miss-understanding that I had with the code.

Find an attached patch that fix it.

Brief ok from someone?

Signature · 2 lines
Carles Pina i Estany
	http://pinux.info

=== modified file 'ChangeLog'

ChangeLog +6 -0
@@ -1,5 +1,11 @@
 2009-12-26  Carles Pina i Estany  <[email protected]>
 
+	* normal/cmdline.c (grub_cmdline_get): Print a space after prompt.
+	* normal/main.c (grub_normal_read_line): Remove a space from the
+	default prompt.
+
+2009-12-26  Carles Pina i Estany  <[email protected]>
+
 	* commands/help.c (grub_cmd_help): Print the command name before the
 	summary.
 	(GRUB_MOD_INIT): Remove command name from the summary.

=== modified file 'normal/cmdline.c'

cmdline.c +2 -2
@@ -268,14 +268,14 @@ grub_cmdline_get (const char *prompt, ch
       grub_refresh ();
     }
 
-  plen = grub_strlen (prompt_translated);
+  plen = grub_strlen (prompt_translated) + 1;
   lpos = llen = 0;
   buf[0] = '\0';
 
   if ((grub_getxy () >> 8) != 0)
     grub_putchar ('\n');
 
-  grub_printf ("%s", prompt_translated);
+  grub_printf ("%s ", prompt_translated);
 
   xpos = plen;
   ystart = ypos = (grub_getxy () & 0xFF);

=== modified file 'normal/main.c'

main.c +2 -2
@@ -546,9 +546,9 @@ static grub_err_t
 grub_normal_read_line (char **line, int cont)
 {
   grub_parser_t parser = grub_parser_get_current ();
-  char prompt[sizeof("> ") + grub_strlen (parser->name)];
+  char prompt[sizeof(">") + grub_strlen (parser->name)];
 
-  grub_sprintf (prompt, "%s> ", parser->name);
+  grub_sprintf (prompt, "%s>", parser->name);
 
   while (1)
     {
#1 lore raw
Quoted 5 lines · Carles Pina i Estany

Hi,

Commit 1949 introduced a bug using TAB due a miss-understanding that I had with the code.

Oh, good to know. I was wondering why TAB expansion did these weird things ;-)

cmdline.c grub_cmdline_get (const char *prompt, ch · line 271

Quoted 2 lines
cmdline.c +1 -1
-  plen = grub_strlen (prompt_translated);
+  plen = grub_strlen (prompt_translated) + 1;

Please consider if sizeof() would make sense here.

Signature · 3 lines
Robert Millan

  "Be the change you want to see in the world" -- Gandhi
#2 lore raw

Hi,

Quoted 9 lines · Robert Millan
Quoted 5 lines · Carles Pina i Estany

Hi,

Commit 1949 introduced a bug using TAB due a miss-understanding that I had with the code.

Oh, good to know. I was wondering why TAB expansion did these weird things ;-)

Sorry for the inconvenience :-)

Pushing now.

Signature · 2 lines
Carles Pina i Estany
	http://pinux.info