readline autocomplete: complete up to next space, so complete one single word at once
This commit is contained in:
1 parent
ef7c301217
commit
f2650e7279
1 file changed
+6
-1
@@ -732,7 +732,12 @@ char* rl_command_generator(const char *text, int state) {
|
||||
index++;
|
||||
|
||||
if (strncmp (command, rl_line_buffer, rlen) == 0) {
|
||||
return strdup(command + (rlen - len));
|
||||
const char *next = command + (rlen - len);
|
||||
const char *space = strstr(next, " ");
|
||||
if (space != NULL) {
|
||||
return strndup(next, space - next);
|
||||
}
|
||||
return strdup(next);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user