Skip to content

Commit 8f60112

Browse files
committed
fixes directory and files sugestions
1 parent b7eca56 commit 8f60112

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

src/FlubuCore/Infrastructure/Terminal/FlubuConsole.cs

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -474,21 +474,11 @@ private string WriteSugestionAsUserInput(string userInput, Suggestion suggestion
474474
{
475475
if (fullInput.Contains(@"\") && startsWithCd)
476476
{
477-
var splitedInputs = fullInput.Split(' ').Last().Split('\\');
478-
479-
foreach (var spllitedInput in splitedInputs)
480-
{
481-
li = li + spllitedInput.Length + 1;
482-
}
477+
li = fullInput.LastIndexOf("\\") + 1;
483478
}
484479
else if (fullInput.Contains("/") && startsWithCd)
485480
{
486-
var splitedInputs = fullInput.Split(' ').Last().Split('/');
487-
488-
foreach (var spllitedInput in splitedInputs)
489-
{
490-
li = li + spllitedInput.Length + 1;
491-
}
481+
li = fullInput.LastIndexOf("/") + 1;
492482
}
493483
else
494484
{
@@ -502,9 +492,17 @@ private string WriteSugestionAsUserInput(string userInput, Suggestion suggestion
502492
}
503493
else
504494
{
505-
if (fullInput.Contains("/") || fullInput.Contains(@"\"))
495+
if (fullInput.Contains(@"\"))
496+
{
497+
li = fullInput.LastIndexOf("\\") + 1;
498+
}
499+
else if (fullInput.Contains("/"))
500+
{
501+
li = fullInput.LastIndexOf("/") + 1;
502+
}
503+
else
506504
{
507-
li++;
505+
li = 0;
508506
}
509507
}
510508
}

0 commit comments

Comments
 (0)