From: Jay Freeman (saurik) Date: Sun, 17 Jun 2012 09:23:08 +0000 (-0700) Subject: Replace regex with prefix substr for tab-complete. X-Git-Tag: v0.9.458~3 X-Git-Url: https://git.saurik.com/cycript.git/commitdiff_plain/5a3f7a01ed6a285d84b25d9c939caafec9a61227 Replace regex with prefix substr for tab-complete. --- diff --git a/Console.cpp b/Console.cpp index d669e67..d41f6ef 100644 --- a/Console.cpp +++ b/Console.cpp @@ -283,11 +283,12 @@ static char **Complete(const char *word, int start, int end) { driver.program_ = $ CYProgram($ CYExpress($C3(ParseExpression( " function(object, prefix, word) {\n" " var names = [];\n" - " var pattern = '^' + prefix + word;\n" - " var length = prefix.length;\n" + " var before = prefix.length;\n" + " prefix += word;\n" + " var entire = prefix.length;\n" " for (name in object)\n" - " if (name.match(pattern) != null)\n" - " names.push(name.substr(length));\n" + " if (name.substring(0, entire) == prefix)\n" + " names.push(name.substr(before));\n" " return names;\n" " }\n" ), expression, $S(begin.c_str()), $S(word))));