shell_completion uses command completion after semicolons
This commit is contained in:
parent
6c4c32eb59
commit
3017531699
|
@ -11,12 +11,11 @@ Completions shell_complete(const Context& context, CompletionFlags flags,
|
||||||
ByteCount word_start = 0;
|
ByteCount word_start = 0;
|
||||||
ByteCount word_end = 0;
|
ByteCount word_end = 0;
|
||||||
|
|
||||||
bool first = true;
|
bool command = true;
|
||||||
const ByteCount len = prefix.length();
|
const ByteCount len = prefix.length();
|
||||||
for (ByteCount pos = 0; pos < cursor_pos;)
|
for (ByteCount pos = 0; pos < cursor_pos;)
|
||||||
{
|
{
|
||||||
if (pos != 0)
|
command = (pos == 0 or prefix[pos-1] == ';');
|
||||||
first = false;
|
|
||||||
while (pos != len and is_blank(prefix[pos]))
|
while (pos != len and is_blank(prefix[pos]))
|
||||||
++pos;
|
++pos;
|
||||||
word_start = pos;
|
word_start = pos;
|
||||||
|
@ -25,7 +24,7 @@ Completions shell_complete(const Context& context, CompletionFlags flags,
|
||||||
word_end = pos;
|
word_end = pos;
|
||||||
}
|
}
|
||||||
Completions completions{word_start, word_end};
|
Completions completions{word_start, word_end};
|
||||||
if (first)
|
if (command)
|
||||||
completions.candidates = complete_command(prefix.substr(word_start, word_end),
|
completions.candidates = complete_command(prefix.substr(word_start, word_end),
|
||||||
cursor_pos - word_start);
|
cursor_pos - word_start);
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue
Block a user