diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/lookupwidget.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/ui/lookupwidget.c b/src/ui/lookupwidget.c index eabfc7d2..29ae0fee 100644 --- a/src/ui/lookupwidget.c +++ b/src/ui/lookupwidget.c | |||
@@ -325,12 +325,12 @@ static iThreadResult worker_LookupWidget_(iThread *thread) { | |||
325 | iString *pattern = new_String(); | 325 | iString *pattern = new_String(); |
326 | iRangecc word = iNullRange; | 326 | iRangecc word = iNullRange; |
327 | iBool isFirst = iTrue; | 327 | iBool isFirst = iTrue; |
328 | iString wordStr; | ||
329 | init_String(&wordStr); | ||
328 | while (nextSplit_Rangecc(range_String(&d->pendingTerm), " ", &word)) { | 330 | while (nextSplit_Rangecc(range_String(&d->pendingTerm), " ", &word)) { |
329 | if (isEmpty_Range(&word)) continue; | 331 | if (isEmpty_Range(&word)) continue; |
330 | if (!isFirst) appendCStr_String(pattern, ".*"); | 332 | if (!isFirst) appendCStr_String(pattern, ".*"); |
331 | const iString wordStr = { iBlockLiteral(word.start, | 333 | setRange_String(&wordStr, word); |
332 | word.end - word.start, | ||
333 | word.end - word.start) }; | ||
334 | iConstForEach(String, ch, &wordStr) { | 334 | iConstForEach(String, ch, &wordStr) { |
335 | /* Escape regular expression characters. */ | 335 | /* Escape regular expression characters. */ |
336 | if (isSyntaxChar_RegExp(ch.value)) { | 336 | if (isSyntaxChar_RegExp(ch.value)) { |
@@ -340,6 +340,7 @@ static iThreadResult worker_LookupWidget_(iThread *thread) { | |||
340 | } | 340 | } |
341 | isFirst = iFalse; | 341 | isFirst = iFalse; |
342 | } | 342 | } |
343 | deinit_String(&wordStr); | ||
343 | iAssert(!isEmpty_String(pattern)); | 344 | iAssert(!isEmpty_String(pattern)); |
344 | job->term = new_RegExp(cstr_String(pattern), caseInsensitive_RegExpOption); | 345 | job->term = new_RegExp(cstr_String(pattern), caseInsensitive_RegExpOption); |
345 | delete_String(pattern); | 346 | delete_String(pattern); |