diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2014-01-03 20:47:49 +0000 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2014-01-03 20:47:49 +0000 |
| commit | 3017531699ba988150e2771e6a0ea3635b3dc15f (patch) | |
| tree | 26581b870f3e17bb681050984036ea1de5400d93 /src/completion.cc | |
| parent | 6c4c32eb59683bb9d975940cb0923c08fe4dbfc0 (diff) | |
shell_completion uses command completion after semicolons
Diffstat (limited to 'src/completion.cc')
| -rw-r--r-- | src/completion.cc | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/completion.cc b/src/completion.cc index b2579ff3..51132d93 100644 --- a/src/completion.cc +++ b/src/completion.cc @@ -11,12 +11,11 @@ Completions shell_complete(const Context& context, CompletionFlags flags, ByteCount word_start = 0; ByteCount word_end = 0; - bool first = true; + bool command = true; const ByteCount len = prefix.length(); for (ByteCount pos = 0; pos < cursor_pos;) { - if (pos != 0) - first = false; + command = (pos == 0 or prefix[pos-1] == ';'); while (pos != len and is_blank(prefix[pos])) ++pos; word_start = pos; @@ -25,7 +24,7 @@ Completions shell_complete(const Context& context, CompletionFlags flags, word_end = pos; } Completions completions{word_start, word_end}; - if (first) + if (command) completions.candidates = complete_command(prefix.substr(word_start, word_end), cursor_pos - word_start); else |
