diff --git a/ChangeLog b/ChangeLog index ba4a7d7e3..a7f995e29 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-01-27 Vladimir Serbinenko + + * normal/cmdline.c (grub_cmdline_get): Fix completion in the middle + of the line. + 2010-01-27 Vladimir Serbinenko * kern/disk.c (grub_disk_read): Fix offset computation when reading diff --git a/normal/cmdline.c b/normal/cmdline.c index bcffffeab..997965fca 100644 --- a/normal/cmdline.c +++ b/normal/cmdline.c @@ -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);