summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ui/lookupwidget.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/ui/lookupwidget.c b/src/ui/lookupwidget.c
index 1975610e..123ac6c4 100644
--- a/src/ui/lookupwidget.c
+++ b/src/ui/lookupwidget.c
@@ -324,12 +324,15 @@ static iThreadResult worker_LookupWidget_(iThread *thread) {
324 while (nextSplit_Rangecc(range_String(&d->pendingTerm), " ", &word)) { 324 while (nextSplit_Rangecc(range_String(&d->pendingTerm), " ", &word)) {
325 if (isEmpty_Range(&word)) continue; 325 if (isEmpty_Range(&word)) continue;
326 if (!isFirst) appendCStr_String(pattern, ".*"); 326 if (!isFirst) appendCStr_String(pattern, ".*");
327 for (const char *ch = word.start; ch != word.end; ch++) { 327 const iString wordStr = { iBlockLiteral(word.start,
328 word.end - word.start,
329 word.end - word.start) };
330 iConstForEach(String, ch, &wordStr) {
328 /* Escape regular expression characters. */ 331 /* Escape regular expression characters. */
329 if (isSyntaxChar_RegExp(*ch)) { 332 if (isSyntaxChar_RegExp(ch.value)) {
330 appendChar_String(pattern, '\\'); 333 appendChar_String(pattern, '\\');
331 } 334 }
332 appendChar_String(pattern, *ch); 335 appendChar_String(pattern, ch.value);
333 } 336 }
334 isFirst = iFalse; 337 isFirst = iFalse;
335 } 338 }
@@ -337,7 +340,7 @@ static iThreadResult worker_LookupWidget_(iThread *thread) {
337 job->term = new_RegExp(cstr_String(pattern), caseInsensitive_RegExpOption); 340 job->term = new_RegExp(cstr_String(pattern), caseInsensitive_RegExpOption);
338 delete_String(pattern); 341 delete_String(pattern);
339 } 342 }
340 const size_t termLen = size_String(&d->pendingTerm); 343 const size_t termLen = length_String(&d->pendingTerm); /* characters */
341 clear_String(&d->pendingTerm); 344 clear_String(&d->pendingTerm);
342 job->docs = d->pendingDocs; 345 job->docs = d->pendingDocs;
343 d->pendingDocs = NULL; 346 d->pendingDocs = NULL;