Cube  Diff

Differences From Artifact [e9b116439f]:

To Artifact [d5247fc383]:


294
295
296
297
298
299
300
301

302
303
304
305
306

307
308

309
310
311
312
313


314
315
316
317
318

319
320
321
322
323
324
325
326
327
328
329






330
331
332
333
334
335
336
337
294
295
296
297
298
299
300

301
302
303



304


305





306
307

308
309
310

311
312
313
314
315
316
317





318
319
320
321
322
323

324
325
326
327
328
329
330







-
+


-
-
-
+
-
-
+
-
-
-
-
-
+
+
-



-
+






-
-
-
-
-
+
+
+
+
+
+
-







void
resetcomplete()
{
	completesize = 0;
}

void
complete(OFString *s_)
complete(OFMutableString *s)
{
	@autoreleasepool {
		std::unique_ptr<char> copy(strdup(s_.UTF8String));
		char *s = copy.get();

		if (![s hasPrefix:@"/"])
		if (*s != '/') {
			string t;
			[s insertString:@"/" atIndex:0];
			strcpy_s(t, s);
			strcpy_s(s, "/");
			strcat_s(s, t);
		}


		if (s.length == 1)
		if (!s[1])
			return;

		if (!completesize) {
			completesize = strlen(s) - 1;
			completesize = s.length - 1;
			completeidx = 0;
		}

		__block int idx = 0;
		[identifiers enumerateKeysAndObjectsUsingBlock:^(
		    OFString *name, Identifier *identifier, bool *stop) {
			if (strncmp(identifier.name.UTF8String, s + 1,
			        completesize) == 0 &&
			    idx++ == completeidx) {
				strcpy_s(s, "/");
				strcat_s(s, identifier.name.UTF8String);
			if (strncmp(identifier.name.UTF8String,
			        s.UTF8String + 1, completesize) == 0 &&
			    idx++ == completeidx)
				[s replaceCharactersInRange:OFMakeRange(
				                                1, s.length - 1)
				                 withString:identifier.name];
			}
		}];

		completeidx++;

		if (completeidx >= idx)
			completeidx = 0;
	}