]> git.saurik.com Git - cycript.git/commitdiff
Fix long-broken Objective-C message ]-completions.
authorJay Freeman (saurik) <saurik@saurik.com>
Sun, 10 Jan 2016 00:00:51 +0000 (16:00 -0800)
committerJay Freeman (saurik) <saurik@saurik.com>
Sun, 10 Jan 2016 00:00:51 +0000 (16:00 -0800)
Complete.cpp

index fcf8f5dc364e6b4def21964068c067e5e2ca5f5b..57e4d387370d8b86e1dbc3b4ac9dec37abc57ee2 100644 (file)
@@ -179,17 +179,14 @@ _visible char **CYComplete(const char *word, const std::string &line, CYUTF8Stri
         if (string == NULL)
             CYThrow("string was actually %s", typeid(*value->value_).name());
 
-        CYUTF8String completion;
-        if (string->size_ != 0)
-            completion = {string->value_, string->size_};
-        else if (driver.mode_ == CYDriver::AutoMessage)
-            completion = "]";
-        else
-            continue;
-
+        CYUTF8String completion(string->value_, string->size_);
+        _assert(completion.size >= begin.size());
         completion.data += begin.size();
         completion.size -= begin.size();
 
+        if (completion.size == 0 && driver.mode_ == CYDriver::AutoMessage)
+            completion = "]";
+
         if (CYStartsWith(completion, "$cy"))
             continue;
         completions.push_back(completion);