From 2b3e9c28b20f46c1299aa01818e0a8981b534ced Mon Sep 17 00:00:00 2001 From: AnotherTest Date: Thu, 21 May 2020 18:04:33 +0430 Subject: [PATCH] Shell: Take whitespace into account when suggesting tokens Prior to this, we did not care if there was any whitespace after the last token in the prompt, and this caused a regression: ``` > lsp > lsp ci ``` --- Shell/Shell.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Shell/Shell.cpp b/Shell/Shell.cpp index 9315e7128e..f2fb1d5986 100644 --- a/Shell/Shell.cpp +++ b/Shell/Shell.cpp @@ -1501,8 +1501,14 @@ Vector Shell::complete(const Line::Editor& editor) if (args.last().type == Token::Comment) // we cannot complete comments return {}; - is_first_in_subcommand = args.size() == 1; - token = last_command.args.last().text; + if (args.last().end != line.length()) { + // There was a token separator at the end + is_first_in_subcommand = false; + token = ""; + } else { + is_first_in_subcommand = args.size() == 1; + token = last_command.args.last().text; + } } }