]> git.saurik.com Git - cycript.git/commitdiff
Replace regex with prefix substr for tab-complete.
authorJay Freeman (saurik) <saurik@saurik.com>
Sun, 17 Jun 2012 09:23:08 +0000 (02:23 -0700)
committerJay Freeman (saurik) <saurik@saurik.com>
Sun, 17 Jun 2012 09:23:08 +0000 (02:23 -0700)
Console.cpp

index d669e67239ff008726de6258bd6c6c0bee187852..d41f6ef5bbb174e312a07b05a31f9139a3f9354d 100644 (file)
@@ -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"
     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"
     "       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))));
     "       return names;\n"
     "   }\n"
     ), expression, $S(begin.c_str()), $S(word))));