From 02de225e71a7acce847ec72841464f31834956c7 Mon Sep 17 00:00:00 2001 From: silverqx Date: Thu, 16 Jun 2022 13:16:07 +0200 Subject: [PATCH] enhanced pwsh complete --- tom/src/tom/commands/completecommand.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tom/src/tom/commands/completecommand.cpp b/tom/src/tom/commands/completecommand.cpp index feee35286..9c39ec937 100644 --- a/tom/src/tom/commands/completecommand.cpp +++ b/tom/src/tom/commands/completecommand.cpp @@ -87,9 +87,12 @@ int CompleteCommand::run() // Currently proccessed tom command const auto currentCommandSplitted = commandlineArg.split(SPACE); + Q_ASSERT(!currentCommandSplitted.isEmpty()); + const auto currentCommandArg = currentCommandSplitted.size() >= 2 ? std::make_optional(currentCommandSplitted[1]) : std::nullopt; + const auto tomCommandSize = currentCommandSplitted[0].size(); #else const auto cwordArg = static_cast(value(cword_).toLongLong()); @@ -103,8 +106,9 @@ int CompleteCommand::run() --- */ #ifdef _MSC_VER if (!isOptionArgument(wordArg) && wordArg.isEmpty() && - positionArg >= commandlineArgSize && - (!commandlineArg.contains(SPACE) || currentCommandArg == Help) + (positionArg == tomCommandSize + 1 || + (positionArg >= commandlineArgSize && + (!commandlineArg.contains(SPACE) || currentCommandArg == Help))) ) #else if (!isOptionArgument(wordArg) && wordArg.isEmpty() &&