summaryrefslogtreecommitdiff
path: root/src/command_manager.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2016-08-05 13:53:19 +0100
committerMaxime Coste <frrrwww@gmail.com>2016-08-05 13:53:19 +0100
commit5b7b6eebafc025a33a2fba39f1873d4d09a04d86 (patch)
tree5b0136043bd704542af5801c82ed998a75b7eab3 /src/command_manager.cc
parent38d372567bab6f55d82d1e672485e8b9b23e59b2 (diff)
Regenerate shell-candidates for each completion sessions
That should allow fixing the #665 issue while still avoiding to run a potentially long shell command on each keystroke.
Diffstat (limited to 'src/command_manager.cc')
-rw-r--r--src/command_manager.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/command_manager.cc b/src/command_manager.cc
index 7419e0bc..ef2fef5c 100644
--- a/src/command_manager.cc
+++ b/src/command_manager.cc
@@ -609,6 +609,11 @@ Completions CommandManager::complete(const Context& context,
return Completions{};
const String& command_name = tokens[cmd_idx].content();
+ if (command_name != m_last_complete_command)
+ {
+ m_last_complete_command = command_name;
+ flags |= CompletionFlags::Start;
+ }
auto command_it = find_command(context, command_name);
if (command_it == m_commands.end() or
@@ -652,6 +657,11 @@ Completions CommandManager::complete(const Context& context,
else
{
const String& command_name = params[0];
+ if (command_name != m_last_complete_command)
+ {
+ m_last_complete_command = command_name;
+ flags |= CompletionFlags::Start;
+ }
auto command_it = find_command(context, command_name);
if (command_it != m_commands.end() and command_it->second.completer)