]> git.saurik.com Git - cycript.git/commitdiff
Cut off messages prefixes.
authorJay Freeman (saurik) <saurik@saurik.com>
Tue, 27 Apr 2010 21:09:02 +0000 (21:09 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Tue, 27 Apr 2010 21:09:02 +0000 (21:09 +0000)
Console.cpp

index 91d389cb8ec283a41268b9233d3d25d380aa2cdd..c4303f683344f2b77bd16374f00cca15e44318d1 100644 (file)
@@ -290,18 +290,19 @@ static char **Complete(const char *word, int start, int end) {
             _assert(false);
     }
 
-    std::string begin(prefix.str() + word);
+    std::string begin(prefix.str());
 
-    driver.program_ = $ CYProgram($ CYExpress($C2(ParseExpression(pool,
-    "   function(object, prefix) {\n"
+    driver.program_ = $ CYProgram($ CYExpress($C3(ParseExpression(pool,
+    "   function(object, prefix, word) {\n"
     "       var names = [];\n"
-    "       var pattern = '^' + prefix;\n"
+    "       var pattern = '^' + prefix + word;\n"
+    "       var length = prefix.length;\n"
     "       for (name in object)\n"
     "           if (name.match(pattern) != null)\n"
-    "               names.push(name);\n"
+    "               names.push(name.substr(length));\n"
     "       return names;\n"
     "   }\n"
-    ), expression, $S(begin.c_str()))));
+    ), expression, $S(begin.c_str()), $S(word))));
 
     driver.program_->Replace(context);