]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2010-01-27 Vladimir Serbinenko <phcoder@gmail.com>
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Wed, 27 Jan 2010 16:47:36 +0000 (17:47 +0100)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Wed, 27 Jan 2010 16:47:36 +0000 (17:47 +0100)
* normal/cmdline.c (grub_cmdline_get): Fix completion in the middle
of the line.

ChangeLog
normal/cmdline.c

index ba4a7d7e3978b339fd0f4a60928df9219111363a..a7f995e299884d28dad5f6c95fac3f6998f29c4a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-01-27  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * normal/cmdline.c (grub_cmdline_get): Fix completion in the middle
+       of the line.
+
 2010-01-27  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * kern/disk.c (grub_disk_read): Fix offset computation when reading
index bcffffeab744e786657fa6a063fd360c47aaa292..997965fca237151b5978fb7eb65cc0e055c7c124 100644 (file)
@@ -419,10 +419,13 @@ grub_cmdline_get (const char *prompt)
            int restore;
            char *insertu8;
            char *bufu8;
+           grub_uint32_t c;
 
+           c = buf[lpos];
            buf[lpos] = '\0';
 
            bufu8 = grub_ucs4_to_utf8_alloc (buf, lpos);
+           buf[lpos] = c;
            if (!bufu8)
              {
                grub_print_error ();
@@ -462,8 +465,19 @@ grub_cmdline_get (const char *prompt)
                                       insertlen, 0);
                if (t > 0)
                  {
-                   insert[t] = 0;
-                   cl_insert (insert);
+                   if (insert[t-1] == ' ' && buf[lpos] == ' ')
+                     {
+                       insert[t-1] = 0;
+                       if (t != 1)
+                         cl_insert (insert);
+                       lpos++;
+                       cl_set_pos_all ();                      
+                     }
+                   else
+                     {
+                       insert[t] = 0;
+                       cl_insert (insert);
+                     }
                  }
 
                grub_free (insertu8);