summaryrefslogtreecommitdiff
path: root/src/ui/lookupwidget.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-03-09 11:57:04 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-03-09 11:57:09 +0200
commit5ccb0e0096dff6c2bbdfa959610620a14fdc918d (patch)
tree3cc260a03e239dc92ef148ac10031d793395d913 /src/ui/lookupwidget.c
parent8fe9ef1bfb6264eab956c98e154891400ec9fe36 (diff)
LookupWidget: Fixed use of multiple search terms
The regexp wasn't formed correctly.
Diffstat (limited to 'src/ui/lookupwidget.c')
-rw-r--r--src/ui/lookupwidget.c7
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);