X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/6dccefa97d3d196f2c1da710afc716df700352d5..996c7c0ce2f75b82b32c43d64c350fd71b05e0cd:/Console.cpp diff --git a/Console.cpp b/Console.cpp index 2d6b566..3fe2310 100644 --- a/Console.cpp +++ b/Console.cpp @@ -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); @@ -357,12 +358,6 @@ static char **Complete(const char *word, int start, int end) { if (count == 0) return NULL; - if (!common.empty()) { - size_t size(prefix.str().size()); - _assert(common.size() >= size); - common = common.substr(size); - } - size_t colon(common.find(':')); if (colon != std::string::npos) common = common.substr(0, colon + 1); @@ -382,7 +377,7 @@ static char **Complete(const char *word, int start, int end) { // need char *, not const char * static char name_[] = "cycript"; -static char break_[] = " \t\n\"\\'`@$><=;|&{(" ".:"; +static char break_[] = " \t\n\"\\'`@$><=;|&{(" ")}" ".:[]"; static void Console(apr_pool_t *pool, CYOptions &options) { passwd *passwd;