summaryrefslogtreecommitdiff
path: root/src/command_manager.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2015-08-27 13:57:56 +0100
committerMaxime Coste <frrrwww@gmail.com>2015-08-27 13:57:56 +0100
commitb5292881764cc5cb05dcd3fbb1b7d4c3a24d91ea (patch)
tree1b201d80aad773f926176d1a4aca220aeedba384 /src/command_manager.cc
parent04536657d1292f330e2e7b7e45512268119eb25e (diff)
Small code cleanup in command_manager.cc
Diffstat (limited to 'src/command_manager.cc')
-rw-r--r--src/command_manager.cc20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/command_manager.cc b/src/command_manager.cc
index 164b3303..244bc412 100644
--- a/src/command_manager.cc
+++ b/src/command_manager.cc
@@ -550,20 +550,14 @@ Completions CommandManager::complete(const Context& context,
switch (token_type)
{
case Token::Type::OptionExpand:
- {
- Completions result(start , cursor_pos);
- result.candidates = GlobalScope::instance().option_registry().complete_option_name(
- tokens[tok_idx].content(), cursor_pos_in_token);
- return result;
- }
+ return {start , cursor_pos,
+ GlobalScope::instance().option_registry().complete_option_name(
+ tokens[tok_idx].content(), cursor_pos_in_token) };
+
case Token::Type::ShellExpand:
- {
- Completions shell_completions = shell_complete(
- context, flags, tokens[tok_idx].content(), cursor_pos_in_token);
- shell_completions.start += start;
- shell_completions.end += start;
- return shell_completions;
- }
+ return offset_pos(shell_complete(context, flags, tokens[tok_idx].content(),
+ cursor_pos_in_token), start);
+
case Token::Type::Raw:
{
if (tokens[cmd_idx].type() != Token::Type::Raw)