private static string CompleteTab(string script, string init, ref int tabFileIndex, ref string start, ref string baseStr, ref string startsWith) { if (tabFileIndex > 0 && !script.Equals(init)) { // The user has changed something in the input field tabFileIndex = 0; } if (tabFileIndex == 0 || script.EndsWith(Path.DirectorySeparatorChar.ToString())) { // The user pressed tab the first time or pressed it on a directory string path = ""; SplitByLast(script, " ", ref start, ref path); SplitByLast(path, "/\\", ref baseStr, ref startsWith); } tabFileIndex++; string result = Utils.GetFileEntry(baseStr, tabFileIndex, startsWith); result = result.Length == 0 ? startsWith : result; return(start + baseStr + result); }