edit: Fix completion at the last character
Completion needs to be done even if the full word has been entered. In addition, fix the space-after-full-word to properly allocate room for the extra character when completion is used in the middle of the string.
This commit is contained in:
parent
89eb6b774d
commit
414780027a
1 changed files with 3 additions and 3 deletions
|
@ -377,7 +377,7 @@ static void complete(int list)
|
|||
}
|
||||
|
||||
len = max_common_length(c);
|
||||
if (len <= plen) {
|
||||
if (len < plen) {
|
||||
if (list) {
|
||||
edit_clear_line();
|
||||
printf("\r");
|
||||
|
@ -396,8 +396,8 @@ static void complete(int list)
|
|||
len = room;
|
||||
add_space = count == 1 && len < room;
|
||||
|
||||
os_memmove(cmdbuf + cmdbuf_pos + len, cmdbuf + cmdbuf_pos,
|
||||
cmdbuf_len - cmdbuf_pos + add_space);
|
||||
os_memmove(cmdbuf + cmdbuf_pos + len + add_space, cmdbuf + cmdbuf_pos,
|
||||
cmdbuf_len - cmdbuf_pos);
|
||||
os_memcpy(&cmdbuf[cmdbuf_pos - plen], c[0], plen + len);
|
||||
if (add_space)
|
||||
cmdbuf[cmdbuf_pos + len] = ' ';
|
||||
|
|
Loading…
Reference in a new issue